From: Brendan Hansen Date: Thu, 3 Mar 2022 16:40:14 +0000 (-0600) Subject: commiting before changes X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=274c226a6fa5d73a53a7678cb60b8f884fafcbef;p=voxel-shooter.git commiting before changes --- diff --git a/src/build.onyx b/src/build.onyx index 137d631..daea60c 100644 --- a/src/build.onyx +++ b/src/build.onyx @@ -10,25 +10,10 @@ #load "config" #load "main" -#load "gfx/canvas" -#load "gfx/font" -#load "gfx/immediate" -#load "gfx/mesh" -#load "gfx/shader" -#load "gfx/texture" -#load "gfx/ui" - -#load "utils/camera" -#load "utils/input" -#load "utils/logger" -#load "utils/utils" -#load "utils/vecmath" - -#load "world/chunk" -#load "world/physics" -#load "world/player" -#load "world/world" -#load "world/worldgen" +#load_all "./gfx" +#load_all "./net" +#load_all "./utils" +#load_all "./world" // Onyx library code #load "stb_truetype" diff --git a/src/utils/logger.onyx b/src/utils/logger.onyx index 529ddee..4947e53 100644 --- a/src/utils/logger.onyx +++ b/src/utils/logger.onyx @@ -12,24 +12,32 @@ Log_Level :: enum { Critical; } +debug_set_level :: (level: Log_Level) { + log_level = level; +} + debug_log :: (level: Log_Level, format: str, args: ..any) { debug_log_va(level, format, ~~args); } debug_log_va :: (level: Log_Level, format: str, args: [] any) { + if level < log_level do return; + buf: [2048] u8; output := conv.format_va(buf, format, args); - printf("[{}] {}\n", level_string(level), output); + printf("[{w5}] {}\n", level_string(level), output); } #local level_string :: (level: Log_Level) => { switch level { case .Debug do return "DEBUG"; - case .Info do return "INFO "; - case .Warning do return "WARN "; + case .Info do return "INFO"; + case .Warning do return "WARN"; case .Error do return "ERROR"; - case .Critical do return "CRIT "; + case .Critical do return "CRIT"; } - return " "; + return ""; } + +#local log_level := Log_Level.Debug; \ No newline at end of file diff --git a/src/utils/vecmath.onyx b/src/utils/vecmath.onyx index eb6f639..6092a13 100644 --- a/src/utils/vecmath.onyx +++ b/src/utils/vecmath.onyx @@ -1,12 +1,15 @@ -Vector2 :: struct [conv.Custom_Format.{format_vector2}] { +Vector2 :: struct { + #struct_tag conv.Custom_Format.{format_vector2} x, y: f32; } -Vector3i :: struct [conv.Custom_Format.{format_vector3i}] { +Vector3i :: struct { + #struct_tag conv.Custom_Format.{format_vector3i} x, y, z: i32; } -Vector3 :: struct [conv.Custom_Format.{format_vector3}] { +Vector3 :: struct { + #struct_tag conv.Custom_Format.{format_vector3} x, y, z: f32; mag :: macro (v: Vector3) => math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z);