- Added turbo option, to allow waiting for events and use less CPU
This commit is contained in:
8
mini.cpp
8
mini.cpp
@@ -9,6 +9,8 @@
|
||||
#include <libgen.h>
|
||||
#endif
|
||||
|
||||
extern DECLSPEC int SDLCALL (*event_handler_ptr)(SDL_Event*) = &SDL_PollEvent;
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
struct surface_t {
|
||||
@@ -280,7 +282,7 @@ int main(int argc,char*argv[]){
|
||||
mouse_just_pressed = 0;
|
||||
while(!should_exit) {
|
||||
mouse_wheel = 0;
|
||||
while(SDL_PollEvent(&mini_eve)) {
|
||||
while(event_handler_ptr(&mini_eve)) {
|
||||
if (mini_eve.type == SDL_QUIT) { should_exit=true; should_quit=true; break; }
|
||||
if (mini_eve.type == SDL_KEYDOWN) {
|
||||
/*
|
||||
@@ -1211,6 +1213,10 @@ const char *configfolder() {
|
||||
return file_getconfigfolder();
|
||||
}
|
||||
|
||||
void setturbo(const bool value) {
|
||||
event_handler_ptr = value ? &SDL_PollEvent : &SDL_WaitEvent;
|
||||
}
|
||||
|
||||
void exit() {
|
||||
should_exit = true;
|
||||
should_quit = true;
|
||||
|
||||
Reference in New Issue
Block a user