![]() |
MAK RTIspy API Documentation for HLA Evolved
|
The Class KeyboardShipController. More...
Inheritance diagram for controllers.KeyboardShipController:
Collaboration diagram for controllers.KeyboardShipController:Public Member Functions | |
| KeyboardShipController (IMakShooterRTI myRti, Board board, final Ship ship) | |
| Instantiates a new keyboard ship controller. | |
| void | shipActionPressed (KeyEvent evt) |
| Ship action pressed. | |
| void | shipActionReleased (KeyEvent evt) |
| Ship action released. | |
| void | moveShip (int x, int y) |
| Move ship. | |
| void | shoot () |
| Shoot. | |
| void | TestShoot (Ship ship) |
| Purely for Testing. | |
| void | run () |
| This will start the keyboard Controller, allowing you to move one ship up and down using the UP Arrow and DOWN Arrow keys. | |
| IShipController | start () |
Protected Member Functions | |
| void | formKeyPressed (KeyEvent evt) |
| Form key pressed. | |
| void | formKeyReleased (KeyEvent evt) |
| Form key released. | |
Private Member Functions | |
| void | repaint () |
| Repaint. | |
Private Attributes | |
| boolean | moveUp = false |
| The move up. | |
| boolean | moveDown = false |
| The move down. | |
| final Ship | ship |
| The ship. | |
| final Board | board |
| The board. | |
| boolean | shotCooldownActive = false |
| Timer | timer |
Static Private Attributes | |
| static final int | SHOT_COOLDOWN = 500 |
| static final int | DELAY = 70 |
| The Constant DELAY. | |
The Class KeyboardShipController.
| controllers.KeyboardShipController.KeyboardShipController | ( | IMakShooterRTI | myRti, |
| Board | board, | ||
| final Ship | ship | ||
| ) | [inline] |
Instantiates a new keyboard ship controller.
| myRti | the my rti |
| board | the board |
| ship | the ship |
References ui.Board.addKeyboardListenerToBoard(), controllers.KeyboardShipController.board, controllers.KeyboardShipController.formKeyPressed(), controllers.KeyboardShipController.formKeyReleased(), controllers.KeyboardShipController.ship, and controllers.KeyboardShipController.timer.
| void controllers.KeyboardShipController.formKeyPressed | ( | KeyEvent | evt | ) | [inline, protected] |
Form key pressed.
| evt | the evt |
References controllers.KeyboardShipController.shipActionPressed().
Referenced by controllers.KeyboardShipController.KeyboardShipController().
| void controllers.KeyboardShipController.formKeyReleased | ( | KeyEvent | evt | ) | [inline, protected] |
Form key released.
| evt | the evt |
References controllers.KeyboardShipController.shipActionReleased().
Referenced by controllers.KeyboardShipController.KeyboardShipController().
| void controllers.KeyboardShipController.moveShip | ( | int | x, |
| int | y | ||
| ) | [inline, virtual] |
Move ship.
| x | the x |
| y | the y |
Implements controllers.IShipController.
References controllers.IShipController.myRTI, common.Drawable.setX(), common.Drawable.setY(), controllers.KeyboardShipController.ship, and federate.IMakShooterRTI.updateShipAttributes().
Referenced by controllers.KeyboardShipController.run().
| void controllers.KeyboardShipController.repaint | ( | ) | [inline, private] |
Repaint.
References controllers.KeyboardShipController.board.
Referenced by controllers.KeyboardShipController.run().
| void controllers.KeyboardShipController.run | ( | ) | [inline] |
This will start the keyboard Controller, allowing you to move one ship up and down using the UP Arrow and DOWN Arrow keys.
References controllers.KeyboardShipController.board, ui.MakShooterUIConstants.DEFAULT_BOARD_HEIGHT, ui.MakShooterUIConstants.DEFAULT_SHIP_SIZE, ui.MakShooterUIConstants.DEFAULT_SHIP_Y_SHIFT, controllers.KeyboardShipController.DELAY, controllers.IShipController.finished, common.Drawable.getX(), common.Drawable.getY(), controllers.KeyboardShipController.moveDown, controllers.KeyboardShipController.moveShip(), controllers.KeyboardShipController.moveUp, ui.Board.myKeyboardHackForLinux(), controllers.KeyboardShipController.repaint(), and controllers.KeyboardShipController.ship.
Referenced by controllers.KeyboardShipController.shoot().
| void controllers.KeyboardShipController.shipActionPressed | ( | KeyEvent | evt | ) | [inline] |
Ship action pressed.
| evt | the evt |
References controllers.KeyboardShipController.moveDown, and controllers.KeyboardShipController.moveUp.
Referenced by controllers.KeyboardShipController.formKeyPressed().
| void controllers.KeyboardShipController.shipActionReleased | ( | KeyEvent | evt | ) | [inline] |
Ship action released.
| evt | the evt |
References controllers.KeyboardShipController.moveDown, controllers.KeyboardShipController.moveUp, controllers.KeyboardShipController.shoot(), and controllers.KeyboardShipController.shotCooldownActive.
Referenced by controllers.KeyboardShipController.formKeyReleased().
| void controllers.KeyboardShipController.shoot | ( | ) | [inline, virtual] |
Shoot.
Implements controllers.IShipController.
References controllers.ShotManager.addNewShot(), common.Ship.getAlignment(), controllers.ShotManager.getInstance(), controllers.ShotManager.getShotFromShotPool(), common.Drawable.getX(), common.Drawable.getY(), controllers.KeyboardShipController.run(), common.Shot.setAlignment(), common.Drawable.setVisible(), common.Drawable.setX(), common.Drawable.setY(), controllers.KeyboardShipController.ship, controllers.KeyboardShipController.SHOT_COOLDOWN, controllers.KeyboardShipController.shotCooldownActive, and controllers.KeyboardShipController.timer.
Referenced by controllers.KeyboardShipController.shipActionReleased().
| IShipController controllers.KeyboardShipController.start | ( | ) | [inline, virtual] |
Implements controllers.IShipController.
Referenced by ui.TestMain.main(), federate.RTI1516e.Test.main(), and ui.RTIActionHelper.startNewGame().
| void controllers.KeyboardShipController.TestShoot | ( | Ship | ship | ) | [inline] |
Purely for Testing.
| ship | the ship |
References controllers.ShotManager.addNewShot(), common.Ship.getAlignment(), controllers.ShotManager.getInstance(), common.Drawable.getX(), and common.Drawable.getY().
final Board controllers.KeyboardShipController.board [private] |
final int controllers.KeyboardShipController.DELAY = 70 [static, private] |
The Constant DELAY.
Referenced by controllers.KeyboardShipController.run().
boolean controllers.KeyboardShipController.moveDown = false [private] |
The move down.
Referenced by controllers.KeyboardShipController.run(), controllers.KeyboardShipController.shipActionPressed(), and controllers.KeyboardShipController.shipActionReleased().
boolean controllers.KeyboardShipController.moveUp = false [private] |
final Ship controllers.KeyboardShipController.ship [private] |
final int controllers.KeyboardShipController.SHOT_COOLDOWN = 500 [static, private] |
Referenced by controllers.KeyboardShipController.shoot().
boolean controllers.KeyboardShipController.shotCooldownActive = false [private] |
Timer controllers.KeyboardShipController.timer [private] |