diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 58 |
1 files changed, 13 insertions, 45 deletions
@@ -1,17 +1,17 @@ static void _setup_input(); static int _main_loop(void *udata); -#define map(X) extern const Tiled2cMap m##X##_tmj; g_push_map(&m##X##_tmj); +#define map(X) \ + extern const Tiled2cMap m##X##_tmj; \ + g_push_map(&m##X##_tmj); int main([[maybe_unused]] int argc, [[maybe_unused]] char **argv) { defer(wdeinit); defer(input_deinit); _setup_input(); - assert(TZR_Init(.width=cfg.display_width, - .height=cfg.display_height, - .scale=3, - .target_fps=cfg.fps, - .basepath=argv[1]) == 0); + assert(TZR_Init(.width = cfg.display_width, + .height = cfg.display_height, .scale = 3, + .target_fps = cfg.fps, .basepath = argv[1]) == 0); defer(TZR_Quit); TZR_ToggleFullscreen(); g_init(); @@ -21,10 +21,10 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char **argv) { map(3); map(upndown); map(worldmap); - //map(beat); - //map(game); - //map(somewhere); - g_spawn_entities(); + // map(beat); + // map(game); + // map(somewhere); + g_map_restart(); TZR_MainLoop(_main_loop, nullptr); return 0; } @@ -71,7 +71,7 @@ static void _setup_input() { } static int _main_loop([[maybe_unused]] void *udata) { - //if (TZR_GetTick() == 0) + // if (TZR_GetTick() == 0) // TZR_PlayMusic("res/bgm.wav", -1); g_update(); @@ -80,42 +80,10 @@ static int _main_loop([[maybe_unused]] void *udata) { return 1; assert(TZR_DrawBegin() == 0); - TZR_DrawSetColor(1, 1, 1); + bgcolor(); TZR_DrawClear(); - vec2 v = v2(cfg.tile_width, 0); - static f32 or = 0.01; - if ((TZR_GetTick() + 15) / 30 % 2 == 0) - or += 0.01; - else - or -= 0.01; - const auto r = sinf(or * 14) / 12; - - TZR_BlendMode(SDL_BLENDMODE_MUL); - { - setbgcolor(1, 1, 1); - setfgcolor(0, 0, 0); - g_draw(0, 0); - } - { - vec2 c = v2_round(v2_transform(v, m3_rotating(r / 0.1592))); - setbgcolor(1, 1, 1); - setfgcolor(0, 1, 1); - g_draw(c.x, c.y); - } - { - vec2 c = v2_round(v2_transform(v, m3_rotating((r + 0.333) / 0.1592))); - setbgcolor(1, 1, 1); - setfgcolor(1, 0, 1); - g_draw(c.x, c.y); - } - { - vec2 c = v2_round(v2_transform(v, m3_rotating((r + 0.666) / 0.1592))); - setbgcolor(1, 1, 1); - setfgcolor(1, 1, 0); - g_draw(c.x, c.y); - } - TZR_BlendMode(SDL_BLENDMODE_BLEND); + g_draw(0, 0); assert(TZR_DrawEnd() == 0); return 0; |