void unigi_event_get(unigi_type_event * event) { SDL_Event platform_event; if (SDL_PollEvent(&platform_event)) { if ( platform_event.type == SDL_KEYDOWN || platform_event.type == SDL_KEYUP ) { event -> type = unigi_enum_event_input_keyboard; event -> data.input_keyboard.device = 0; event -> data.input_keyboard.button = platform_event.key.keysym.scancode; event -> data.input_keyboard.down = (platform_event.type == SDL_KEYDOWN); return; } if (platform_event.type == SDL_MOUSEMOTION) { event -> type = unigi_enum_event_input_mouse_move; event -> data.input_mouse_move.rel_x = platform_event.motion.xrel; event -> data.input_mouse_move.rel_y = platform_event.motion.yrel; event -> data.input_mouse_move.abs_x = platform_event.motion.x; event -> data.input_mouse_move.abs_y = platform_event.motion.y; return; } if ( platform_event.type == SDL_MOUSEBUTTONDOWN || platform_event.type == SDL_MOUSEBUTTONUP ) { event -> type = unigi_enum_event_input_mouse_button; event -> data.input_mouse_button.button = platform_event.button.button; event -> data.input_mouse_button.down = (platform_event.type == SDL_MOUSEBUTTONDOWN); return; } event -> type = unigi_enum_event_unknown; return; } else { event -> type = unigi_enum_event_none; return; } }