mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
examples: add examples/gg/sample_count.v, showing the influence of the sample_count gg.Config parameter
This commit is contained in:
parent
aa3832ceda
commit
6fc3a3d088
1 changed files with 26 additions and 0 deletions
26
examples/gg/sample_count.v
Normal file
26
examples/gg/sample_count.v
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
module main
|
||||||
|
|
||||||
|
import gg
|
||||||
|
import gx
|
||||||
|
import os
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
scount := os.args[1] or { '2' }.int()
|
||||||
|
println('> sample count: ${scount}')
|
||||||
|
mut ctx := gg.new_context(
|
||||||
|
bg_color: gx.white
|
||||||
|
window_title: 'sample_count: ${scount}'
|
||||||
|
width: 320
|
||||||
|
height: 240
|
||||||
|
sample_count: scount
|
||||||
|
frame_fn: fn (mut ctx gg.Context) {
|
||||||
|
ctx.begin()
|
||||||
|
ctx.draw_rounded_rect_empty(110, 70, 100, 100, 10, gx.blue)
|
||||||
|
ctx.draw_circle_empty(160, 120, 100, gx.red)
|
||||||
|
ctx.draw_triangle_empty(160, 93, 186, 138, 132, 138, gx.green)
|
||||||
|
ctx.draw_rect_filled(159, 119, 2, 2, gx.black)
|
||||||
|
ctx.end()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
ctx.run()
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue