| 351 | } |
| 352 | |
| 353 | bool game_init(GameApi* game, const Core::Timer& timer, void* data) |
| 354 | { |
| 355 | EXIT_IF(game == nullptr); |
| 356 | EXIT_IF(data == nullptr); |
| 357 | EXIT_IF(game->data1 || game->data2); |
| 358 | |
| 359 | auto* ctx = static_cast<GraphicContext*>(data); |
| 360 | |
| 361 | EXIT_IF(ctx->screen_width == 0 || ctx->screen_height == 0); |
| 362 | |
| 363 | auto* pdata = new GameApiPrivateStruct; |
| 364 | pdata->ctx = ctx; |
| 365 | |
| 366 | game->data1 = pdata; |
| 367 | game->data2 = new SDL_Event; |
| 368 | |
| 369 | SDL_AddEventWatch(game_sdl_event_filter, game->data1); |
| 370 | |
| 371 | game->m_screen_width = ctx->screen_width; |
| 372 | game->m_screen_height = ctx->screen_height; |
| 373 | |
| 374 | // SDL_ShowWindow(ctx->window); |
| 375 | |
| 376 | CalcFrameTime(game, timer.GetTimeS()); |
| 377 | |
| 378 | return Init(game); |
| 379 | } |
| 380 | |
| 381 | bool game_render_and_update(GameApi* game, const Core::Timer& /*timer*/) |
| 382 | { |
nothing calls this directly
no test coverage detected