int Application::Start(void) { _screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 32, SDL_SWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER); SDL_WM_SetCaption("My Test Game (SDL/OpenGL)", NULL); Uint32 start; SDL_Event event; InitGL(); while (_running) { start = SDL_GetTicks(); while (SDL_PollEvent(&event)) { if (event.type == SDL_QUIT) { _running = false; } if (event.type == SDL_MOUSEBUTTONDOWN) { _mousein = true; } KeyHandler(); } Render(); Update(); if (1000/GAME_FPS > (SDL_GetTicks()-start)) SDL_Delay(1000/GAME_FPS > (SDL_GetTicks()-start)); } destroyApplication(); return 0; }
void Event_Kbd(uint8_t AKbdSide, uint8_t AKey) { //klPrintf("Key = %u %u\r", Keys.Kbd[0], Keys.Kbd[1]); if (AKbdSide == KBD_SIDE_A) KeyHandler(AKey, Settings.CodeALength, Settings.CodeA); else KeyHandler(AKey, Settings.CodeBLength, Settings.CodeB); }