28 lines
564 B
Odin
28 lines
564 B
Odin
package game
|
|
|
|
import rl "vendor:raylib"
|
|
|
|
draw_text_centered_in_rect :: proc(
|
|
text: cstring,
|
|
rect: rl.Rectangle,
|
|
font_size: i32,
|
|
color: rl.Color,
|
|
) {
|
|
text_w := rl.MeasureText(text, font_size)
|
|
x := i32(rect.x) + (i32(rect.width) - text_w) / 2
|
|
y := i32(rect.y) + (i32(rect.height) - font_size) / 2
|
|
rl.DrawText(text, x, y, font_size, color)
|
|
}
|
|
|
|
draw_button :: proc(
|
|
rect: rl.Rectangle,
|
|
label: cstring,
|
|
bg: rl.Color,
|
|
font_size: i32,
|
|
text_color: rl.Color,
|
|
) {
|
|
rl.DrawRectangleRec(rect, bg)
|
|
draw_text_centered_in_rect(label, rect, font_size, text_color)
|
|
}
|
|
|