ADD FLASH(flash.h flash.cpp flash_def.h flash_cfg.h flash_sfdp.cpp)

ADD RunTimer(log.h ticks.h ticks.cpp)
ADD sim_key form sdl
This commit is contained in:
JiXieShi
2024-11-27 13:49:34 +08:00
parent 8f7f72712c
commit a1176112ce
29 changed files with 3993 additions and 179 deletions

View File

@@ -1,6 +1,7 @@
#include "sim_key.h"
#include "log.h"
#ifndef USER_SDL3
#include<easyx.h>
#include<conio.h>
@@ -80,4 +81,31 @@ uint8_t SIM_Key_SET(uint8_t) {
uint8_t SIM_Key_RESET(uint8_t) {
return GetAsyncKeyState(VK_END);
}
}
#else
#include "SDL3/SDL.h"
uint8_t SIM_Key_Scan() {
SDL_Event event;
uint8_t key = 0;
SDL_PollEvent(&event);
switch (event.type) {
case SDL_EVENT_QUIT:
return 0;
case SDL_EVENT_KEY_DOWN:
if (event.key.key == SDLK_Q)key = SIM_KEY_SET;
if (event.key.key == SDLK_UP || event.key.key == SDLK_W)key = SIM_KEY_UP;
if (event.key.key == SDLK_DOWN || event.key.key == SDLK_S)key = SIM_KEY_DOWN;
if (event.key.key == SDLK_LEFT || event.key.key == SDLK_A)key = SIM_KEY_LEFT;
if (event.key.key == SDLK_RIGHT || event.key.key == SDLK_D)key = SIM_KEY_RIGHT;
if (event.key.key == SDLK_R)key = SIM_KEY_RESET;
if (event.key.key == SDLK_KP_ENTER || event.key.key == SDLK_E)key = SIM_KEY_ENABLE;
break;
default:
break;
}
return key;
}
#endif

View File

@@ -5,6 +5,9 @@ extern "C" {
#endif
#include "stdint.h"
//是否启用SDL3获取按键事件
#define USER_SDL3
typedef enum Key_map {
SIM_KEY_UP = 1,
SIM_KEY_DOWN,