commiting before changes
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 3 Mar 2022 16:40:14 +0000 (10:40 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 3 Mar 2022 16:40:14 +0000 (10:40 -0600)
src/build.onyx
src/utils/logger.onyx
src/utils/vecmath.onyx

index 137d6312d0df09491e32d3ec1c93f63d15731c90..daea60c6c07309379b7964c6f2d3dc150ddca01e 100644 (file)
 #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"
index 529ddeef92e37d2515fc79c25aa19af0ef9a7815..4947e53f5ed3a5effe7daff2c4cb9f868a864fec 100644 (file)
@@ -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
index eb6f639a89faaf86a9f5ae3b7e4c923e35ced791..6092a137f068609bdd9db6ef255df6d8776dd4d5 100644 (file)
@@ -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);