8 DECLSPEC
int isKeyDown(int key
) {
10 Uint8
*keystate
= SDL_GetKeyState(&num
);
11 return keystate
[key
]? 1:0;
14 DECLSPEC
int isKeyPressed(int key
) {
17 Uint8
*keystate
= SDL_GetKeyState(&num
);
19 oldkeys
=calloc(num
,1);
20 if (keystate
[key
]&&!oldkeys
[key
])
22 oldkeys
[key
] = keystate
[key
];
26 DECLSPEC
int isKeyReleased(int key
) {
29 Uint8
*keystate
= SDL_GetKeyState(&num
);
31 oldkeys
=calloc(num
,1);
32 if (!keystate
[key
]&&oldkeys
[key
])
34 oldkeys
[key
] = keystate
[key
];
38 DECLSPEC
int getPressedKey() {
40 for (i
= 1; i
< SDLK_LAST
; i
++)
46 DECLSPEC
int getReleasedKey() {
48 for (i
= 1; i
< SDLK_LAST
; i
++)
54 DECLSPEC
char getPressedChar() {
55 // nead to use the window queue for this
58 if (!SDL_PollEvent(&evt
))
60 if (evt
.type
!=SDL_KEYDOWN
)
62 ret
= evt
.key
.keysym
.unicode
&0x7F;