Inlined display functions.
This commit is contained in:
parent
c1a3dea560
commit
91709bfacc
|
|
@ -6,7 +6,7 @@
|
|||
SDL_Window *window = NULL;
|
||||
SDL_Renderer *renderer = NULL;
|
||||
|
||||
void display_init(void)
|
||||
inline void display_init(void)
|
||||
{
|
||||
if(SDL_Init(SDL_INIT_EVERYTHING))
|
||||
{
|
||||
|
|
@ -29,18 +29,18 @@ void display_init(void)
|
|||
}
|
||||
}
|
||||
|
||||
void display_update(void)
|
||||
inline void display_update(void)
|
||||
{
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
|
||||
void display_clear(void)
|
||||
inline void display_clear(void)
|
||||
{
|
||||
SDL_SetRenderDrawColor(renderer, C_BLACK);
|
||||
SDL_RenderClear(renderer);
|
||||
}
|
||||
|
||||
void display_exit(void)
|
||||
inline void display_exit(void)
|
||||
{
|
||||
SDL_DestroyRenderer(renderer);
|
||||
SDL_DestroyWindow(window);
|
||||
|
|
|
|||
|
|
@ -4,5 +4,11 @@
|
|||
|
||||
inline int pollevent(event_t *event)
|
||||
{
|
||||
return SDL_PollEvent(event);
|
||||
SDL_Event sdl_event;
|
||||
int ret = SDL_PollEvent(&sdl_event);
|
||||
|
||||
event->type = sdl_event.type;
|
||||
event->key = sdl_event.key.keysym.scancode;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,10 @@
|
|||
#define EVENT_KEY_DOWN SDL_KEYDOWN
|
||||
#define EVENT_QUIT SDL_QUIT
|
||||
|
||||
typedef SDL_Event event_t;
|
||||
typedef struct event_t {
|
||||
uint32_t type;
|
||||
SDL_Scancode key;
|
||||
} event_t;
|
||||
|
||||
int pollevent(event_t *event);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue