1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

gg: renaming drawing functions (#12913)

This commit is contained in:
Benjamin Stigsen
2021-12-23 12:31:25 +01:00
committed by GitHub
parent ad1ef6a9e2
commit 546c388b02
15 changed files with 145 additions and 55 deletions

View File

@@ -41,12 +41,14 @@ fn main() {
fn frame(mut app App) {
app.gg.begin()
// Set a blue pixel near each corner. (Find your magnifying glass)
app.gg.set_pixel(2, 2, gx.blue)
app.gg.set_pixel(app.gg.width - 2, 2, gx.blue)
app.gg.set_pixel(app.gg.width - 2, app.gg.height - 2, gx.blue)
app.gg.set_pixel(2, app.gg.height - 2, gx.blue)
// Set pixels in a grid-like pattern.
app.gg.set_pixels(app.pixels, gx.red)
// Draw a blue pixel near each corner. (Find your magnifying glass)
app.gg.draw_pixel(2, 2, gx.blue)
app.gg.draw_pixel(app.gg.width - 2, 2, gx.blue)
app.gg.draw_pixel(app.gg.width - 2, app.gg.height - 2, gx.blue)
app.gg.draw_pixel(2, app.gg.height - 2, gx.blue)
// Draw pixels in a grid-like pattern.
app.gg.draw_pixels(app.pixels, gx.red)
app.gg.end()
}

View File

@@ -18,7 +18,7 @@ fn frame(mut ctx gg.Context) {
ctx.begin()
ctx.draw_convex_poly([f32(100.0), 100.0, 200.0, 100.0, 300.0, 200.0, 200.0, 300.0, 100.0, 300.0],
gx.blue)
ctx.draw_empty_poly([f32(50.0), 50.0, 70.0, 60.0, 90.0, 80.0, 70.0, 110.0], gx.black)
ctx.draw_triangle(450, 142, 530, 280, 370, 280, gx.red)
ctx.draw_poly_empty([f32(50.0), 50.0, 70.0, 60.0, 90.0, 80.0, 70.0, 110.0], gx.black)
ctx.draw_triangle_filled(450, 142, 530, 280, 370, 280, gx.red)
ctx.end()
}

View File

@@ -47,7 +47,7 @@ fn frame(app &App) {
fn (app &App) draw() {
// app.gg.draw_text_def(200,20, 'hello world!')
// app.gg.draw_text_def(300,300, 'привет')
app.gg.draw_rect(10, 10, 100, 30, gx.blue)
app.gg.draw_empty_rect(110, 150, 80, 40, gx.black)
app.gg.draw_rect_filled(10, 10, 100, 30, gx.blue)
app.gg.draw_rect_empty(110, 150, 80, 40, gx.black)
app.gg.draw_image(230, 30, app.image.width, app.image.height, app.image)
}