BrightSign BrightScript 3.0 Reference Manual User Manual

Page 68

Advertising
background image

63

Function

gbStartX()

As

Integer

return

cint

(m.text_field.GetWidth()/2)

End

Function

Function

gbStartY()

As

Integer

return

cint

(m.text_field.GetHeight()/2)

End

Function

Function

gbEventLoop()

As

Void

tick_count=0

while

true

msg=wait(250, m.buttons)

' wait for a button, or 250ms (1/4 a second) timeout

if

type(msg)=

"roGpioButton"

then

if

msg.GetInt()=1 m.snake.TurnNorth()

if

msg.GetInt()=2 m.snake.TurnSouth()

if

msg.GetInt()=3 m.snake.TurnEast()

if

msg.GetInt()=4 m.snake.TurnWest()

else

'here if time out happened, move snake forward

tick_count=tick_count+1

if

tick_count=6

then

tick_count=0

if

m.snake.MakeLonger(m.text_field)

then

return

else

Advertising