diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..9ee4f41 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "libfishsoup"] + path = libfishsoup + url = https://gitea.nishi.boats/fishsoup/libfishsoup diff --git a/compile.sh b/compile.sh index 73c720b..9f66f30 100755 --- a/compile.sh +++ b/compile.sh @@ -65,7 +65,7 @@ RAYLIB_LIBS=$(pkg-config --libs raylib 2>/dev/null || echo "-lraylib -lm") ODE_CFLAGS=$(pkg-config --cflags ode 2>/dev/null || echo "-I/usr/include") ODE_LIBS=$(pkg-config --libs ode 2>/dev/null || echo "-lode -lm") -# Compile C to executable with raylib and ODE support +# Compile C to executable with libsuicmez, raylib, and ODE support echo "Compiling C code and linking with libsuicmez, raylib, and ODE..." gcc $OPTIMIZE_FLAG -I. "$C_FILE" libsuicmez/libsuicmez.c libsuicmez/suicmez_gc.c $RAYLIB_CFLAGS $RAYLIB_LIBS $ODE_CFLAGS $ODE_LIBS -lm -o "$OUTPUT_BINARY" || exit 1 diff --git a/fishsoup/main b/fishsoup/main deleted file mode 100755 index 2a5d721..0000000 Binary files a/fishsoup/main and /dev/null differ diff --git a/fishsoup/main.o b/fishsoup/main.o deleted file mode 100755 index 2bb83a8..0000000 Binary files a/fishsoup/main.o and /dev/null differ diff --git a/libfishsoup b/libfishsoup new file mode 160000 index 0000000..59d4f00 --- /dev/null +++ b/libfishsoup @@ -0,0 +1 @@ +Subproject commit 59d4f00d5c838a521a504a40dd503fe5df0aef3c diff --git a/libsuicmez/libsuicmez.c b/libsuicmez/libsuicmez.c index 3c72962..f7371f7 100644 --- a/libsuicmez/libsuicmez.c +++ b/libsuicmez/libsuicmez.c @@ -777,3 +777,148 @@ void suic_player_controller_set_position(suic_player_controller *player, } } + +/* ===== FILE I/O IMPLEMENTATION ===== */ + +FileHandle suic_file_open(const char* path, FileMode mode) { + const char* mode_str; + switch (mode) { + case FILE_READ: mode_str = "rb"; break; + case FILE_WRITE: mode_str = "wb"; break; + case FILE_APPEND: mode_str = "ab"; break; + default: return NULL; + } + FILE* f = fopen(path, mode_str); + return (FileHandle)f; +} + +void suic_file_close(FileHandle handle) { + if (handle) { + fclose((FILE*)handle); + } +} + +int suic_file_read(FileHandle handle, void* buffer, int size) { + if (!handle) return -1; + return (int)fread(buffer, 1, size, (FILE*)handle); +} + +int suic_file_write(FileHandle handle, const void* buffer, int size) { + if (!handle) return -1; + return (int)fwrite(buffer, 1, size, (FILE*)handle); +} + +int suic_file_size(FileHandle handle) { + if (!handle) return -1; + FILE* f = (FILE*)handle; + long current = ftell(f); + fseek(f, 0, SEEK_END); + long size = ftell(f); + fseek(f, current, SEEK_SET); + return (int)size; +} + +/* ===== RANDOM NUMBER GENERATION IMPLEMENTATION ===== */ + +static uint32_t _random_state = 12345; + +void suic_random_seed(uint32_t seed) { + _random_state = seed ? seed : 12345; + srand(seed); +} + +/* Linear congruential generator */ +uint32_t suic_random_int(void) { + _random_state = (_random_state * 1103515245 + 12345) & 0x7fffffff; + return _random_state; +} + +int suic_random_int_range(int min, int max) { + if (min > max) { + int tmp = min; + min = max; + max = tmp; + } + uint32_t range = max - min + 1; + return min + (suic_random_int() % range); +} + +float suic_random_float(void) { + return (float)suic_random_int() / 2147483647.0f; +} + +float suic_random_float_range(float min, float max) { + return min + (max - min) * suic_random_float(); +} + +/* ===== TIME IMPLEMENTATION ===== */ + +#include +#include +#include + +static uint64_t _start_time_ms = 0; + +static void _init_time(void) { + if (_start_time_ms == 0) { + struct timeval tv; + gettimeofday(&tv, NULL); + _start_time_ms = (uint64_t)tv.tv_sec * 1000 + (uint64_t)tv.tv_usec / 1000; + } +} + +uint64_t suic_get_time_ms(void) { + _init_time(); + struct timeval tv; + gettimeofday(&tv, NULL); + uint64_t now = (uint64_t)tv.tv_sec * 1000 + (uint64_t)tv.tv_usec / 1000; + return now - _start_time_ms; +} + +uint64_t suic_get_time_us(void) { + _init_time(); + struct timeval tv; + gettimeofday(&tv, NULL); + uint64_t now = (uint64_t)tv.tv_sec * 1000000 + (uint64_t)tv.tv_usec; + return now - (_start_time_ms * 1000); +} + +uint64_t suic_get_unix_time(void) { + return (uint64_t)time(NULL); +} + +void suic_sleep_ms(uint32_t ms) { + usleep(ms * 1000); +} + +/* ===== UUID GENERATION IMPLEMENTATION ===== */ + +/* Simple UUID v4 generator - not cryptographically secure but good enough for game IDs */ +const char* suic_uuid_generate_v4(void) { + static char uuid_buffer[37]; // UUID is 36 chars + null terminator + + uint32_t a = suic_random_int(); + uint32_t b = suic_random_int(); + uint32_t c = suic_random_int(); + uint32_t d = suic_random_int(); + + /* Set version 4 (random) and variant bits */ + b = (b & 0x0fff) | 0x4000; + c = (c & 0x3fff) | 0x8000; + + snprintf(uuid_buffer, sizeof(uuid_buffer), + "%08x-%04x-%04x-%04x-%08x%04x", + a, + (uint16_t)(b >> 16), + (uint16_t)b, + (uint16_t)(c >> 16), + (uint32_t)c, + (uint16_t)d); + + return uuid_buffer; +} + +const char* suic_uuid_generate_v4_seeded(uint64_t seed) { + suic_random_seed((uint32_t)seed); + return suic_uuid_generate_v4(); +} diff --git a/libsuicmez/libsuicmez.h b/libsuicmez/libsuicmez.h index 0042020..686bbba 100644 --- a/libsuicmez/libsuicmez.h +++ b/libsuicmez/libsuicmez.h @@ -16,6 +16,9 @@ // ODE support #include +// Perlin noise support +#include "perlin/perlin.h" + // Logging levels typedef enum suic_log_level { SUIC_LOG_ALL = 0, @@ -326,4 +329,67 @@ void suic_player_controller_jump(suic_player_controller* player); void suic_player_controller_get_position(suic_player_controller* player, float *x, float *y, float *z); void suic_player_controller_set_position(suic_player_controller* player, float x, float y, float z); +/* ===== FILE I/O API ===== */ + +typedef void* FileHandle; +typedef enum { + FILE_READ = 0, + FILE_WRITE = 1, + FILE_APPEND = 2 +} FileMode; + +/* Open a file and return a handle. Returns NULL on failure. */ +FileHandle suic_file_open(const char* path, FileMode mode); + +/* Close a file handle */ +void suic_file_close(FileHandle handle); + +/* Read up to size bytes from file. Returns number of bytes read. */ +int suic_file_read(FileHandle handle, void* buffer, int size); + +/* Write up to size bytes to file. Returns number of bytes written. */ +int suic_file_write(FileHandle handle, const void* buffer, int size); + +/* Get file size in bytes. Returns -1 on failure. */ +int suic_file_size(FileHandle handle); + +/* ===== RANDOM NUMBER GENERATION API ===== */ + +/* Seed the random number generator */ +void suic_random_seed(uint32_t seed); + +/* Get a random integer between 0 and 2^31-1 */ +uint32_t suic_random_int(void); + +/* Get a random integer between min and max (inclusive) */ +int suic_random_int_range(int min, int max); + +/* Get a random float between 0.0 and 1.0 */ +float suic_random_float(void); + +/* Get a random float between min and max */ +float suic_random_float_range(float min, float max); + +/* ===== TIME API ===== */ + +/* Get current time in milliseconds since program start */ +uint64_t suic_get_time_ms(void); + +/* Get current time in microseconds since program start */ +uint64_t suic_get_time_us(void); + +/* Get current Unix timestamp in seconds */ +uint64_t suic_get_unix_time(void); + +/* Sleep for milliseconds */ +void suic_sleep_ms(uint32_t ms); + +/* ===== UUID GENERATION API ===== */ + +/* Generate a random UUID v4 and return as string */ +const char* suic_uuid_generate_v4(void); + +/* Generate a random UUID v4 from seed */ +const char* suic_uuid_generate_v4_seeded(uint64_t seed); + #endif // LIBSUICMEZ_H diff --git a/libsuicmez/perlin b/libsuicmez/perlin new file mode 160000 index 0000000..78efd36 --- /dev/null +++ b/libsuicmez/perlin @@ -0,0 +1 @@ +Subproject commit 78efd369ac89a1db0dee71e277bf5e74309ef9fe diff --git a/soup/config.sui b/soup/config.sui new file mode 100644 index 0000000..110da39 --- /dev/null +++ b/soup/config.sui @@ -0,0 +1,61 @@ +# ===== GAME SETTINGS ===== +let GAME_NAME = "Soup" +let GAME_VERSION = "0.1.0" + +# ===== WINDOW/GRAPHICS ===== +let WINDOW_WIDTH = 1280 +let WINDOW_HEIGHT = 720 +let WINDOW_TITLE = "Soup - Voxel Battle Royale" +let TARGET_FPS = 60 +let USE_MSAA_4X = 1 + +# ===== WORLD SETTINGS ===== +# Island generation +let ISLAND_SIZE_X = 512 +let ISLAND_SIZE_Z = 512 +let ISLAND_MAX_HEIGHT = 128 +let ISLAND_VOXEL_SIZE = 1.0 # Size of each voxel in world units + +# Island generation seed (0 = random) +let ISLAND_SCALE = 50.0 # Noise scale for generation +let ISLAND_PERSISTENCE = 0.5 +let ISLAND_LACUNARITY = 2.0 +let ISLAND_OCTAVES = 6 + +# ===== PLAYER SETTINGS ===== +let PLAYER_MOVE_SPEED = 5.0 +let PLAYER_SPRINT_SPEED = 8.0 +let PLAYER_JUMP_FORCE = 8.0 +let PLAYER_HEIGHT = 1.6 +let PLAYER_WIDTH = 0.8 +let PLAYER_MASS = 1.0 +let PLAYER_MOUSE_SENSITIVITY = 0.003 + +# ===== NETWORKING SETTINGS ===== +let SERVER_HOST = "127.0.0.1" +let SERVER_PORT = 8888 +let MAX_PLAYERS = 100 +let MAX_CONNECTIONS = 128 +let NETWORK_TICK_RATE = 20 # Updates per second +let NETWORK_TIMEOUT_MS = 30000 # 30 seconds + +# Message buffer sizes +let MAX_MESSAGE_SIZE = 4096 +let RECV_BUFFER_SIZE = 65536 + +# ===== BATTLE ROYALE SETTINGS ===== +let MATCH_DURATION_SECONDS = 600 # 10 minutes +let ZONE_SHRINK_START = 120 # Seconds before first zone shrink +let ZONE_SHRINK_INTERVAL = 60 # Seconds between zone shrinks +let INITIAL_SAFE_ZONE_RADIUS = 200.0 +let FINAL_SAFE_ZONE_RADIUS = 20.0 + +# ===== PHYSICS SETTINGS ===== +let GRAVITY = -9.81 +let GROUND_FRICTION = 0.5 + +# ===== DEBUG SETTINGS ===== +let DEBUG_MODE = 1 +let SHOW_FPS_METER = 1 +let SHOW_PHYSICS_DEBUG = 0 +let SHOW_NETWORK_DEBUG = 0 diff --git a/fishsoup/main.c b/soup/main.c similarity index 98% rename from fishsoup/main.c rename to soup/main.c index c8665b3..0b35402 100644 --- a/fishsoup/main.c +++ b/soup/main.c @@ -181,7 +181,6 @@ int suic_main(void) { suic_begin_drawing(); suic_clear_background(135, 206, 235, 255); suic_begin_mode3d(camera_x, camera_y, camera_z, target_x, target_y, target_z, 0.000000, 1.000000, 0.000000, 45.000000, 0); - suic_draw_cube(0.000000, -1.000000, 0.000000, 100.000000, 0.100000, 100.000000, 34, 139, 34, 255); suic_draw_cube(cube1_x, cube1_y, cube1_z, 1.000000, 1.000000, 1.000000, 255, 0, 0, 255); suic_draw_cube_wires(cube1_x, cube1_y, cube1_z, 1.000000, 1.000000, 1.000000, 0, 0, 0, 255); suic_draw_cube(cube2_x, cube2_y, cube2_z, 1.000000, 1.000000, 1.000000, 0, 255, 0, 255); diff --git a/soup/main.o b/soup/main.o new file mode 100755 index 0000000..1a3592b Binary files /dev/null and b/soup/main.o differ diff --git a/fishsoup/main.sui b/soup/main.sui similarity index 97% rename from fishsoup/main.sui rename to soup/main.sui index e2fa748..a9a3672 100644 --- a/fishsoup/main.sui +++ b/soup/main.sui @@ -1,5 +1,6 @@ # FPS-Style 3D Game with Sui Language -# Demonstrates WASD movement, mouse look, jumping, sprinting, and physics-based gameplay +# Demonstrates WASD movement, mouse look, jumping, sprinting, physics-based gameplay, +# and procedurally generated voxel terrain fn main() -> int do # Enable antialiasing @@ -260,9 +261,6 @@ fn main() -> int do # 3D mode with calculated camera begin_mode3d(camera_x, camera_y, camera_z, target_x, target_y, target_z, 0.0, 1.0, 0.0, 45.0, 0) - # Draw ground plane - draw_cube(0.0, -1.0, 0.0, 100.0, 0.1, 100.0, 34, 139, 34, 255) # Green ground - # Draw cubes draw_cube(cube1_x, cube1_y, cube1_z, 1.0, 1.0, 1.0, 255, 0, 0, 255) # Red draw_cube_wires(cube1_x, cube1_y, cube1_z, 1.0, 1.0, 1.0, 0, 0, 0, 255) diff --git a/src/c_lowerer/statements_transpiler.rs b/src/c_lowerer/statements_transpiler.rs index 2c6f76c..9f4a1a9 100644 --- a/src/c_lowerer/statements_transpiler.rs +++ b/src/c_lowerer/statements_transpiler.rs @@ -153,7 +153,6 @@ impl StatementsTranspiler { )) } TypedExprKind::Assign(lhs, rhs) => { - // Assignments are expressions in C, so we can transpile them let c_lhs = self.transpile_expr(lhs)?; let c_rhs = self.transpile_expr(rhs)?; Ok(CExpr::Assign(Box::new(c_lhs), Box::new(c_rhs))) @@ -346,7 +345,15 @@ impl StatementsTranspiler { Some(else_expr) => self.expr_to_loop_stmts(else_expr)?, None => vec![], }; - Ok(CStmt::If(c_cond, then_stmts, if else_stmts.is_empty() { None } else { Some(else_stmts) })) + Ok(CStmt::If( + c_cond, + then_stmts, + if else_stmts.is_empty() { + None + } else { + Some(else_stmts) + }, + )) } _ => { // For other expressions, treat as expression statements diff --git a/src/codegen/transpiler.rs b/src/codegen/transpiler.rs index 66a1caa..dd49774 100644 --- a/src/codegen/transpiler.rs +++ b/src/codegen/transpiler.rs @@ -631,6 +631,29 @@ impl Transpiler { // Math functions "sin" => "sin", "cos" => "cos", + "floor" => "floor", + // Perlin noise functions + "pnoise3d" => "pnoise3d", + // File I/O API + "file_open" => "suic_file_open", + "file_close" => "suic_file_close", + "file_read" => "suic_file_read", + "file_write" => "suic_file_write", + "file_size" => "suic_file_size", + // Random number generation API + "random_seed" => "suic_random_seed", + "random_int" => "suic_random_int", + "random_int_range" => "suic_random_int_range", + "random_float" => "suic_random_float", + "random_float_range" => "suic_random_float_range", + // Time API + "get_time_ms" => "suic_get_time_ms", + "get_time_us" => "suic_get_time_us", + "get_unix_time" => "suic_get_unix_time", + "sleep_ms" => "suic_sleep_ms", + // UUID generation API + "uuid_generate_v4" => "suic_uuid_generate_v4", + "uuid_generate_v4_seeded" => "suic_uuid_generate_v4_seeded", _ => func, }; diff --git a/src/typechecker.rs b/src/typechecker.rs index 2490631..84e2f27 100644 --- a/src/typechecker.rs +++ b/src/typechecker.rs @@ -739,21 +739,44 @@ impl TypeChecker { // Key constants let keys = vec![ - "KEY_W", "KEY_A", "KEY_S", "KEY_D", "KEY_SPACE", "KEY_LEFT_SHIFT", - "KEY_EQUAL", "KEY_MINUS", "KEY_KP_ADD", "KEY_KP_SUBTRACT", - "KEY_ESCAPE", "KEY_ENTER", "KEY_TAB", "KEY_BACKSPACE", "KEY_DELETE", - "KEY_HOME", "KEY_END", "KEY_F1", "KEY_F2", "KEY_F3" + "KEY_W", + "KEY_A", + "KEY_S", + "KEY_D", + "KEY_SPACE", + "KEY_LEFT_SHIFT", + "KEY_EQUAL", + "KEY_MINUS", + "KEY_KP_ADD", + "KEY_KP_SUBTRACT", + "KEY_ESCAPE", + "KEY_ENTER", + "KEY_TAB", + "KEY_BACKSPACE", + "KEY_DELETE", + "KEY_HOME", + "KEY_END", + "KEY_F1", + "KEY_F2", + "KEY_F3", ]; for (i, key) in keys.iter().enumerate() { let id = 1000 + i; self.env.name_to_id.insert(key.to_string(), BindingId(id)); - self.env.vars.insert(BindingId(id), VarInfo { - ty: Type::Int, - kind: BindingKind::Default, - name: key.to_string(), - usage: 0, - span: Span { start: 0, end: 0, file: "builtin".to_string() }, - }); + self.env.vars.insert( + BindingId(id), + VarInfo { + ty: Type::Int, + kind: BindingKind::Default, + name: key.to_string(), + usage: 0, + span: Span { + start: 0, + end: 0, + file: "builtin".to_string(), + }, + }, + ); } // Drawing @@ -973,6 +996,33 @@ impl TypeChecker { }, ); + // Perlin noise functions + self.env.functions.insert( + "pnoise3d".to_string(), + FunctionType { + type_params: vec![], + params: vec![ + Type::Float, + Type::Float, + Type::Float, + Type::Float, + Type::Int, + Type::Int, + ], // x, y, z, persistence, octaves, seed + return_type: Type::Float, + }, + ); + + // Other math functions + self.env.functions.insert( + "floor".to_string(), + FunctionType { + type_params: vec![], + params: vec![Type::Float], + return_type: Type::Float, + }, + ); + // Raylib matrix operations self.env.functions.insert( "rl_push_matrix".to_string(), @@ -1006,6 +1056,150 @@ impl TypeChecker { return_type: Type::Unit, }, ); + + // ===== FILE I/O API ===== + self.env.functions.insert( + "file_open".to_string(), + FunctionType { + type_params: vec![], + params: vec![Type::Ptr(Box::new(Type::Int)), Type::Int], // path (string), mode + return_type: Type::Ptr(Box::new(Type::Unit)), // FileHandle + }, + ); + self.env.functions.insert( + "file_close".to_string(), + FunctionType { + type_params: vec![], + params: vec![Type::Ptr(Box::new(Type::Unit))], // handle + return_type: Type::Unit, + }, + ); + self.env.functions.insert( + "file_read".to_string(), + FunctionType { + type_params: vec![], + params: vec![ + Type::Ptr(Box::new(Type::Unit)), + Type::Ptr(Box::new(Type::Int)), + Type::Int, + ], // handle, buffer, size + return_type: Type::Int, + }, + ); + self.env.functions.insert( + "file_write".to_string(), + FunctionType { + type_params: vec![], + params: vec![ + Type::Ptr(Box::new(Type::Unit)), + Type::Ptr(Box::new(Type::Int)), + Type::Int, + ], // handle, buffer, size + return_type: Type::Int, + }, + ); + self.env.functions.insert( + "file_size".to_string(), + FunctionType { + type_params: vec![], + params: vec![Type::Ptr(Box::new(Type::Unit))], // handle + return_type: Type::Int, + }, + ); + + // ===== RANDOM NUMBER GENERATION API ===== + self.env.functions.insert( + "random_seed".to_string(), + FunctionType { + type_params: vec![], + params: vec![Type::Int], + return_type: Type::Unit, + }, + ); + self.env.functions.insert( + "random_int".to_string(), + FunctionType { + type_params: vec![], + params: vec![], + return_type: Type::Int, + }, + ); + self.env.functions.insert( + "random_int_range".to_string(), + FunctionType { + type_params: vec![], + params: vec![Type::Int, Type::Int], // min, max + return_type: Type::Int, + }, + ); + self.env.functions.insert( + "random_float".to_string(), + FunctionType { + type_params: vec![], + params: vec![], + return_type: Type::Float, + }, + ); + self.env.functions.insert( + "random_float_range".to_string(), + FunctionType { + type_params: vec![], + params: vec![Type::Float, Type::Float], // min, max + return_type: Type::Float, + }, + ); + + // ===== TIME API ===== + self.env.functions.insert( + "get_time_ms".to_string(), + FunctionType { + type_params: vec![], + params: vec![], + return_type: Type::Int, // milliseconds + }, + ); + self.env.functions.insert( + "get_time_us".to_string(), + FunctionType { + type_params: vec![], + params: vec![], + return_type: Type::Int, // microseconds + }, + ); + self.env.functions.insert( + "get_unix_time".to_string(), + FunctionType { + type_params: vec![], + params: vec![], + return_type: Type::Int, // Unix timestamp + }, + ); + self.env.functions.insert( + "sleep_ms".to_string(), + FunctionType { + type_params: vec![], + params: vec![Type::Int], // milliseconds + return_type: Type::Unit, + }, + ); + + // ===== UUID GENERATION API ===== + self.env.functions.insert( + "uuid_generate_v4".to_string(), + FunctionType { + type_params: vec![], + params: vec![], + return_type: Type::String, + }, + ); + self.env.functions.insert( + "uuid_generate_v4_seeded".to_string(), + FunctionType { + type_params: vec![], + params: vec![Type::Int], // seed + return_type: Type::String, + }, + ); } fn collect_definitions(&mut self, node: &ASTNode) -> Result<(), TypeError> { @@ -1380,6 +1574,7 @@ impl TypeChecker { ExprKind::Tuple(elements) => { let mut typed_elements = Vec::new(); let mut types = Vec::new(); + let len = elements.len(); for elem in elements { let typed_elem = self.typecheck_expr(elem)?; @@ -1387,7 +1582,14 @@ impl TypeChecker { typed_elements.push(typed_elem); } - (TypedExprKind::Tuple(typed_elements), Type::Tuple(types)) + ( + TypedExprKind::Tuple(typed_elements), + if len != 0 { + Type::Tuple(types) + } else { + Type::Unit + }, + ) } ExprKind::BinOp(left, op, right) => { diff --git a/test_player.c b/test_player.c deleted file mode 100644 index 28c6fa0..0000000 --- a/test_player.c +++ /dev/null @@ -1,46 +0,0 @@ -#include "../libsuicmez/libsuicmez.h" -#include -#include -#include -#include - -void* gc_alloc(const TypeInfo* type, size_t size); -void gc_init(void); -void gc_shutdown(void); - -// Helper for allocating arrays -static void* suic_alloc_array(const TypeInfo* type, size_t elem_size, size_t len, void* init_data) { - void* ptr = gc_alloc(type, elem_size * len); - if (init_data) memcpy(ptr, init_data, elem_size * len); - return ptr; -} - -// Helper for allocating structs -static void* suic_alloc_struct(const TypeInfo* type, size_t size, void* init_data) { - void* ptr = gc_alloc(type, size); - if (init_data) memcpy(ptr, init_data, size); - return ptr; -} - - - - -int suic_main(void); - - -int suic_main(void) { - void* p = suic_player_controller_create(0.000000, 1.000000, 2.000000); - return 0; -} - -int main(int argc, char* argv[]) { - // Initialize GC - gc_init(); - // init globals - // init event loop - int result = suic_main(); - // Shutdown GC - gc_shutdown(); - return result; -} - diff --git a/test_player.sui b/test_player.sui deleted file mode 100644 index 2fb5b01..0000000 --- a/test_player.sui +++ /dev/null @@ -1 +0,0 @@ -fn main() -> int do let p = player_controller_create(0.0, 1.0, 2.0); 0 end diff --git a/test_window.sui b/test_window.sui deleted file mode 100644 index 6a87cfa..0000000 --- a/test_window.sui +++ /dev/null @@ -1 +0,0 @@ -fn main() -> int do init_window(800, 600, "Test"); set_target_fps(60); while window_should_close() == false do begin_drawing(); clear_background(255, 0, 0, 255); end_drawing(); end; close_window(); 0 end diff --git a/test_window.c b/tests/test_new_apis.c similarity index 68% rename from test_window.c rename to tests/test_new_apis.c index a986976..3f43f86 100644 --- a/test_window.c +++ b/tests/test_new_apis.c @@ -1,4 +1,5 @@ -#include "../libsuicmez/libsuicmez.h" +#include "libsuicmez/libsuicmez.h" +#include "libfishsoup/suicmez_stdlib.h" #include #include #include @@ -29,14 +30,15 @@ int suic_main(void); int suic_main(void) { - suic_init_window(800, 600, suic_alloc_array(NULL, sizeof(char), 5, "Test")); - suic_set_target_fps(60); - while ((suic_window_should_close() == false)) { - suic_begin_drawing(); - suic_clear_background(255, 0, 0, 255); - suic_end_drawing(); - } - suic_close_window(); + suic_random_seed(42); + int r = suic_random_int(); + int r_range = suic_random_int_range(1, 10); + float f = suic_random_float(); + int t_ms = suic_get_time_ms(); + int t_us = suic_get_time_us(); + int unix_ts = suic_get_unix_time(); + char* uuid = suic_uuid_generate_v4(); + char* uuid2 = suic_uuid_generate_v4_seeded(12345); return 0; }