int GameState::EventLoop() { while (run_) { moveItems(); renderItems(); SDL_Event e; while (SDL_PollEvent(&e)) { handleEvents(e); } SDL_Delay(50); } return retCause_; }
void SRM_Render(Scene *scene) { int x, y, id; glClearColor(1.0, 0.0, 0.0, 1.0); glClear(GL_COLOR_BUFFER_BIT); SMM_LoadIdentity(); glEnableVertexAttribArray(attrib_coord); glEnableVertexAttribArray(attrib_color); for(x = 0; x < SCENE_WIDTH; ++x) { for(y = 0; y < SCENE_HEIGHT; ++y) { id = SCENE_GetCell(scene, x, y); renderCell(id, x, y); } } renderItems(scene); renderSnake(scene); glDisableVertexAttribArray(attrib_coord); glDisableVertexAttribArray(attrib_color); SDL_GL_SwapWindow(window); }