diff --git a/CMakeLists.txt b/CMakeLists.txt index 30e20cc..6743ede 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,13 +49,22 @@ add_subdirectory(third-party/libxm SYSTEM) if(LINUX) - set(SYSTEM_SOURCE_FILES - src/system/linux/twn_elf.c + set(SYSTEM_SOURCE_FILES src/system/linux/twn_elf.c) +else() + set(SYSTEM_SOURCE_FILES) +endif() + +if(EMSCRIPTEN) + set(TWN_RENDERING_API WEBGL1) +else() + set(TWN_RENDERING_API OPENGL_15) +endif() + +if(TWN_RENDERING_API MATCHES OPENGL_15) + set(SYSTEM_SOURCE_FILES ${SYSTEM_SOURCE_FILES} src/rendering/twn_gl_any_rendering.c src/rendering/twn_gl_15_rendering.c src/rendering/twn_gl_15_gpu_texture.c) -else() - set(SYSTEM_SOURCE_FILES) endif() set(TWN_THIRD_PARTY_SOURCE_FILES diff --git a/src/game_object/twn_static_game_object_c.h b/src/game_object/twn_static_game_object_c.h index adeb7f4..9b7935e 100644 --- a/src/game_object/twn_static_game_object_c.h +++ b/src/game_object/twn_static_game_object_c.h @@ -1,5 +1,5 @@ -#include "townengine/twn_game_object.h" -#include "townengine/game_api.h" +#include "twn_game_object_c.h" +#include "twn_game_api.h" void game_object_load(void) { diff --git a/src/game_object/twn_win32_game_object_c.h b/src/game_object/twn_win32_game_object_c.h index 7814f24..32f1f8f 100644 --- a/src/game_object/twn_win32_game_object_c.h +++ b/src/game_object/twn_win32_game_object_c.h @@ -1,5 +1,5 @@ -#include "townengine/twn_game_object.h" -#include "townengine/context.h" +#include "twn_game_object_c.h" +#include "twn_engine_context_c.h" #include #include @@ -48,7 +48,7 @@ static void load_game_object(void) { handle = new_handle; - if (ctx.tick_count != 0) + if (ctx.game.tick_count != 0) log_info("Game object was reloaded\n"); return; diff --git a/src/rendering/twn_circles.c b/src/rendering/twn_circles.c index 9d76720..4408ecf 100644 --- a/src/rendering/twn_circles.c +++ b/src/rendering/twn_circles.c @@ -1,6 +1,7 @@ #include "twn_util.h" #include "twn_engine_context_c.h" #include "twn_rendering_c.h" +#include "twn_rendering.h" #include #include diff --git a/src/rendering/twn_triangles.c b/src/rendering/twn_triangles.c index 4be105a..f47d59c 100644 --- a/src/rendering/twn_triangles.c +++ b/src/rendering/twn_triangles.c @@ -1,3 +1,4 @@ +#include "twn_rendering.h" #include "twn_rendering_c.h" #include "twn_engine_context_c.h" #include "twn_textures_c.h" diff --git a/src/twn_engine_context_c.h b/src/twn_engine_context_c.h index 8854cc9..60c9bb2 100644 --- a/src/twn_engine_context_c.h +++ b/src/twn_engine_context_c.h @@ -3,6 +3,7 @@ #include "twn_context.h" #include "twn_textures_c.h" +#include "twn_engine_api.h" #include "twn_input.h" #include "rendering/twn_rendering_c.h" @@ -47,6 +48,6 @@ typedef struct engine_context { bool was_successful; } t_engine_ctx; -extern t_engine_ctx ctx; +TWN_API extern t_engine_ctx ctx; #endif