MCPcopy Create free account
hub / github.com/InoriRus/Kyty / game_init

Function game_init

source/emulator/src/Graphics/Window.cpp:353–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

351}
352
353bool 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
381bool game_render_and_update(GameApi* game, const Core::Timer& /*timer*/)
382{

Callers

nothing calls this directly

Calls 4

SDL_AddEventWatchFunction · 0.85
CalcFrameTimeFunction · 0.85
GetTimeSMethod · 0.80
InitFunction · 0.70

Tested by

no test coverage detected