NAME

Game::UI - UI for the Worm game.

SYNOPSIS

Nah...

PROPERTIES

oConsole

Screen console object

oKeyboard

Keyboard console object

offsetTop

Where on the screen to display the Lawn.

Default: 0

offsetLeft

Where on the screen to display the Lawn.

Default: 0

oLocationScore

Location for the score output, or undef if none.

soundsEnabled

Whether to play sounds or not.

Default: 0

METHODS

new()

Create new UI.

displayLawn($oLawn)

Initialize the screen and display stuff on the $oLawn

Return 1 on success, else 0.

runMainMenu($oApplication)

Show the menu and accept user input. Run whatever user action is selected.

Return 1 on success, else 0.

showMainMenu()

Show the menu on the screen.

Return 1 on success, else 0.

displayObjectAt($oObject)

Display the $oObject at it's Locaton.

Return 1 on success, else 0.

displayObjectBodyPartAt($oLocation, [$char = '.'], [$oObject])

Display the $char at the $oLocation. If $oObject is passed, the style may be influenced by it.

Return 1 on success, else 0.

getUserAction()

Return logical user action:

"turn left"
"turn right"
"quit"
"pause"

Return "" if there is no user input pending.

showScore([$score])

If there is a Location for the score, display it.

Return 1 on success, else 0.

prizeWasClaimedBy($oPrize, $oObject)

The $oPrize was claimed by $oObject. Note this by playing a sound (if available).

Return 1 on success, else 0.

wormHasCrashed($oObject)

The worm $oObject has crashed.

Note this by playing a sound (if available).

Return 1 on success, else 0.

playSound($name)

If soundsEnabled(), play the sound $name if it's available.

Return 1 on success, else 0.

getKeyPressChar()

Check for keyboard key presses, and return the char of the key pressed, or undef if no key was pressed (don't block).