Draw a pixel: Difference between revisions

No edit summary
Line 1,881:
 
=={{header|Vlang}}==
<lang vlang>import uigg
import gg
import gx
 
fn canvas_draw(gg &gg.Context, app &State, c &ui.Canvas) { // x_offset int, y_offset int) {
gg.draw_pixel(100, 100, gx.red)
 
struct State {
mut:
window &ui.Window = voidptr(0)
started bool
is_error bool
}
 
fn main() {
mut appcontext := &State{}gg.new_context(
window := ui.window(
width: 320
height: 240
stateframe_fn: appframe
children: [
ui.canvas(
draw_fn: canvas_draw
)
]
)
uicontext.run(window)
app.window = window
ui.run(window)
 
fn frame(mut ctx gg.Context) {
ctx.begin()
ggctx.draw_pixel(100, 100, gx.red)
ctx.end()
}</lang>
 
338

edits