summaryrefslogtreecommitdiff
path: root/src/core/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/include')
-rw-r--r--src/core/include/engine/core/platform.h55
-rw-r--r--src/core/include/engine/engine.h58
2 files changed, 60 insertions, 53 deletions
diff --git a/src/core/include/engine/core/platform.h b/src/core/include/engine/core/platform.h
new file mode 100644
index 0000000..3d965b7
--- /dev/null
+++ b/src/core/include/engine/core/platform.h
@@ -0,0 +1,55 @@
+#ifndef ENGINE_CORE_PLATFORM_H
+#define ENGINE_CORE_PLATFORM_H
+
+#include <engine/core/types.h>
+#include <engine/core/memory.h>
+#include <engine/ctrl/input.h>
+#include <engine/rendering/window.h>
+#include <engine/utils/vector.h>
+
+#define NUM_GLOBAL_BINDINGS 1
+
+/* Defines the internally used state of the engine.
+ * A single instance is created during `engine_init`, and used as a global
+ * variable (yeah, im sorry). Due to this design flaw the engine as a whole is
+ * not quite thread safe.
+ */
+typedef struct Platform {
+ void* data; /* Contains textures and such */
+ u64 data_len;
+
+ Window window;
+ bool quit;
+
+ u64 frame;
+ f32 fps_target;
+
+ /* TODO: Move mouse data to input ctx */
+ v2_i32 mouse_pos;
+
+ v2_i32 mousedown;
+ v2_i32 mouseup;
+
+ bool mouse_lclick;
+ bool mouse_rclick;
+
+ i32 camera_x;
+ i32 camera_y;
+
+ /* Text input/editing is currently not used/implemented */
+ char* edit_text;
+ usize edit_pos;
+
+ memory* mem;
+
+ /* The ctrl is probably the only sensible thing in this struct. */
+ i_ctx** bindings;
+ usize bindings_sz;
+ usize bindings_len;
+
+ struct RenderObject *testobject;
+
+ binding_t bindings_global[NUM_GLOBAL_BINDINGS];
+} Platform;
+
+#endif
diff --git a/src/core/include/engine/engine.h b/src/core/include/engine/engine.h
index 1715f8a..ec685f5 100644
--- a/src/core/include/engine/engine.h
+++ b/src/core/include/engine/engine.h
@@ -3,8 +3,9 @@
#include <stdbool.h>
-// TODO: Cleanup the includes, ideally this header file should only include all
-// "public-facing" headers.
+/* TODO: Cleanup the includes, ideally this header file should only include all
+ * "public-facing" headers.
+ */
#include <engine/core/types.h>
#include <engine/core/logging.h>
@@ -21,44 +22,7 @@ typedef struct {
} RenderUnit;
#include <engine/rendering/window.h>
-
-#define NUM_GLOBAL_BINDINGS 1
-typedef struct {
- void* data; /* Contains textures and such */
- u64 data_len;
-
- Window window;
- bool quit;
-
- u64 frame;
- f32 fps_target;
-
- /* TODO: Move mouse data to input ctx */
- v2_i32 mouse_pos;
-
- v2_i32 mousedown;
- v2_i32 mouseup;
-
- bool mouse_lclick;
- bool mouse_rclick;
-
- i32 camera_x;
- i32 camera_y;
-
- /* Text input/editing is currently not used/implemented */
- char* edit_text;
- usize edit_pos;
-
- memory* mem;
-
- i_ctx** bindings;
- usize bindings_sz;
- usize bindings_len;
-
- struct RenderObject *testobject;
-
- binding_t bindings_global[NUM_GLOBAL_BINDINGS];
-} Platform;
+#include <engine/core/platform.h>
/* Essential functions */
Platform* engine_init(const char* windowtitle, i32 windowWidth, i32 windowHeight,
@@ -77,23 +41,11 @@ void render_set_zoom(f32 new_zoom);
void render_adjust_zoom(f32 diff);
void render_add_unit(RenderUnit* u);
-f64 get_time(void);
-//v2_i32 get_windowsize(void);
-v2_i32* get_mousepos(void);
/* Input handling */
void engine_input_ctx_push(i_ctx* ctx);
void engine_input_ctx_pop(void);
void engine_input_ctx_reset(void);
+v2_i32* get_mousepos(void);
-//#include <engine/rendering/rendering.h>
-
-//#ifdef ENGINE_INTERNALS
-//
-//#include <glad/gl.h>
-//#define GLFW_INCLUDE_NONE
-//#include <GLFW/glfw3.h>
-//
-//
-//#endif
#endif