Skip to content

Instantly share code, notes, and snippets.

@Oldes
Forked from iArnold/qi-dyn.red
Created October 5, 2015 15:50
Show Gist options
  • Save Oldes/a126ce0f60a4e6221bb3 to your computer and use it in GitHub Desktop.
Save Oldes/a126ce0f60a4e6221bb3 to your computer and use it in GitHub Desktop.
A try to see a line being drawn on the canvas
Red [
Needs: 'View
]
system/view/debug?: off
win: make face! [
type: 'window text: "Board View Test" offset: 500x500 size: 800x800
]
win/pane: reduce [
make face! [ ; text or label
type: 'text text: "Board" offset: 100x50 size: 70x24
]
canvas: make face! [
type: 'base text: "canvas" offset: 100x100 size: 360x400 color: silver
draw: [pen red fill-pen red line-width 5 line 200x0 200x0]
]
make face! [ ; Start button
type: 'button text: "Start" offset: 500x240 size: 60x24
actors: object [
on-click: func [face [object!] event [event!]][
print "calling start"
canvas/data: on
]
]
]
make face! [ ; clear button
type: 'button text: "Clear" offset: 500x340 size: 60x24
actors: object [
on-click: func [face [object!] event [event!]][
print "calling clear"
canvas/draw: copy base-draw
;probe canvas/draw
canvas/data: off
show canvas
]
]
]
make face! [ ; Quit button
type: 'button text: "Quit" offset: 500x440 size: 60x24
actors: object [
on-click: func [face [object!] event [event!]][
print "calling unview"
unview/all
]
]
]
]
base-draw: [
pen red fill-pen red line-width 5 line 200x0 200x200
]
canvas/draw: copy base-draw
show win
forever [
system/view/platform/do-event-loop true
if canvas/data = on [
canvas/draw/9: random 200x200
show canvas
;canvas/data: on
probe canvas/draw
]
print random 1000
;do something here...
]
@iArnold
Copy link

iArnold commented Oct 5, 2015

Looks promising this approach. I find it interesting to try to push this early VID, experience where it can be taken, like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment