From c5520ffc46e6f61333053a92f3d0ea172920a543 Mon Sep 17 00:00:00 2001 From: tracer-ics2023 Date: Wed, 25 Sep 2024 20:48:41 +0800 Subject: [PATCH] =?UTF-8?q?>=20=20compile=20NEMU=20221220000=20=E5=BC=A0?= =?UTF-8?q?=E4=B8=89=20Linux=20zzy=205.15.146.1-microsoft-standard-WSL2=20?= =?UTF-8?q?#1=20SMP=20Thu=20Jan=2011=2004:09:03=20UTC=202024=20x86=5F64=20?= =?UTF-8?q?x86=5F64=20x86=5F64=20GNU/Linux=20=2020:48:41=20up=207=20days,?= =?UTF-8?q?=2020:49,=20=201=20user,=20=20load=20average:=200.35,=200.33,?= =?UTF-8?q?=200.27?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- navy-apps/libs/libminiSDL/src/event.c | 17 +++++++++++++++++ navy-apps/libs/libminiSDL/src/video.c | 1 - 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/navy-apps/libs/libminiSDL/src/event.c b/navy-apps/libs/libminiSDL/src/event.c index 1c8c3dc..6f06b17 100644 --- a/navy-apps/libs/libminiSDL/src/event.c +++ b/navy-apps/libs/libminiSDL/src/event.c @@ -1,5 +1,6 @@ #include #include +#include #define keyname(k) #k, @@ -17,6 +18,22 @@ int SDL_PollEvent(SDL_Event *ev) { } int SDL_WaitEvent(SDL_Event *event) { + char buf[64]; + while (NDL_PollEvent(buf, sizeof(buf))) { + if (buf[0] == 'k') { + if (buf[1] == 'd') { + event->type = SDL_KEYDOWN; + } else if (buf[1] == 'u') { + event->type = SDL_KEYUP; + } + for (int i = 0; i < sizeof(keyname) / sizeof(keyname[0]); i ++ ) { + if (strcmp(buf + 3, keyname[i]) == 0) { + event->key.keysym.sym = i; + break; + } + } + } + } return 1; } diff --git a/navy-apps/libs/libminiSDL/src/video.c b/navy-apps/libs/libminiSDL/src/video.c index 43ae97c..031cf07 100644 --- a/navy-apps/libs/libminiSDL/src/video.c +++ b/navy-apps/libs/libminiSDL/src/video.c @@ -7,7 +7,6 @@ void SDL_BlitSurface(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) { assert(dst && src); assert(dst->format->BitsPerPixel == src->format->BitsPerPixel == 32); - assert(0); SDL_Rect rect = { .w = srcrect ? srcrect->w : src->w, .h = srcrect ? srcrect->h : src->h,