From: Brendan Hansen Date: Tue, 21 Sep 2021 22:59:28 +0000 (-0500) Subject: using new features in the ui library X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=95cd6a53730be71e4c66623cffdd2b924473a12c;p=onyx.git using new features in the ui library --- diff --git a/modules/ui/font.onyx b/modules/ui/font.onyx index f2f809ff..6d8a82a7 100644 --- a/modules/ui/font.onyx +++ b/modules/ui/font.onyx @@ -32,7 +32,7 @@ Font :: struct { return ~~font.common.baseline * size; } - render :: (use f: ^Font, text: str, x: f32, y: f32, font_size: f32, color := gfx.Color4.{1,1,1}) { + render :: (use f: ^Font, text: str, x, y: f32, font_size: f32, color := gfx.Color4.{1,1,1}) { gfx.set_texture(^texture); switch rendering_kind { diff --git a/modules/ui/ui.onyx b/modules/ui/ui.onyx index e924453d..5cfe8f7f 100644 --- a/modules/ui/ui.onyx +++ b/modules/ui/ui.onyx @@ -123,7 +123,7 @@ draw_rect :: #match { gfx.rect(.{ x0, y0 }, .{ width, height }, color); }, - (x: f32, y: f32, w: f32, h: f32, color := gfx.Color4.{1,1,1}) { + (x, y, w, h: f32, color := gfx.Color4.{1,1,1}) { gfx.set_texture(); gfx.rect(.{ x, y }, .{ w, h }, color); } @@ -158,7 +158,7 @@ Rectangle :: struct { bottom_left :: (use r: Rectangle) -> (x: f32, y: f32) do return math.min(x0, x1), math.max(y0, y1); bottom_right :: (use r: Rectangle) -> (x: f32, y: f32) do return math.max(x0, x1), math.max(y0, y1); - contains :: (use r: Rectangle, x: f32, y: f32) -> bool { + contains :: (use r: Rectangle, x, y: f32) -> bool { return math.min(x0, x1) <= x && x <= math.max(x0, x1) && math.min(y0, y1) <= y && y <= math.max(y0, y1); }