diff options
Diffstat (limited to 'src/draw/draw.odin')
| -rw-r--r-- | src/draw/draw.odin | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/draw/draw.odin b/src/draw/draw.odin index 122e6fa..c4dae9f 100644 --- a/src/draw/draw.odin +++ b/src/draw/draw.odin @@ -1,7 +1,7 @@ package draw -import "core:math" import "core:c" +import "core:math" import rl "vendor:raylib" @@ -27,7 +27,7 @@ renderer: struct { @(private) color_to_rl :: proc(col: Color) -> rl.Color { - return rl.Color{ + return rl.Color { u8(col.r * 255), u8(col.g * 255), u8(col.b * 255), @@ -59,7 +59,7 @@ end_frame :: proc() { f32(rl.GetScreenWidth()) / f32(SCREEN_WIDTH), f32(rl.GetScreenHeight()) / f32(SCREEN_HEIGHT), ) - screen_start := Vec2{ + screen_start := Vec2 { (f32(rl.GetScreenWidth()) - (SCREEN_WIDTH * scale)) / 2, (f32(rl.GetScreenHeight()) - (SCREEN_HEIGHT * scale)) / 2, } @@ -77,13 +77,15 @@ rect :: proc(rect: Rect) { assert(rect.size.x > 0 && rect.size.y > 0) rl.DrawRectangle( - c.int(rect.start.x), c.int(rect.start.y), - c.int(rect.size.x), c.int(rect.size.y), + c.int(rect.start.x), + c.int(rect.start.y), + c.int(rect.size.x), + c.int(rect.size.y), color_to_rl(renderer.tint), ) } -texture :: proc{ +texture :: proc { texture_full, texture_quad, } @@ -107,9 +109,11 @@ texture_quad :: proc( rl.DrawTexturePro( img, transmute(rl.Rectangle)quad, - rl.Rectangle{ - position.x, position.y, - quad.size.x * scale.x, quad.size.y * scale.y, + rl.Rectangle { + position.x, + position.y, + quad.size.x * scale.x, + quad.size.y * scale.y, }, offset, rotation, @@ -124,10 +128,7 @@ texture_full :: proc( rotation: f32 = 0, scale := Vec2{1, 1}, ) { - size := Vec2{ - f32(img.width), - -f32(img.height), - } + size := Vec2{f32(img.width), -f32(img.height)} texture_quad(img, Rect{Vec2{0, 0}, size}, position, offset, rotation, scale) } |
