Created
March 7, 2016 15:18
-
-
Save iArnold/601546d4109f90d16841 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [ | |
filename: %guitest.red | |
author: "Arnold van Hofwegen" | |
date: "07-Mrt-2016" | |
Needs: 'View | |
] | |
system/view/debug?: no | |
live?: system/view/auto-sync?: no | |
workstation?: system/view/platform/product = 1 | |
print [ | |
"Windows" switch system/view/platform/version [ | |
10.0.0 [pick ["10" "10 Server" ] workstation?] | |
6.3.0 [pick ["8.1" "Server 2012 R2"] workstation?] | |
6.2.0 [pick ["8" "Server 2012" ] workstation?] | |
6.1.0 [pick ["7" "Server 2008 R1"] workstation?] | |
6.0.0 [pick ["Vista" "Server 2008" ] workstation?] | |
5.2.0 [pick ["Server 2003" "Server 2003 R2"] workstation?] | |
5.1.0 ["XP"] | |
5.0.0 ["2000"] | |
] | |
"build" system/view/platform/build | |
] | |
move-indicator-size: 20x20 | |
change-move-indication: func [ | |
to-color [integer!] | |
][ | |
either 1 = to-color [ | |
print "black to move" | |
red-to-move/size: 4x4 | |
black-to-move/size: move-indicator-size | |
player-color-to-move/color: purple | |
][ | |
print "Red to move" | |
red-to-move/size: move-indicator-size | |
black-to-move/size: 4x4 | |
player-color-to-move/color: green | |
] | |
show player-color-to-move | |
;show win/pane | |
] | |
;--------------------- | |
; Declaring the window | |
;--------------------- | |
win: make face! [ | |
type: 'window text: "Test by: Arnold" offset: 300x200 size: 400x500 | |
] | |
;-- Declare window pane | |
win/pane: reduce [ | |
make face! [ ; make Red to play button | |
type: 'button text: "(Red)" offset: 10x465 size: 145x24 | |
actors: object [ | |
on-click: func [face [object!] event [event!]][ | |
change-move-indication 0 | |
] | |
] | |
] | |
make face! [ ; make Black to play button | |
type: 'button text: "(Black)" offset: 160x465 size: 145x24 | |
actors: object [ | |
on-click: func [face [object!] event [event!]][ | |
change-move-indication 1 | |
] | |
] | |
] | |
make face! [ ; Quit button | |
type: 'button text: "Stop" offset: 310x465 size: 60x24 | |
actors: object [ | |
on-click: func [face [object!] event [event!]][ | |
print "calling unview" | |
unview/all | |
] | |
] | |
] | |
black-to-move: make face! [ | |
type: 'base offset: 175x10 | |
size: 20x20 color: blue | |
] | |
red-to-move: make face! [ | |
type: 'base offset: 175x390 | |
size: 20x20 color: red | |
] | |
player-color-to-move: make face! [ | |
type: 'base | |
offset: 375x250 | |
size: 20x20 | |
color: none | |
] | |
] | |
;-- end declare window pane | |
; Now show and run the application | |
view win |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment