Finally it seems that I must include my code right here!

Regards,
Gerard

REBOL [ ]

; This is a simple test to define a button-like face - It works
butn: load-thru/binary http://www.rebol.com/how-to/graphics/button.gif

btn-face: make face [
    edge: none
    color: none
    image: butn
]
; End of test code

game-space: make face [
    offset: 50x50
    size: 700x450
    edge: none
    effect: reduce [ 'grid 50x50 0x0 2x2 0.200.0]
    color: water
    pane: reduce [
        Robot: make face [
            text: "I am the robot"
            font: make font [align: 'left]
            size: 50x50
            center: 25x25
            offset: 50x50
            color: gold
            edge: none
            feel: make feel [
                engage: func [face action event] [
                    if action = 'key [
                        print ["Key: " event/key]

                        ; Détection des touches alphabétiques (Alphabetic keys 
detection)
                        if any [all [event/key >= #"a" event/key <= #"z"] all 
[event/key >= #"a" event/key <= #"z"]][
                             if any [event/key = #"f" event/key = #"F"][
                           face/text: offset if offset/y >= 100 [offset: offset 
- 0x50]
                           ]
                           if any [event/key = #"b" event/key = #"B"][
                           face/text: offset if offset/y <= (game-space/size/y 
- 250) [offset: offset + 0x50]
                           ]
                           if any [event/key = #"l" event/key = #"L"][
                           face/text: offset if offset/x >= 100 [offset: offset 
- 50x0]
                           ]
                           if any [event/key = #"r" event/key = #"R"][
                           face/text: offset if offset/x <= (game-space/size/x 
- 250) [offset: offset + 50x0]
                           ]
                        ]
                        ; Détection des touches fléchées (Arrows detection)
                        switch/default event/key [
                            up [face/text: offset if offset/y >= 100 [offset: 
offset - 0x50]]
                            down [face/text: offset if offset/y <= 
(game-space/size/y - 250) [offset: offset + 0x50]]
                            left [face/text: offset if offset/x >= 100 [offset: 
offset - 50x0]]
                            right [face/text: offset if offset/x <= 
(game-space/size/x - 250) [offset: offset + 50x0]]
                            bs [remove back tail face/text]
                            cr [unview]
                            escape [unview]
                        ][
                            face/text: event/key
                        ]
                        ;show robot-cmds

      ; Test code for num keys to write in robot-cmds panel instead of Robot 
face
      ; Détection des touches numériques
                        ;if all [event/key >= #"0" event/key <= #"9"] [
                        ;      system/view/focal-face: robot-cmds
      ;    system/view/caret: tail robot-cmds/text
                        ;       ;clear head robot-cmds/text
                        ;       append robot-cmds/text event/key
                        ;       show robot-cmds
                        ;       system/view/focal-face: Robot
      ;    system/view/caret: tail Robot/text
                       ;   ;system/view/caret: tail face/text
                       ;]
        ; End of test code

                        show Robot
                    ];if
                ];engage
            ];feel
        ];Robot face

     Command-panel: make face [
            text: ""
            font: make font [align: 'left]
            offset: 0x300
            size: 550x150
            color: white
            edge: none
            pane: reduce [
             legend: make face [
                 text: "- - Legend - -"
                font: make font [align: 'center]
                offset: 20x10
                size: 100x160
                color: silver
                edge: none
          ]
          legend-1: make face [
                 text: "Robot"
                font: make font [align: 'center]
                offset: 30x45
                size: 80x20
                color: gold
                edge: none
          ]
          legend-2: make face [
                 text: "Start pos"
                font: make font [align: 'center]
                offset: 30x70
                size: 80x20
                color: white
                edge: none
          ]
          legend-3: make face [
                 text: "Stop pos"
                font: make font [align: 'center]
                offset: 30x95
                size: 80x20
                color: brown
                edge: none
          ]
          legend-4: make face [
                 text: "Pick up item"
                font: make font [align: 'center]
                offset: 30x120
                size: 80x20
                color: gray
                edge: none
          ]
          robot-cmds: make face [
                 text: "- - ROBOT COMMANDS - -"
                font: make font [align: 'center]
                offset: 190x10
                size: 160x160
                color: silver
                edge: none
          ]
          robot-cmds-1: make face [
                 text: "(F)orward"
                font: make font [align: 'center]
                offset: 240x40
                size: 60x20
                color: red
                edge: none
          ]
            ; Another part for the test of a button
            ; Image d'un bouton rouge sur fond blanc
            ;make btn-face [
               ; text: "(F)orward"
               ; font: make font [align: 'center]
               ; offset: 240x40
               ; size: 60x30
               ; effect: [fit]
            ;]
            ; End of this test part

          robot-cmds-2: make face [
                 text: "(B)ack"
                font: make font [align: 'center]
                offset: 240x80
                size: 60x20
                color: red
                edge: none
          ]
          robot-cmds-3: make face [
                 text: "(L)eft"
                font: make font [align: 'center]
                offset: 190x60
                size: 45x20
                color: red
                edge: none
          ]
          robot-cmds-4: make face [
                 text: "(R)ight"
                font: make font [align: 'center]
                offset: 305x60
                size: 45x20
                color: red
                edge: none
          ]
          robot-cmds-5: make face [
                 text: "(P)ick"
                font: make font [align: 'center]
                offset: 200x120
                size: 60x20
                color: red
                edge: none
          ]
         robot-cmds-6: make face [
                 text: "(D)eliver"
                font: make font [align: 'center]
                offset: 285x120
                size: 60x20
                color: red
                edge: none
          ]
         ]
        ]
        Program-zone: make face [
            text: "Here will appear the program."
            font: make font [align: 'left]
            offset: 550x0
            size: 150x550
            color: red
            edge: none
        ]

    ]
]
; This permits to write text inside ROBOT face
system/view/focal-face: Robot
system/view/caret: tail Robot/text
view game-space



-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to