This commit is contained in:
flameyosflow 2025-12-20 11:02:42 +02:00
commit 1006b231f0
9 changed files with 85 additions and 21 deletions

View file

@ -24,5 +24,5 @@ echo "Linking..."
gcc main.o suic_math.o suic_terrain.o suic_lighting.o suic_net.o suic_ui.o suic_game_client.o \
$RAYLIB_LIBS -lm -o game_client
echo "Successfully built: game_client"
echo " Run with: ./game_client"
echo "Successfully built: game_client"
echo "Run with: ./game_client"

Binary file not shown.

View file

@ -1,15 +1,60 @@
#include "suic_app.h"
#include "runtime.h"
#include "libsuicmez/libsuicmez.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
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) {
suic_app_init(1280, 720, "Voxel Shooter - Client");
while (!suic_app_should_close()) {
suic_app_frame_begin();
suic_draw_hello(); // gameplay / UI call
suic_app_frame_end();
suic_init_window(1280, 720, suic_alloc_array(NULL, sizeof(char), 21, "Voxel Shooter Client"));
suic_set_target_fps(120);
suic_disable_cursor();
while ((suic_window_should_close() == false)) {
float dt = suic_get_frame_time();
suic_begin_drawing();
suic_clear_background(135, 206, 235, 255);
DrawFPS(10, 10);
suic_end_drawing();
}
suic_app_shutdown();
suic_close_window();
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;
}

Binary file not shown.

View file

@ -0,0 +1,22 @@
fn main() -> int do
init_window(1280, 720, "Voxel Shooter Client")
defer close_window()
set_target_fps(120)
disable_cursor()
# Main loop
while window_should_close() == false do
let dt = get_frame_time()
# Rendering
begin_drawing()
clear_background(135, 206, 235, 255)
# Draw FPS
draw_fps(10, 10)
end_drawing()
end
0
end

View file

@ -4,9 +4,6 @@
#include <stdbool.h>
#include <string.h>
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) {
@ -22,12 +19,12 @@ static void* suic_alloc_struct(const TypeInfo* type, size_t size, void* init_dat
return ptr;
}
void* gc_alloc(const TypeInfo* type, size_t size);
void gc_init(void);
void gc_shutdown(void);
int suic_main(void);
int suic_main(void) {
char* SERVER_HOST = suic_alloc_array(NULL, sizeof(char), 10, "127.0.0.1");
int SERVER_PORT = 8888;

View file

@ -51,7 +51,7 @@ int suic_main(void);
int suic_main(void) {
int* arr = suic_alloc_array(NULL, sizeof(int), 4, (int[]){1, 2, 3, 4});
int x = arr[0];
int x = arr[2];
return x;
}

Binary file not shown.

View file

@ -2,6 +2,6 @@
fn main() -> int do
let arr = [1, 2, 3, 4];
# let empty = [];
let x = arr[0];
let x = arr[1];
x
end