> compile NEMU
221220000 张三 Linux zzy 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux 20:48:41 up 7 days, 20:49, 1 user, load average: 0.35, 0.33, 0.27
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
#include <NDL.h>
|
#include <NDL.h>
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define keyname(k) #k,
|
#define keyname(k) #k,
|
||||||
|
|
||||||
@ -17,6 +18,22 @@ int SDL_PollEvent(SDL_Event *ev) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int SDL_WaitEvent(SDL_Event *event) {
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
void SDL_BlitSurface(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) {
|
void SDL_BlitSurface(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) {
|
||||||
assert(dst && src);
|
assert(dst && src);
|
||||||
assert(dst->format->BitsPerPixel == src->format->BitsPerPixel == 32);
|
assert(dst->format->BitsPerPixel == src->format->BitsPerPixel == 32);
|
||||||
assert(0);
|
|
||||||
SDL_Rect rect = {
|
SDL_Rect rect = {
|
||||||
.w = srcrect ? srcrect->w : src->w,
|
.w = srcrect ? srcrect->w : src->w,
|
||||||
.h = srcrect ? srcrect->h : src->h,
|
.h = srcrect ? srcrect->h : src->h,
|
||||||
|
Reference in New Issue
Block a user