This commit is contained in:
2026-03-24 10:23:05 +05:45
parent 739a806493
commit 5bc235f1ab
9 changed files with 335 additions and 303 deletions
+6 -3
View File
@@ -20,6 +20,8 @@ import mu "vendor:microui"
engine_state :: struct
{
window : glfw.WindowHandle,
debug_draw : b2.DebugDraw,
draw : e2_draw.Draw,
restart, pause : bool,
substep_count : u32,
@@ -159,6 +161,7 @@ engine_init :: proc($GameType : typeid, state: ^engine_state, font_path : strin
state.draw.show_ui = true
e2_draw.draw_create(&state.draw, &state.draw.cam, font_path)
draw_configure_box2d(state)
cbor.tag_register_type({
marshal = proc(_: ^cbor.Tag_Implementation, e: cbor.Encoder, v: any) -> cbor.Marshal_Error {
@@ -260,8 +263,8 @@ end_frame :: proc(state: ^engine_state)
for &p, i in &points do points[i] = e2_draw.camera_convert_screen_to_world(&draw.cam, p)
color := c.color
hex_color := e2_draw.make_hex_color({color.r, color.g, color.b, color.a})
e2_draw.solid_polygon_add(&draw.polygons, {q = b2.Rot{c = 1}}, &points[0], 4, 0, hex_color)
//hex_color := e2_draw.make_hex_color({color.r, color.g, color.b, color.a})
e2_draw.solid_polygon_add(&draw.polygons, {q = e2_draw.Rot{c = 1}}, &points[0], 4, 0, transmute([4]u8)color)
}
case ^mu.Command_Clip:
{
@@ -278,7 +281,7 @@ end_frame :: proc(state: ^engine_state)
pos.y += f32(c.rect.h)/2.0
pos = e2_draw.camera_convert_screen_to_world(&draw.cam, pos)
e2_draw.solid_circle_add(&draw.solid_circles,{p = pos, q = b2.Rot{c = 1}} , 0.1,{255, 255, 255, 255})
e2_draw.solid_circle_add(&draw.solid_circles,{p = pos, q = e2_draw.Rot{c = 1}} , 0.1,{255, 255, 255, 255})
}else{
fmt.println(c.id)
}