Skip to content

Instantly share code, notes, and snippets.

@iArnold
Last active March 30, 2016 14:29
Show Gist options
  • Save iArnold/fd0f69c846697514d70c to your computer and use it in GitHub Desktop.
Save iArnold/fd0f69c846697514d70c to your computer and use it in GitHub Desktop.
Red [
Title: "Added title"
filename: %guitest.red
author: "Arnold van Hofwegen"
Icon: default
date: "30-Mar-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"
indicator-red-move/size: 4x4
indicator-black-move/size: move-indicator-size
player-color-to-move/color: purple
][
print "Red to move"
indicator-red-move/size: move-indicator-size
indicator-black-move/size/1: 4
indicator-black-move/size/2: 4
player-color-to-move/color: green
]
show player-color-to-move
print indicator-black-move/size/1
print indicator-black-move/size/2
;show win/pane
]
;---------------------
; Declaring the window
;---------------------
win: make face! [
type: 'window text: "Test by: Arnold" offset: 300x200 size: 600x500
]
;-- 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
]
]
]
indicator-black-move: make face! [
type: 'panel offset: 175x10
size: 20x20 color: blue
]
indicator-red-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