gg: add draw_square, draw_empty_square, and set_pixel (#8375)

pull/8386/head
shadowninja55 2021-01-27 15:39:11 -05:00 committed by GitHub
parent fccd4f98d5
commit f4baa3f39c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 0 deletions

View File

@ -322,6 +322,16 @@ pub fn (ctx &Context) draw_rect(x f32, y f32, w f32, h f32, c gx.Color) {
sgl.end()
}
[inline]
pub fn (ctx &Context) draw_square(x f32, y f32, s f32, c gx.Color) {
ctx.draw_rect(x, y, s, s, c)
}
[inline]
pub fn (ctx &Context) set_pixel(x f32, y f32, c gx.Color) {
ctx.draw_square(x, y, 1, c)
}
pub fn (ctx &Context) draw_triangle(x f32, y f32, x2 f32, y2 f32, x3 f32, y3 f32, c gx.Color) {
if c.a != 255 {
sgl.load_pipeline(ctx.timage_pip)
@ -356,6 +366,11 @@ pub fn (ctx &Context) draw_empty_rect(x f32, y f32, w f32, h f32, c gx.Color) {
sgl.end()
}
[inline]
pub fn (ctx &Context) draw_empty_square(x f32, y f32, s f32, c gx.Color) {
ctx.draw_empty_rect(x, y, s, s, c)
}
pub fn (ctx &Context) draw_circle_line(x f32, y f32, r int, segments int, c gx.Color) {
if c.a != 255 {
sgl.load_pipeline(ctx.timage_pip)