aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriamcheeseman <[hidden email]>2026-01-13 18:48:25 -0500
committeriamcheeseman <[hidden email]>2026-01-13 18:48:25 -0500
commite5319f53de9f5f8ba4cb67e1302ebc3d7036135c (patch)
treec01e68da91af7b46b573a9c4849a4ec270c26e01
parentafb58a61abd0e8114a090ab0ad664d59c10dd4b1 (diff)
force raylib logging to look my other logging frfr
-rw-r--r--odinfmt.json8
-rwxr-xr-xrun.sh1
-rwxr-xr-xsrc.binbin0 -> 5429024 bytes
-rw-r--r--src/assets.odin62
-rw-r--r--src/entity_list.odin2
-rw-r--r--src/main.odin71
6 files changed, 43 insertions, 101 deletions
diff --git a/odinfmt.json b/odinfmt.json
deleted file mode 100644
index 29d711c..0000000
--- a/odinfmt.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "spaces": 2,
- "tabs": false,
- "character_width": 80,
- "sort_imports": true,
- "align_struct_fields": false,
- "align_struct_values": false
-}
diff --git a/run.sh b/run.sh
index d2a2694..d54b1d0 100755
--- a/run.sh
+++ b/run.sh
@@ -1,3 +1,2 @@
odin run ./tools/compile_assets -- res src/assets.odin &&
-odinfmt src -w
odin run src -disallow-do $1
diff --git a/src.bin b/src.bin
new file mode 100755
index 0000000..45f482a
--- /dev/null
+++ b/src.bin
Binary files differ
diff --git a/src/assets.odin b/src/assets.odin
index 965fdc4..f4ffc00 100644
--- a/src/assets.odin
+++ b/src/assets.odin
@@ -2,15 +2,15 @@
package demonchime
// DO NOT EDIT
-//
+//
// This file is autogenerated by tools/compile_assets
// All resource types are defined in 'src/resources.odin'.
import rl "vendor:raylib"
Image_Id :: enum {
- TILESETS,
PLAYER,
+ TILESETS,
}
Animation_Id :: enum {
@@ -19,8 +19,8 @@ Animation_Id :: enum {
}
Room_Id :: enum {
- ROOM_BEGIN,
ROOM_BEGIN_1,
+ ROOM_BEGIN,
}
Tileset_Id :: enum {
@@ -35,59 +35,20 @@ Resource_Id :: union {
}
images: [Image_Id]Image_Resource = {
+ .PLAYER = {data = #load("../.compiled-res/player-sheet.qoi"), anim = .PLAYER},
.TILESETS = {data = #load("../.compiled-res/tilesets.qoi"), anim = .NONE},
- .PLAYER = {
- data = #load("../.compiled-res/player-sheet.qoi"),
- anim = .PLAYER,
- },
}
animations: [Animation_Id]Animation_Resource = {
- .PLAYER = {
- frame_count = 23,
- frame_durations = {
- 100,
- 100,
- 100,
- 100,
- 100,
- 100,
- 75,
- 75,
- 75,
- 75,
- 75,
- 75,
- 75,
- 75,
- 100,
- 100,
- 100,
- 100,
- 100,
- 100,
- 100,
- 100,
- 100,
- },
- tags = {
- "jump_trans" = {from = 16, to = 16},
- "sleep" = {from = 19, to = 22},
- "run" = {from = 6, to = 13},
- "idle" = {from = 0, to = 5},
- "jump_up" = {from = 14, to = 15},
- "jump_down" = {from = 17, to = 18},
- },
- },
- .NONE = {frame_count = 1, frame_durations = {100}, tags = {}},
+ .PLAYER = {frame_count = 23, frame_durations = {100, 100, 100, 100, 100, 100, 75, 75, 75, 75, 75, 75, 75, 75, 100, 100, 100, 100, 100, 100, 100, 100, 100}, tags = {"jump_up"={from = 14, to = 15}, "run"={from = 6, to = 13}, "jump_trans"={from = 16, to = 16}, "jump_down"={from = 17, to = 18}, "idle"={from = 0, to = 5}, "sleep"={from = 19, to = 22}}},
+ .NONE = {frame_count=1, frame_durations={100}, tags={}},
}
-
//odinfmt: disable
rooms: [Room_Id]Room_Resource = {
- .ROOM_BEGIN = {width=30, height=20, tile_width=16, tile_height=16, layers={{40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 27, 31, 31, 19, 19, 28, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 21, 31, 31, 31, 11, 0, 0, 0, 0, 7, 40, 40, 40, 40, 40, 40, 40, 40, 27, 31, 19, 31, 19, 19, 19, 31, 19, 31, 19, 19, 17, 0, 0, 0, 0, 0, 0, 0, 0, 7, 40, 40, 40, 40, 21, 31, 31, 31, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 40, 40, 21, 19, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 21, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 32, 0, 0, 0, 0, 0, 0, 5, 9, 20, 9, 20, 20, 20, 18, 20, 20, 18, 18, 9, 18, 9, 18, 6, 0, 0, 0, 0, 0, 7, 32, 0, 0, 0, 0, 0, 0, 7, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 8, 0, 0, 0, 0, 0, 7, 11, 0, 0, 0, 0, 0, 0, 7, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 38, 9, 9, 18, 18, 9, 39, 0, 0, 0, 5, 9, 20, 9, 44, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 0, 0, 0, 7, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 20, 9, 18, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40}}, objects={}, background_image=nil},
.ROOM_BEGIN_1 = {width=30, height=20, tile_width=16, tile_height=16, layers={{40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 21, 19, 19, 19, 19, 31, 31, 28, 40, 40, 40, 40, 40, 40, 40, 27, 31, 19, 31, 31, 31, 19, 19, 31, 31, 31, 31, 19, 19, 19, 17, 0, 0, 0, 0, 0, 0, 10, 28, 40, 40, 21, 19, 31, 31, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 40, 21, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 9, 20, 20, 20, 18, 18, 18, 20, 8, 0, 0, 0, 0, 0, 0, 5, 18, 9, 9, 20, 20, 20, 18, 9, 18, 9, 18, 18, 9, 39, 40, 40, 40, 40, 40, 40, 40, 40, 43, 20, 20, 9, 20, 9, 9, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40}}, objects={}, background_image=nil},
+ .ROOM_BEGIN = {width=30, height=20, tile_width=16, tile_height=16, layers={{40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 27, 31, 31, 19, 19, 28, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 21, 31, 31, 31, 11, 0, 0, 0, 0, 7, 40, 40, 40, 40, 40, 40, 40, 40, 27, 31, 19, 31, 19, 19, 19, 31, 19, 31, 19, 19, 17, 0, 0, 0, 0, 0, 0, 0, 0, 7, 40, 40, 40, 40, 21, 31, 31, 31, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 40, 40, 21, 19, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 21, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 32, 0, 0, 0, 0, 0, 0, 5, 9, 20, 9, 20, 20, 20, 18, 20, 20, 18, 18, 9, 18, 9, 18, 6, 0, 0, 0, 0, 0, 7, 32, 0, 0, 0, 0, 0, 0, 7, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 8, 0, 0, 0, 0, 0, 7, 11, 0, 0, 0, 0, 0, 0, 7, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 38, 9, 9, 18, 18, 9, 39, 0, 0, 0, 5, 9, 20, 9, 44, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 0, 0, 0, 7, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 20, 9, 18, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40}}, objects={}, background_image=nil},
}
tilesets: [Tileset_Id]Tileset_Resource = {
@@ -144,16 +105,17 @@ tiles: []Tile_Resource = {
//odinfmt: enable
world: []Room_Position_Resource = {
- {id = .ROOM_BEGIN_1, x = -528, y = -64, width = 480, height = 320},
- {id = .ROOM_BEGIN, x = -48, y = -64, width = 480, height = 320},
+ {id=.ROOM_BEGIN_1, x=-528, y=-64, width=480, height=320},
+ {id=.ROOM_BEGIN, x=-48, y=-64, width=480, height=320},
}
path_to_id: map[string]Resource_Id = {
- "res/img/player.ase" = Image_Id.PLAYER,
+ "res/img/player.ase" = Image_Id.PLAYER,
"res/img/tilesets.png" = Image_Id.TILESETS,
- "res/room_begin.tmj" = Room_Id.ROOM_BEGIN,
+ "res/room_begin.tmj" = Room_Id.ROOM_BEGIN,
"res/room_begin_1.tmj" = Room_Id.ROOM_BEGIN_1,
}
load_resources :: proc() {
}
+
diff --git a/src/entity_list.odin b/src/entity_list.odin
index 633a553..ce69be8 100644
--- a/src/entity_list.odin
+++ b/src/entity_list.odin
@@ -61,7 +61,7 @@ active_entity_count :: proc(list: Entity_List($T)) -> int {
Entity_List_Iter :: struct($T: typeid) {
list: Entity_List(T),
- idx: int,
+ idx: int,
}
iter_entity_list :: proc(list: Entity_List($T)) -> Entity_List_Iter(T) {
diff --git a/src/main.odin b/src/main.odin
index 88e4173..0ce4fac 100644
--- a/src/main.odin
+++ b/src/main.odin
@@ -1,11 +1,9 @@
package demonchime
-// import "core:math"
-// import "core:math/rand"
-// import "core:time"
-
import "base:runtime"
+import "core:c"
+import "core:c/libc"
import "core:fmt"
import "core:log"
import "core:mem"
@@ -15,7 +13,6 @@ import rl "vendor:raylib"
import "draw"
import "phys"
-// import "tiled"
Vec2 :: [2]f32
@@ -31,30 +28,32 @@ state: struct {
logger: log.Logger
-// raylib_log :: proc "c" (
-// msg_type: rl.TraceLogLevel,
-// fmt: cstring,
-// args: ^c.va_list,
-// ) {
-// context = runtime.default_context()
-// context.logger = logger
-//
-// fmt_len := libc.vsnprintf(nil, 0, fmt, args)
-//
-// msg_bytes := make([]u8, fmt_len + 1, allocator = context.temp_allocator)
-// log.info(len(msg_bytes), raw_data(msg_bytes))
-// log.info(libc.vsnprintf(raw_data(msg_bytes), len(msg_bytes), fmt, args))
-//
-// msg := string(msg_bytes)
-//
-// #partial switch msg_type {
-// case .DEBUG: log.debug(msg)
-// case .INFO: log.info(msg)
-// case .WARNING: log.warn(msg)
-// case .ERROR: log.error(msg)
-// case .FATAL: log.fatal(msg)
-// }
-// }
+raylib_log :: proc "c" (
+ msg_type: rl.TraceLogLevel,
+ fmt: cstring,
+ args: ^c.va_list,
+) {
+ context = runtime.default_context()
+ context.logger = logger
+
+ msg_bytes: [1028]u8
+ libc.vsnprintf(raw_data(msg_bytes[:]), 1028, fmt, args)
+
+ msg := string(msg_bytes[:])
+
+ #partial switch msg_type {
+ case .DEBUG:
+ log.debug(msg)
+ case .INFO:
+ log.info(msg)
+ case .WARNING:
+ log.warn(msg)
+ case .ERROR:
+ log.error(msg)
+ case .FATAL:
+ log.fatal(msg)
+ }
+}
die :: proc(msg: string, args: ..any, #any_int exit_code := 1) {
log.fatalf(msg, args)
@@ -63,7 +62,6 @@ die :: proc(msg: string, args: ..any, #any_int exit_code := 1) {
init :: proc() {
state.camera.zoom = 1
- // state.camera.offset = {draw.SCREEN_WIDTH/2, draw.SCREEN_HEIGHT/2}
init_keybinds()
@@ -71,12 +69,6 @@ init :: proc() {
init_player()
- // room, err := tiled.load_map("res/room_begin.tmj")
- // if err != .NONE {
- // log.errorf("Error loading map (%v)", err)
- // }
- // state.room = room
-
open_room(.ROOM_BEGIN)
setup_map_collisions()
@@ -145,7 +137,7 @@ main :: proc() {
context.logger = logger
defer log.destroy_console_logger(logger)
- // rl.SetTraceLogCallback(raylib_log)
+ rl.SetTraceLogCallback(raylib_log)
rl.InitWindow(480 * 2, 360 * 2, "Demonchime")
@@ -154,13 +146,10 @@ main :: proc() {
init()
for !rl.WindowShouldClose() {
- // pbody := phys.get_body(player.body_handle)
- // state.camera.target = {pbody.pos.x, pbody.pos.y}
-
frame()
-
free_all(context.temp_allocator)
}
cleanup()
}
+