microui: make clipboard optional during init

Clipboard is an optional addition to the microui functionality, but the
init function makes it look like it is required. Additionally, a bunch of
the examples both on the Odin-Lang/examples repo and others are now
"broken".
This commit is contained in:
Laytan Laats
2024-05-30 16:19:33 +02:00
parent ba8672ad29
commit 6bbe7d88b8

View File

@@ -319,7 +319,12 @@ default_draw_frame :: proc(ctx: ^Context, rect: Rect, colorid: Color_Type) {
}
}
init :: proc(ctx: ^Context, set_clipboard: proc(user_data: rawptr, text: string) -> (ok: bool), get_clipboard: proc(user_data: rawptr) -> (text: string, ok: bool), clipboard_user_data: rawptr) {
init :: proc(
ctx: ^Context,
set_clipboard: proc(user_data: rawptr, text: string) -> (ok: bool) = nil,
get_clipboard: proc(user_data: rawptr) -> (text: string, ok: bool) = nil,
clipboard_user_data: rawptr = nil,
) {
ctx^ = {} // zero memory
ctx.draw_frame = default_draw_frame
ctx._style = default_style