-Subproject commit 19f30f1562238a0bbbb23acc249311a17361e36d
+Subproject commit 27c896ce946092882f9665b1ec39f6a3d74c5094
ip_addr: [..] u8;
port: [..] u8;
name: [..] u8;
+
+ title_font: Font;
}
Connect_Menu :: struct {
array.clear(^port);
port_buffer: [8] u8;
string.concat(^port, conv.format(port_buffer, "{}", (package runtime.vars).Game_Port));
+
+ title_font = font_lookup(.{"./assets/fonts/calibri.ttf", 64});
}
join :: (_: rawptr) {
ww, wh := camera.window_width, camera.window_height;
+ font_draw_centered(title_font, 0, (wh - 70) / 3, ww, "Untitled Shooter Game");
+
tx := (ww - 200) / 2;
ty := (wh - 160) / 2;
textbox_list_start();
ww, wh := camera.window_width, camera.window_height;
+ font_draw_centered(title_font, 0, (wh - 70) / 3, ww, "Untitled Shooter Game");
+
tx := (ww - 200) / 2;
ty := (wh - 16) / 2;
font_draw_centered(font, tx, ty, 200, "Connecting...");
}
font_make :: (fd: FontDescriptor) -> Font {
- texture_size :: 256;
+ texture_size := 256;
+ if fd.size > 40 {
+ texture_size = 512;
+ }
char_data := memory.make_slice(stbtt_packedchar, 96);
border_width := theme.border_width;
text_color := theme.text_color;
- text := str.{text_buffer.data, text_buffer.count};
+ text := cast(str) *text_buffer;
if text.count == 0 && placeholder.count > 0 {
text = placeholder;
text_color = theme.placeholder_text_color;
textbox_editing_state.cursor_position = math.clamp(textbox_editing_state.cursor_position, 0, text_buffer.count);
textbox_editing_state.cursor_animation = 1.0f;
- text = str.{text_buffer.data, text_buffer.count};
+ text = *text_buffer;
}
if is_hot_item(hash) {
State :: struct {
data: rawptr;
- init: (rawptr) -> void;
- deinit: (rawptr) -> void;
- enter: (rawptr, ^State) -> void;
- leave: (rawptr) -> void;
- update: (rawptr, dt: f32) -> void;
- draw: (rawptr) -> void;
+ init: (rawptr) -> void = null_proc;
+ deinit: (rawptr) -> void = null_proc;
+ enter: (rawptr, ^State) -> void = null_proc;
+ leave: (rawptr) -> void = null_proc;
+ update: (rawptr, dt: f32) -> void = null_proc;
+ draw: (rawptr) -> void = null_proc;
}
#local state_stack: [..] State;
push_game_state :: (state: type_expr, data: rawptr) -> ^State {
s := array.alloc_one(^state_stack);
+ *s = .{ data };
+
type_info.populate_struct_vtable(s, state, safe=false);
- s.data = data;
parent := array.get_ptr(state_stack, -2) if state_stack.count > 1 else null;
if parent != null {
- if parent.deinit != null_proc do parent.deinit(parent.data);
+ if parent.leave != null_proc do parent.leave(parent.data);
}
if s.init != null_proc do s.init(s.data);