From 6b126a84c3b332e18e6b7c0a15b286617b5ad4b5 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Sat, 28 Feb 2026 07:59:16 +0100 Subject: [PATCH] command: wip added command type for camera movement --- STYLE.md | 9 +++++++++ src/lrts_impl.h | 2 +- src/t_command.c | 7 +++++++ src/t_command.h | 16 +++++++++++++++- 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 src/t_command.c diff --git a/STYLE.md b/STYLE.md index 98926a3..2b3ea26 100644 --- 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. diff --git a/src/lrts_impl.h b/src/lrts_impl.h index 9fccfc2..f73c08f 100644 --- a/src/lrts_impl.h +++ b/src/lrts_impl.h @@ -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 index 0000000..832bff3 --- /dev/null +++ b/src/t_command.c @@ -0,0 +1,7 @@ +#include "t_command.h" + + +lrts_bool t_command_exec(struct t_command *c) { + LRTS_UNUSED(c); + return LRTS_TRUE; +} diff --git a/src/t_command.h b/src/t_command.h index c059cf1..9dadc5e 100644 --- a/src/t_command.h +++ b/src/t_command.h @@ -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. @@ -9,16 +11,25 @@ #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 -- 2.30.2