#pragma once #include "TZR_resource.h" #include "TZR_render.h" #include "TZR_events.h" #include /* TZR manages all loaded resources internally and tries to avoid duplicate. * A resource can be loaded multiple times if asked, identification doesn't rely * on filepath. In doubt, use TZR_LoadResource ONCE per asset and store the ID. * Resources are exposed as ID instead of pointer, as a future proof measure in * case TZR needs to rearrange memory at runtime in the future. */ #define TZR_Init(...) _TZR_Init(&(const TZR_Config){ \ .width=256, \ .height=224, \ .scale=2, \ .target_fps=60, \ .pixel_perfect=true, \ .hd_render=false, \ .scale_linear=false, \ .show_cursor=false, \ .mixer=TZR_MIXER_ON, \ .png_loading=true, \ .title="TZR", \ ._=0, __VA_ARGS__ }) /* Should be called only once before usage of any other function unless * otherwise specified. On error this calls TZR_Quit and returns -1. * `config` will be duplicated internally and can be safely discarded. */ #if __STDC_VERSION__ > 201710L [[nodiscard]] #endif int _TZR_Init(const TZR_Config *config); /* Destroy and free everything created by TZR. */ void TZR_Quit(void); /* Return non-zero value when a quit event has been received. */ int TZR_ShouldQuit(void); int TZR_MainLoop(int (*main_loop)(void *udata), void *udata); unsigned long TZR_GetTick(void);