嵌入式产品级-超小尺寸游戏机(从0到1 硬件-软件-外壳)

news/2025/2/25 15:37:26

Ultra-small size gaming console。

超小尺寸游戏机-Pico

This embedded product is mainly based on miniaturization, followed by his game functions are also very complete, for all kinds of games can be played, and there will be relevant illustrations in the follow-up of the article.

This product is a very, very small game console, and he has all the functions inherent in the game console.

这款超小尺寸游戏机Pico,是一款结合了小型化设计和强大游戏功能的嵌入式设备。它的体积非常紧凑,适合携带,同时它依然保留了传统游戏机的各种功能。无论是经典的2D横版游戏、复古的街机游戏,还是一些现代的小游戏,Pico都能够顺利运行。

Pico的设计重点之一就是极致的便携性,尽管体积小,但依然能提供丰富的游戏体验。它通常具备类似按键、显示屏和扬声器的基本硬件配置,能够满足各种游戏操作的需求。此外,Pico内置了游戏模拟器和相关软件,使得用户能够体验不同平台上的游戏。

具体来说,这款游戏机可能搭载了流行的嵌入式开发平台,如Raspberry Pi Pico,支持多种编程语言和工具,甚至可以通过自定义代码和硬件扩展来进一步增强其功能。

  • 极致便携性:Pico的尺寸非常小巧,方便携带。无论是放口袋里还是随身携带,都不占太多空间,适合外出时随时随地享受游戏。

  • 强大兼容性:它支持多种游戏模拟器和格式,能够运行各类经典游戏,包括复古街机游戏、掌机游戏等,甚至可以自定义加载新游戏。

  • 高性价比:作为一款小型游戏机,Pico提供的功能远超其体积。你可以以较低的成本享受到多种游戏的娱乐体验,同时它还支持编程开发,适合开发者进行定制化应用。

  • 开源与可定制性:Pico基于流行的嵌入式平台(如Raspberry Pi Pico),具有开源特性,允许用户根据个人需求进行软件和硬件的修改和扩展,能够轻松实现个性化定制。

  • 简单易用:操作界面简洁,用户只需轻松连接显示设备和控制器,就可以迅速开始游戏。无论是初学者还是有经验的玩家都能很快上手。

  • 节能高效:由于体积小,功耗低,Pico非常节能,适合长时间游戏而不需要频繁充电。

  • 丰富的开发资源:由于其基于开放平台,Pico有着丰富的开发资源和社区支持,用户可以轻松找到教程、工具和讨论,快速进行功能扩展。

  • 多功能集成:除了作为游戏机,Pico还可以作为其他嵌入式项目的开发平台,具备了强大的开发潜力和应用灵活性。

下述为原理图以及PCB。

下述为相关游戏的部分案例代码。

import PICOplaygame 
import time 
import random 
import gc from machine 
import freq
freq(125_000_000)
gc.enable() # This line helps make sure we don't run out of memory
# Sensitive game parameters
XVel = 0.05 YVel = 0 Distance = 0 YPos = 0 Gravity = 0.15 MaxFPS = 60 Points = 0 GameRunning = True CactusPos = random.randint(72, 300) CloudPos = random.randint(60, 200) JumpSoundTimer = 0
# Sprite data
PlayerSpr = bytearray([0x04 ^ 0xFF, 0x08 ^ 0xFF, 0xC8 ^ 0xFF, 0xBC ^ 0xFF, 0x1C ^ 0xFF, 0x0E ^ 0xFF, 0x1A ^ 0xFF, 0x2C ^ 0xFF]) PlayerRunFrame1 = bytearray([0xFF, 0xFF, 0xFF, 0xFD, 0xF9, 0xBB, 0xBB, 0xD3, 0xE1, 0xF1, 0xC1, 0xB3, 0x61, 0xD5, 0xF3, 0xFF]) PlayerRunFrame2 = bytearray([0xFF, 0xFF, 0xF7, 0xFB, 0xFB, 0xFB, 0x3B, 0x93, 0xE3, 0x71, 0x03, 0xE7, 0xC3, 0xAB, 0xE7, 0xFF]) CactusSpr1 = bytearray([0x00 ^ 0xFF, 0xFC ^ 0xFF, 0x86 ^ 0xFF, 0x92 ^ 0xFF, 0xC2 ^ 0xFF, 0xFC ^ 0xFF, 0x00 ^ 0xFF, 0x00 ^ 0xFF]) CactusSpr2 = bytearray([0x00 ^ 0xFF, 0x1E ^ 0xFF, 0x10 ^ 0xFF, 0xFE ^ 0xFF, 0xE4 ^ 0xFF, 0x20 ^ 0xFF, 0x78 ^ 0xFF, 0x00 ^ 0xFF]) CloudSpr = bytearray([0x9F, 0x4F, 0x63, 0x59, 0xBD, 0x73, 0x73, 0x65, 0x5C, 0x7E, 0x7E, 0x51, 0x57, 0x4F, 0x1F, 0xBF])
CactusSpr = CactusSpr1
PICOplaygame.display.fill(0) PICOplaygame.display.drawText("Tinysaur", 12, 0, 1) PICOplaygame.display.drawText("  Run", 15, 9, 1) PICOplaygame.display.update()
PICOplaygame.display.setFPS(60)
PICOplaygame.saveData.setName("SaurRun")
while(PICOplaygame.buttonA.pressed() == True or PICOplaygame.buttonB.pressed() == True): if(time.ticks_ms() % 1000 < 500): PICOplaygame.display.drawFilledRectangle(0, 32, 72, 8, 0)
        PICOplaygame.display.drawText("Press A/B", 9, 32, 1) else: PICOplaygame.display.drawFilledRectangle(0, 32, 72, 8, 1)
        PICOplaygame.display.drawText("Press A/B", 9, 32, 0) PICOplaygame.display.update()
    pass while(PICOplaygame.buttonA.pressed() == False and PICOplaygame.buttonB.pressed() == False): if(time.ticks_ms() % 1000 < 500): PICOplaygame.display.drawFilledRectangle(0, 32, 72, 8, 0)
        PICOplaygame.display.drawText("Press A/B", 9, 32, 1) else: PICOplaygame.display.drawFilledRectangle(0, 32, 72, 8, 1)
        PICOplaygame.display.drawText("Press A/B", 9, 32, 0) PICOplaygame.display.update()
    pass while(PICOplaygame.buttonA.pressed() == True or PICOplaygame.buttonB.pressed() == True): if(time.ticks_ms() % 1000 < 500): PICOplaygame.display.drawFilledRectangle(0, 32, 72, 8, 0)
        PICOplaygame.display.drawText("Press A/B", 9, 32, 1) else: PICOplaygame.display.drawFilledRectangle(0, 32, 72, 8, 1)
        PICOplaygame.display.drawText("Press A/B", 9, 32, 0) PICOplaygame.display.update()
    pass
while(GameRunning): t0 = time.ticks_us() # Check the time
    # Is the player on the ground and trying to jump?
    if(JumpSoundTimer < 0): JumpSoundTimer = 0 if((PICOplaygame.buttonA.pressed() == True or PICOplaygame.buttonB.pressed() == True) and YPos == 0.0): # Jump!
        JumpSoundTimer = 200
        YVel = -2.5
    # Handle "dynamics"
    YPos += YVel
    YVel += Gravity
    Distance += XVel
    JumpSoundTimer -= 15
    if(JumpSoundTimer > 0): PICOplaygame.audio.set(500-JumpSoundTimer) else: PICOplaygame.audio.stop()
    # Accelerate the player just a little bit
    XVel += 0.000025
    # Make sure we haven't fallen below the groundW
    if(YPos > 0): YPos = 0.0
        YVel = 0.0
    # Has the player hit a cactus?
    if(CactusPos < 8 and CactusPos > -8 and YPos > -8): # Stop the game and give a prompt
        GameRunning = False
        PICOplaygame.display.fill(1)
        PICOplaygame.audio.stop()
        PICOplaygame.display.drawText("Oh no!", 18, 1, 0)
        PICOplaygame.display.drawText(str(int(Distance))+"m", 26, 9, 0) high = -1
        if(PICOplaygame.saveData.hasItem("highscore")): high = int(PICOplaygame.saveData.getItem("highscore"))
            PICOplaygame.display.drawText("High: " + str(high)+"m", 8, 17, 0) if(Distance > high): PICOplaygame.saveData.setItem("highscore", Distance)
            PICOplaygame.saveData.save() PICOplaygame.display.drawText("Again?", 19, 25, 0)
        PICOplaygame.display.drawText("A:N B:Y", 16, 33, 0)
        PICOplaygame.display.update()
        PICOplaygame.audio.playBlocking(300, 250)
        PICOplaygame.audio.play(260, 250)
        while(PICOplaygame.inputPressed() == False): pass # Wait for the user to give us something
        while(GameRunning == False): if(PICOplaygame.buttonB.pressed() == True == 1): # Restart the game
                XVel = 0.05
                YVel = 0
                Distance = 0
                YPos = 0
                Points = 0
                GameRunning = True
                CactusPos = random.randint(72, 300)
                CloudPos = random.randint(60, 200)
            elif(PICOplaygame.buttonA.pressed() == True): # Quit
                PICOplaygame.reset() # Exit game to main menu
    # Is the cactus out of view?
    if(CactusPos < -24): # "spawn" another one (Set its position some distance ahead and change the sprite) Points += 10
        PICOplaygame.audio.play(440, 300)
        CactusPos = random.randint(72, 500)
        if(random.randint(0, 1) == 0): CactusSpr = CactusSpr1 else: CactusSpr = CactusSpr2
    # Is the cloud out of view?
    if(CloudPos < -32): # "spawn" another one
        CloudPos = random.randint(40, 200)
    # More dynaaaaaaaaaaaamics
    CactusPos -= XVel * 16
    CloudPos -= XVel * 2
    # Draw game state
    PICOplaygame.display.fill(1)
    PICOplaygame.display.blit(CactusSpr, int(16 + CactusPos), 24, 8, 8, 1, 0, 0) PICOplaygame.display.blit(CloudSpr, int(16 + CloudPos), 8, 16, 8, 1, 0, 0)
    if(t0 % 250000 < 125000 or YPos != 0.0): # Player is in first frame of run animation
        PICOplaygame.display.blit(PlayerRunFrame1, 8, int(23 + YPos), 16, 8, 1, 0, 0) else: # Player is in second frame of run animation
        PICOplaygame.display.blit(PlayerRunFrame2, 8, int(24 + YPos), 16, 8, 1, 0, 0)
    PICOplaygame.display.drawFilledRectangle(0, 31, PICOplaygame.display.width, 9, 0) # Ground PICOplaygame.display.drawText(str(int(Points)), 0, 0, 0) # Current points PICOplaygame.display.drawText("pts", len(str(int(Points))) * 8, 0, 0) PICOplaygame.display.drawText(str(int(Distance)), 0, 32, 1) # Current distance PICOplaygame.display.drawText("m", len(str(int(Distance))) * 8, 32, 1) PICOplaygame.display.update()
    # Spin wheels until we've used up one frame's worth of time
    while(time.ticks_us() - t0 < 1000000.0 / MaxFPS): pass 

下述内容就是功能演示了。


http://www.niftyadmin.cn/n/5865661.html

相关文章

jupyterhub on k8s 配置用户名密码 简单版

如果只是小组内使用 不想共用密码 也不想搞复杂认证方案 那么就直接通过map(用户名,密码md5值)来制定密码 config.yaml部分内容 hub:config:JupyterHub:shutdown_on_logout: true # 用户logout 自动stop jupyter pod,家目录下所有文件会被保存到pvc 即启动后之前家目录下…

图神经网络实战(24)——基于LightGCN构建推荐系统

图神经网络实战&#xff08;24&#xff09;——基于LightGCN构建推荐系统 0. 前言1. Book-Crossing 数据集介绍2. Book-Crossing 数据集预处理3. 构建 LightGCN 架构3.1 LightGCN 架构2. 实现 LightGCN3.3 损失函数3.4 模型训练与测试3.5 生成推荐 小结系列链接 0. 前言 推荐系…

springboot411-基于Java的自助客房服务系统(源码+数据库+纯前后端分离+部署讲解等)

&#x1f495;&#x1f495;作者&#xff1a; 爱笑学姐 &#x1f495;&#x1f495;个人简介&#xff1a;十年Java&#xff0c;Python美女程序员一枚&#xff0c;精通计算机专业前后端各类框架。 &#x1f495;&#x1f495;各类成品Java毕设 。javaweb&#xff0c;ssm&#xf…

详解Flask Flash Message(消息闪现)

目录 安装 Flask 入门:Flask flash() 基本示例 进阶:使用 Flask-WTF Flash 登录结果消息 详解:get_flashed_messages() 详解:flash() 消息的完整生命周期 Flask 提供 flash() 用于向 用户传递临时消息,通常用于: • 表单提交成功或失败 • 用户登录、注册、退出提…

【C++】 stack和queue以及模拟实现

一、stack及其模拟实现 1.1 stack介绍 stack是一种容器适配器&#xff0c;专门用在具有后进先出操作的上下文环境中&#xff0c;其删除只能从容器的一端进行 元素的插入与提取操作。stack是作为容器适配器被实现的&#xff0c;容器适配器即是对特定类封装作为其底层的容器&am…

MongoDB#Code和Function

背景 在MongoDB Shell中, 使用db.system.js.inertOne 新增一个自定义函数后&#xff0c;读取值类型显示Code Class&#xff0c;该如何使用&#xff1f;Code类型和Function能互相转换吗&#xff1f; 实践 // 保存一个函数到 system.js 集合 db.system.js.insertOne({_id: &qu…

课程1. 深度学习简介

课程1. 深度学习简介 神经网络结构逻辑回归XOR问题&#xff08;异或问题&#xff09; 中间特征的生成全连接神经网络中间网络层的激活函数Sigmoid函数Tanh函数ReLU函数其它激活函数 使用全连接神经网络解决 XOR 问题神经网络用于回归问题训练神经网络 不同类型的神经网络 附加材…

OpenCV计算摄影学Computational Photography

操作系统&#xff1a;ubuntu22.04 OpenCV版本&#xff1a;OpenCV4.9 IDE:Visual Studio Code 编程语言&#xff1a;C11 算法描述 计算摄影学&#xff08;Computational Photography&#xff09;是一门结合了数字图像处理、计算机视觉和光学的交叉学科领域&#xff0c;旨在通过…