From 879fb2adefadbc5f38711cd8f01bcc4cee053e3d Mon Sep 17 00:00:00 2001 From: jacopo grandi Date: Tue, 2 Mar 2021 09:44:19 +0100 Subject: i hate cmake, g++, ld, collect2, cc1, x86_64-w64-mingw32 --- main.c | 49 +++++++++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 20 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index f9da679..c9ee420 100644 --- a/main.c +++ b/main.c @@ -1,23 +1,27 @@ //#define LCB_NO_CONSOLE -#include -#include +#define SDL_MAIN_HANDLED +#include +#include + #include #include -#include -#include -#include -#include -#include -#include -#include +#include "json/jsonparse.h" +#include "render/render_text.h" +#include "render/graphicsettings.h" +#include "render/button.h" +#include "mkb/mkb.h" +#include "umath/vec.h" + +#include "gst/units.h" +#include "gst/map.h" +#include "gst/info.h" +#include "gst/gst.h" + +#include "hud/hud.h" +#include "net/net.h" -#include -#include -#include -#include -#include //The music that will be played Mix_Music *gMusic = NULL; @@ -29,7 +33,6 @@ Mix_Chunk *sounds[16]; struct a { int v; } biga; int main( int argc, char* args[] ) { - net_init(); graphic_settings gs = { 1250, 700 }; @@ -39,6 +42,8 @@ int main( int argc, char* args[] ) { SDL_Init(SDL_INIT_VIDEO); + net_init(); + SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0"); window = SDL_CreateWindow("DESCRIPT", SDL_WINDOWPOS_UNDEFINED, @@ -94,11 +99,13 @@ int main( int argc, char* args[] ) { infos info; info_load(&info); + gamestate gst; gst_init(&gst); gst.cam[0] = -gs.resx/2+gst.map_editor.sx*gst.map_editor.ts/2; gst.cam[1] = -gs.resy/2+gst.map_editor.sy*gst.map_editor.ts/2; + // hud hud _hud; hud_init(&gs, &_hud, &textd); @@ -107,6 +114,7 @@ int main( int argc, char* args[] ) { info_load_army(gst.army_bp+0, _hud.og.army_list[0]); info_load_playername(_hud.og.playername); + float mlast[2] = {0, 0}; // fxs @@ -118,12 +126,12 @@ int main( int argc, char* args[] ) { net_server nets; int server = 0; - bool quit = false; + int quit = 0; SDL_Event e; while(!quit) { while(SDL_PollEvent(&e) != 0) { if(e.type == SDL_QUIT) { - quit = true; + quit = 1; } if(e.type == SDL_WINDOWEVENT && e.window.event == SDL_WINDOWEVENT_RESIZED ) { @@ -134,7 +142,7 @@ int main( int argc, char* args[] ) { mkb_event(&mkb, &e); } - bool render = false; + int render = 0; double startTime = SDL_GetTicks(); double passedTime = (startTime - last_time)/1000; @@ -164,7 +172,7 @@ int main( int argc, char* args[] ) { gst_process(&gst, &info, &fx, tot_time); fx_process(&fx, tot_time); - render = true; + render = 1; unprocessed_time -= FRAME_TIME; mlast[0] = mkb.mx; mlast[1] = mkb.my; mkb_process(&mkb); @@ -194,7 +202,8 @@ int main( int argc, char* args[] ) { Mix_Quit(); SDL_Quit(); net_client_close(&netc); + net_server_close(&nets); gst_destroy(&gst); - + return 0; } \ No newline at end of file -- cgit v1.2.3-54-g00ecf