mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
gg: add draw_square, draw_empty_square, and set_pixel (#8375)
This commit is contained in:
parent
fccd4f98d5
commit
f4baa3f39c
15
vlib/gg/gg.v
15
vlib/gg/gg.v
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user