command: wip added command type for camera movement
authorLukas Krickl <lukas@krickl.dev>
Sat, 28 Feb 2026 06:59:16 +0000 (07:59 +0100)
committerLukas Krickl <lukas@krickl.dev>
Sat, 28 Feb 2026 06:59:16 +0000 (07:59 +0100)
STYLE.md
src/lrts_impl.h
src/t_command.c [new file with mode: 0644]
src/t_command.h

index 98926a30beaaf534246342593429a8c39c91a740..2b3ea2623eb7f7dee9a80e313c951bb968d767c4 100644 (file)
--- a/STYLE.md
+++ b/STYLE.md
@@ -34,6 +34,14 @@ Similar to modules platforms contain a concrete implemntation for specific modul
 Platforms are contained in specific directories which start with `p_`. 
 Usually platforms contain no additional header files.
 
+## Portability
+
+The codebase should be as portable as possible.
+To achive this the following restrictions are in place:
+- Software rendering only
+- No fpu use in core code
+- Prefer 32 bit integers
+
 Currently supported platforms are:
 
 - p_pc: generic PC implementation of functionality using the C stdlib
@@ -59,6 +67,7 @@ These are allowed even in core code.
 - stdarg.h: for va_list va_start and va_end
 - assert.h: for debug build asserts
 
+
 ## Vendoring
 
 All 3rd party libraries should be forked and included as a submodule.
index 9fccfc2c381bd107a6111b78b9aeff0312a9947d..f73c08fcad7ff242a8a440d3117f9f78dbdcaf29 100644 (file)
@@ -36,7 +36,7 @@
 #include "p_r_cli/p_init.c"
 #endif
 
-
+#include "t_command.c"
 #include "t_unit.c"
 #include "u_rand.c"
 #include "n_conn.c"
diff --git a/src/t_command.c b/src/t_command.c
new file mode 100644 (file)
index 0000000..832bff3
--- /dev/null
@@ -0,0 +1,7 @@
+#include "t_command.h"
+
+
+lrts_bool t_command_exec(struct t_command *c) {
+       LRTS_UNUSED(c);
+       return LRTS_TRUE;
+}
index c059cf147da3b52f5e7971058ef9bb6d3d9c3be1..9dadc5eb4a88cae42748d563b38b9c162fb2afec 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef T_COMMAND_H__
 #define T_COMMAND_H__
 
+#include "u_defs.h"
+
 /**
  * A command is an order for a unit.
  * each unit has a command queue.
 #define T_COMMANDS_MAX 8
 
 enum t_command_type {
-       T_COMMAND_NONE = 0
+       T_COMMAND_NONE = 0,
+       /* moves camera in the direction of a 
+        * provided vector
+        */
+       T_COMMAND_MOVE_CAMERA
 };
 
 enum t_command_flags {
        T_COMMAND_F_NONE = 0
 };
 
+union t_command_data {
+       struct u_vec2 move_camera;
+};
+
 struct t_command {
        enum t_command_type type;       
        enum t_command_flags flags;
+       union t_command_data d;
 };
 
 /**
@@ -30,4 +41,7 @@ struct t_command_queue {
        struct t_command buffer[T_COMMANDS_MAX];
 };
 
+/* executes a command. Returns true if command was executed. */
+lrts_bool t_command_exec(struct t_command *c);
+
 #endif