BrightSign BrightScript 3.0 Reference Manual User Manual

Page 66

Advertising
background image

61

End

Function

REM

REM gbInit() is a member function of the game_board BrightScript Object.

REM When it is called, the "this" pointer "m" is set to the appropriate instance by

REM the BrightScript bytecode interpreter

REM

Function

gbInit()

As

Void

REM

REM button presses go to this message port

REM

m.buttons = CreateObject(

"roMessagePort"

)

m.gpio = CreateObject(

"roGpioControlPort"

)

m.gpio.SetPort(m.buttons)

REM

REM determine optimal size and position for the snake gameboard

REM

CELLWID=16

' each cell on game in pixels width

CELLHI=16

' each cell in pix height

MAXWIDE=30

' max width (in cells) of game board

MAXHI=30

' max height (in cells) of game board

vidmode=CreateObject(

"roVideoMode"

)

w=

cint

(vidmode.GetResX()/CELLWID)

if

w>MAXWIDE

then

w = MAXWIDE

h=

cint

(vidmode.GetResY()/CELLHI)

Advertising