Bridges-Java  3.4.3
Bridges(Java API)
Public Member Functions | Protected Member Functions | List of all members
bridges.games.NonBlockingGame Class Referenceabstract
Inheritance diagram for bridges.games.NonBlockingGame:
bridges.games.GameBase

Detailed Description

This class provides the features necessary to implement simple non blocking games.

The games that can be created out of NonBlockingGame are based on a simple board grid of at most 1024 cells (e.g., 32x32, or any combinations less than 1024 cells). Each cell has a background color, and a colored symbol.

This class is used by having another class derive from it and implement the two functions: initialize() and gameLoop(). initialize() is called exactly once, on the first frame of the game. It is used to make first time initializations of the game state (such as setting the board in its initial position, for instance in chess). However, gameLoop() is called at every frame of the game. The game starts when the function start() is called on the object you created.

For this reason the simplest game that can run is created by:

import bridges.game.*;
import bridges.base.*;
class MyGame extends NonBlockingGame {
public MyGame() { super (1, "myuserid", "myapikey", 10, 10); }
public void initialize() { }
public void gameLoop() { }
public static void main (String args[]) {
MyGame g = new MyGame();
g.start();
}
}
abstract void gameLoop()
This function is called once per frame of the game.
abstract void initialize()
This function is called once when the game starts.
NonBlockingGame(int assignmentID, String login, String apikey, int rows, int cols)
Construct a NonBlockingGame object. It is expected students will never directly construct a NonBlocki...
Definition: NonBlockingGame.java:535

This game does not do anything, but it is the minimal code that will run a game. Note that the constructor of my_game passes 5 parameters to the constructor of NonBlockingGame(). The first three parameters are the classic parameters that the constructor of bridges.connect.Bridges takes (e.g., assignmentID, username, apikey), the last two are the size of the game board.

To change the board, two functions are used. setBGColor() change the background color of a particular cell. It takes three parameters, the first two identify the cell of the board to change, and the last one is a color from a color palette provided by NamedColor. drawSymbol() takes four parameters, the first two identify the cell of the board to change, the third is a symbol from a symbol palette provided by NamedSymbol, the fourth is the color that symbol shold be drawn in and provided by NamedColor.

For instance, a very simple initialize() could look like:

public void initialize() {
setBGColor(0, 0, NamedColor.lightsalmon);
drawSymbol(0, 0, NamedSymbol.sword, NamedColor.blue);
}
void drawSymbol(int row, int col, NamedSymbol s, NamedColor c)
Draw a symbol on the game.
Definition: GameBase.java:167
void setBGColor(int row, int col, NamedColor c)
Change the background color of a cell.
Definition: GameBase.java:133

Note that the size of the board was set at 10x10 and that drawing on a cell that does not exist will lead to an error. One can specify a gameboard of a different size by changing the parameters to the NonBlockingGame constructor. However, the game board can not be more than 1024 cells in total, so a 15x15 board is possible, a 32x32 board is the largest square board possible, and a rectangular 64x16 rectangular board is also possible. But a 100x20 board would be 2000 cells and is not possible. For instance a board of 16 rows and 64 columns can be created defining the my_game constructor as:

public MyGame() { super(1, "myuserid", "myapikey", 16, 64); }

The bridges game engine will call the gameLoop() function at each frame of the game. You can write this function to modify the state of the game board using setBGColor() and drawSymbol(). For instance, the following gameLoop() will color the board randomly one cell at a time.

public void gameLoop() {
setBGColor(Math.random()*10, Math.random()*10, NamedColor.lightsalmon);
}

The gameLoop can also probe the state of some keys of the keyboard using functions keyUp(), keyLeft(), keyDown(), keyRight(), keyW(), keyA(), keyS(), keyD(), keySpace(), and keyQ(). These functions return a boolean that indicate whether the key is pressed at that frame or not. For instance, the following code will only color the board randomly when the up arrow is pressed.

public void gameLoop() {
if (keyUp())
setBGColor(Math.random()*10, Math.rand()*10, NamedColor.lightsalmon);
}
boolean keyUp()
Is the UpArrow key currently pressed?
Definition: NonBlockingGame.java:252

The previous way will have an action executed at each frame of the game if the key stays pressed. This could be cumbersome for some games and you may want a key press to be triggered with a cooldown (so that it activates only every so many frames). You can configure how many frames will pass between two activations of the key with keyUpSetupFire() and you can tell whether it is a fire frame with keyUpFire(). There are similar functions for all keys that are recognized by Bridges. See the following code for a simple usage:

void initialize() override {
}
void gameLoop() override {
if (keyUpFire()) //will only be true once every 20 frames
setBGColor(rand()%10, rand()%10, NamedColor.lightsalmon);
}
void keyUpSetupFire(int f)
Definition: NonBlockingGame.java:278
boolean keyUpFire()
indicates whether the current frame is a fire frame for the Up key.
Definition: NonBlockingGame.java:273

Bridges supports a third way to use inputs that enables you to know the first frame a key is pressed and the first frame a key is no longer pressed. You can also know whether a key is still being pressed (after the first frame it is being pressed) and whether it is still not pressed (after the first frame it is no longer pressed). The four functions are keyUpJustPressed(), keyUpStillPressed(), keyUpJustNotPressed(), keyUpStillNotPressed(). The following code examplifies the usage of these functions.

virtual void gameLoop() override {
setBGColor(0, 0, NamedColor.lightsalmon);
setBGColor(0, 1, NamedColor.lightsalmon);
setBGColor(0, 2, NamedColor.lightsalmon);
setBGColor(0, 3, NamedColor.lightsalmon);
}
boolean keyUpJustPressed()
indicates whether the Up key has just been pressed this current frame.
Definition: NonBlockingGame.java:257
boolean keyUpStillNotPressed()
indicates whether the Up key not pressed and has not been pressed for more than a frame
Definition: NonBlockingGame.java:269
boolean keyUpStillPressed()
indicates whether the Up key is still being pressed in this frame.
Definition: NonBlockingGame.java:261
boolean keyUpJustNotPressed()
indicates whether the Up key has been just released in this frame
Definition: NonBlockingGame.java:265
See also
See tutorial at https://bridgesuncc.github.io/tutorials/NonBlockingGame.html
Author
Erik Saule
Date
7/21/19, 12/02/22, 1/11/2023

Public Member Functions

 NonBlockingGame (int assignmentID, String login, String apikey, int rows, int cols)
 Construct a NonBlockingGame object. It is expected students will never directly construct a NonBlockingGame object but rather derive from it. More...
 
 NonBlockingGame (int assignmentID, String login, String apikey, int rows, int cols, boolean deb)
 
void start ()
 
- Public Member Functions inherited from bridges.games.GameBase
 GameBase (int assid, String login, String apikey, int rows, int cols)
 
 GameBase (int assid, String login, String apikey, int rows, int cols, boolean d)
 

Protected Member Functions

boolean keyLeft ()
 Is the LeftArrow key currently pressed? More...
 
boolean keyLeftJustPressed ()
 indicates whether the Left key has just been pressed this current frame. More...
 
boolean keyLeftStillPressed ()
 indicates whether the Left key is still being pressed in this frame. More...
 
boolean keyLeftJustNotPressed ()
 indicates whether the Left key has been just released in this frame More...
 
boolean keyLeftStillNotPressed ()
 indicates whether the Left key not pressed and has not been pressed for more than a frame More...
 
boolean keyLeftFire ()
 indicates whether the current frame is a fire frame for the Left key. More...
 
void keyLeftSetupFire (int f)
 
boolean keyRight ()
 Is the RightArrow key currently pressed? More...
 
boolean keyRightJustPressed ()
 indicates whether the Right key has just been pressed this current frame. More...
 
boolean keyRightStillPressed ()
 indicates whether the Right key is still being pressed in this frame. More...
 
boolean keyRightJustNotPressed ()
 indicates whether the Right key has been just released in this frame More...
 
boolean keyRightStillNotPressed ()
 indicates whether the Right key not pressed and has not been pressed for more than a frame More...
 
boolean keyRightFire ()
 indicates whether the current frame is a fire frame for the Right key. More...
 
void keyRightSetupFire (int f)
 
boolean keyUp ()
 Is the UpArrow key currently pressed? More...
 
boolean keyUpJustPressed ()
 indicates whether the Up key has just been pressed this current frame. More...
 
boolean keyUpStillPressed ()
 indicates whether the Up key is still being pressed in this frame. More...
 
boolean keyUpJustNotPressed ()
 indicates whether the Up key has been just released in this frame More...
 
boolean keyUpStillNotPressed ()
 indicates whether the Up key not pressed and has not been pressed for more than a frame More...
 
boolean keyUpFire ()
 indicates whether the current frame is a fire frame for the Up key. More...
 
void keyUpSetupFire (int f)
 
boolean keyDown ()
 Is the DownArrow key currently pressed? More...
 
boolean keyDownJustPressed ()
 indicates whether the Down key has just been pressed this current frame. More...
 
boolean keyDownStillPressed ()
 indicates whether the Down key is still being pressed in this frame. More...
 
boolean keyDownJustNotPressed ()
 indicates whether the Down key has been just released in this frame More...
 
boolean keyDownStillNotPressed ()
 indicates whether the Down key not pressed and has not been pressed for more than a frame More...
 
boolean keyDownFire ()
 indicates whether the current frame is a fire frame for the Down key. More...
 
void keyDownSetupFire (int f)
 
boolean keyQ ()
 Is the Q key currently pressed? More...
 
boolean keyQJustPressed ()
 indicates whether the Q key has just been pressed this current frame. More...
 
boolean keyQStillPressed ()
 indicates whether the Q key is still being pressed in this frame. More...
 
boolean keyQJustNotPressed ()
 indicates whether the Q key has been just released in this frame More...
 
boolean keyQStillNotPressed ()
 indicates whether the Q key not pressed and has not been pressed for more than a frame More...
 
boolean keyQFire ()
 indicates whether the current frame is a fire frame for the Q key. More...
 
void keyQSetupFire (int f)
 
boolean keySpace ()
 Is the SpaceBar key currently pressed? More...
 
boolean keySpaceJustPressed ()
 indicates whether the Space key has just been pressed this current frame. More...
 
boolean keySpaceStillPressed ()
 indicates whether the Space key is still being pressed in this frame. More...
 
boolean keySpaceJustNotPressed ()
 indicates whether the Space key has been just released in this frame More...
 
boolean keySpaceStillNotPressed ()
 indicates whether the Space key not pressed and has not been pressed for more than a frame More...
 
boolean keySpaceFire ()
 indicates whether the current frame is a fire frame for the Space key. More...
 
void keySpaceSetupFire (int f)
 
boolean keyW ()
 Is the W key currently pressed? More...
 
boolean keyWJustPressed ()
 indicates whether the W key has just been pressed this current frame. More...
 
boolean keyWStillPressed ()
 indicates whether the W key is still being pressed in this frame. More...
 
boolean keyWJustNotPressed ()
 indicates whether the W key has been just released in this frame More...
 
boolean keyWStillNotPressed ()
 indicates whether the W key not pressed and has not been pressed for more than a frame More...
 
boolean keyWFire ()
 indicates whether the current frame is a fire frame for the W key. More...
 
void keyWSetupFire (int f)
 
boolean keyA ()
 Is the A key currently pressed? More...
 
boolean keyAJustPressed ()
 indicates whether the A key has just been pressed this current frame. More...
 
boolean keyAStillPressed ()
 indicates whether the A key is still being pressed in this frame. More...
 
boolean keyAJustNotPressed ()
 indicates whether the A key has been just released in this frame More...
 
boolean keyAStillNotPressed ()
 indicates whether the A key not pressed and has not been pressed for more than a frame More...
 
boolean keyAFire ()
 indicates whether the current frame is a fire frame for the A key. More...
 
void keyASetupFire (int f)
 
boolean keyS ()
 Is the S key currently pressed? More...
 
boolean keySJustPressed ()
 indicates whether the S key has just been pressed this current frame. More...
 
boolean keySStillPressed ()
 indicates whether the S key is still being pressed in this frame. More...
 
boolean keySJustNotPressed ()
 indicates whether the S key has been just released in this frame More...
 
boolean keySStillNotPressed ()
 indicates whether the S key not pressed and has not been pressed for more than a frame More...
 
boolean keySFire ()
 indicates whether the current frame is a fire frame for the S key. More...
 
void keySSetupFire (int f)
 
boolean keyD ()
 Is the D key currently pressed? More...
 
boolean keyDJustPressed ()
 indicates whether the D key has just been pressed this current frame. More...
 
boolean keyDStillPressed ()
 indicates whether the D key is still being pressed in this frame. More...
 
boolean keyDJustNotPressed ()
 indicates whether the D key has been just released in this frame More...
 
boolean keyDStillNotPressed ()
 indicates whether the D key not pressed and has not been pressed for more than a frame More...
 
boolean keyDFire ()
 indicates whether the current frame is a fire frame for the D key. More...
 
void keyDSetupFire (int f)
 
double getFrameRate ()
 What frame rate is the game running at? More...
 
void setFrameRate (double fps)
 change the frame rate is the game running at More...
 
- Protected Member Functions inherited from bridges.games.GameBase
abstract void initialize ()
 This function is called once when the game starts. More...
 
abstract void gameLoop ()
 This function is called once per frame of the game. More...
 
void quit ()
 Call this function to stop the game. More...
 
void setTitle (String title)
 Set the title of the game. More...
 
void setDescription (String desc)
 Set a short description of the game. More...
 
void setBGColor (int row, int col, NamedColor c)
 Change the background color of a cell. More...
 
NamedColor getBGColor (int row, int col)
 What color is this cell? More...
 
NamedSymbol getSymbol (int row, int col)
 What object is in this cell? More...
 
NamedColor getSymbolColor (int row, int col)
 What color is object in this cell? More...
 
void drawSymbol (int row, int col, NamedSymbol s, NamedColor c)
 Draw a symbol on the game. More...
 
int getBoardWidth ()
 How wide is the Game Board? More...
 
int getBoardHeight ()
 How tall is the Game Board? More...
 
void terminateNetwork ()
 terminal all network connections Note that it takes a minute for all threads to gracefully exit More...
 

Additional Inherited Members

- Protected Attributes inherited from bridges.games.GameBase
boolean debug = false
 
boolean gameStarted = true
 
- Package Functions inherited from bridges.games.GameBase
void registerKeypress (KeypressListener kl)
 register a new KeypressListener More...
 
void render ()
 Renders the game. More...
 

Constructor & Destructor Documentation

◆ NonBlockingGame() [1/2]

bridges.games.NonBlockingGame.NonBlockingGame ( int  assignmentID,
String  login,
String  apikey,
int  rows,
int  cols 
)

Construct a NonBlockingGame object. It is expected students will never directly construct a NonBlockingGame object but rather derive from it.

The created grid can not be larger than 1024 cells in total (e.g., 32x32, or 2x512 are ok).

Parameters
assignmentIDbridges assignment ID
loginlogin on the bridges server
apikeyapikey of the account specified in login
rowsnumber of rows in the game
colsnumber of columns in the game

◆ NonBlockingGame() [2/2]

bridges.games.NonBlockingGame.NonBlockingGame ( int  assignmentID,
String  login,
String  apikey,
int  rows,
int  cols,
boolean  deb 
)

Member Function Documentation

◆ getFrameRate()

double bridges.games.NonBlockingGame.getFrameRate ( )
protected

What frame rate is the game running at?

Returns
the target framerate. The game could be somewhat slower depending on how computationally expensive the gameloop is and on the speed of the network.

◆ keyA()

boolean bridges.games.NonBlockingGame.keyA ( )
protected

Is the A key currently pressed?

Returns
true if "a" is pressed?

◆ keyAFire()

boolean bridges.games.NonBlockingGame.keyAFire ( )
protected

indicates whether the current frame is a fire frame for the A key.

◆ keyAJustNotPressed()

boolean bridges.games.NonBlockingGame.keyAJustNotPressed ( )
protected

indicates whether the A key has been just released in this frame

◆ keyAJustPressed()

boolean bridges.games.NonBlockingGame.keyAJustPressed ( )
protected

indicates whether the A key has just been pressed this current frame.

◆ keyASetupFire()

void bridges.games.NonBlockingGame.keyASetupFire ( int  f)
protected
Parameters
fhow many frames between two fire events

◆ keyAStillNotPressed()

boolean bridges.games.NonBlockingGame.keyAStillNotPressed ( )
protected

indicates whether the A key not pressed and has not been pressed for more than a frame

◆ keyAStillPressed()

boolean bridges.games.NonBlockingGame.keyAStillPressed ( )
protected

indicates whether the A key is still being pressed in this frame.

◆ keyD()

boolean bridges.games.NonBlockingGame.keyD ( )
protected

Is the D key currently pressed?

Returns
true if "d" is pressed

◆ keyDFire()

boolean bridges.games.NonBlockingGame.keyDFire ( )
protected

indicates whether the current frame is a fire frame for the D key.

◆ keyDJustNotPressed()

boolean bridges.games.NonBlockingGame.keyDJustNotPressed ( )
protected

indicates whether the D key has been just released in this frame

◆ keyDJustPressed()

boolean bridges.games.NonBlockingGame.keyDJustPressed ( )
protected

indicates whether the D key has just been pressed this current frame.

◆ keyDown()

boolean bridges.games.NonBlockingGame.keyDown ( )
protected

Is the DownArrow key currently pressed?

Returns
true if "down" is pressed

◆ keyDownFire()

boolean bridges.games.NonBlockingGame.keyDownFire ( )
protected

indicates whether the current frame is a fire frame for the Down key.

◆ keyDownJustNotPressed()

boolean bridges.games.NonBlockingGame.keyDownJustNotPressed ( )
protected

indicates whether the Down key has been just released in this frame

◆ keyDownJustPressed()

boolean bridges.games.NonBlockingGame.keyDownJustPressed ( )
protected

indicates whether the Down key has just been pressed this current frame.

◆ keyDownSetupFire()

void bridges.games.NonBlockingGame.keyDownSetupFire ( int  f)
protected
Parameters
fhow many frames between two fire events

◆ keyDownStillNotPressed()

boolean bridges.games.NonBlockingGame.keyDownStillNotPressed ( )
protected

indicates whether the Down key not pressed and has not been pressed for more than a frame

◆ keyDownStillPressed()

boolean bridges.games.NonBlockingGame.keyDownStillPressed ( )
protected

indicates whether the Down key is still being pressed in this frame.

◆ keyDSetupFire()

void bridges.games.NonBlockingGame.keyDSetupFire ( int  f)
protected
Parameters
fhow many frames between two fire events

◆ keyDStillNotPressed()

boolean bridges.games.NonBlockingGame.keyDStillNotPressed ( )
protected

indicates whether the D key not pressed and has not been pressed for more than a frame

◆ keyDStillPressed()

boolean bridges.games.NonBlockingGame.keyDStillPressed ( )
protected

indicates whether the D key is still being pressed in this frame.

◆ keyLeft()

boolean bridges.games.NonBlockingGame.keyLeft ( )
protected

Is the LeftArrow key currently pressed?

Returns
true if "left" is pressed

◆ keyLeftFire()

boolean bridges.games.NonBlockingGame.keyLeftFire ( )
protected

indicates whether the current frame is a fire frame for the Left key.

◆ keyLeftJustNotPressed()

boolean bridges.games.NonBlockingGame.keyLeftJustNotPressed ( )
protected

indicates whether the Left key has been just released in this frame

◆ keyLeftJustPressed()

boolean bridges.games.NonBlockingGame.keyLeftJustPressed ( )
protected

indicates whether the Left key has just been pressed this current frame.

◆ keyLeftSetupFire()

void bridges.games.NonBlockingGame.keyLeftSetupFire ( int  f)
protected
Parameters
fhow many frames between two fire events

◆ keyLeftStillNotPressed()

boolean bridges.games.NonBlockingGame.keyLeftStillNotPressed ( )
protected

indicates whether the Left key not pressed and has not been pressed for more than a frame

◆ keyLeftStillPressed()

boolean bridges.games.NonBlockingGame.keyLeftStillPressed ( )
protected

indicates whether the Left key is still being pressed in this frame.

◆ keyQ()

boolean bridges.games.NonBlockingGame.keyQ ( )
protected

Is the Q key currently pressed?

Returns
true if "q" is pressed

◆ keyQFire()

boolean bridges.games.NonBlockingGame.keyQFire ( )
protected

indicates whether the current frame is a fire frame for the Q key.

◆ keyQJustNotPressed()

boolean bridges.games.NonBlockingGame.keyQJustNotPressed ( )
protected

indicates whether the Q key has been just released in this frame

◆ keyQJustPressed()

boolean bridges.games.NonBlockingGame.keyQJustPressed ( )
protected

indicates whether the Q key has just been pressed this current frame.

◆ keyQSetupFire()

void bridges.games.NonBlockingGame.keyQSetupFire ( int  f)
protected
Parameters
fhow many frames between two fire events

◆ keyQStillNotPressed()

boolean bridges.games.NonBlockingGame.keyQStillNotPressed ( )
protected

indicates whether the Q key not pressed and has not been pressed for more than a frame

◆ keyQStillPressed()

boolean bridges.games.NonBlockingGame.keyQStillPressed ( )
protected

indicates whether the Q key is still being pressed in this frame.

◆ keyRight()

boolean bridges.games.NonBlockingGame.keyRight ( )
protected

Is the RightArrow key currently pressed?

Returns
true if "right" is pressed

◆ keyRightFire()

boolean bridges.games.NonBlockingGame.keyRightFire ( )
protected

indicates whether the current frame is a fire frame for the Right key.

◆ keyRightJustNotPressed()

boolean bridges.games.NonBlockingGame.keyRightJustNotPressed ( )
protected

indicates whether the Right key has been just released in this frame

◆ keyRightJustPressed()

boolean bridges.games.NonBlockingGame.keyRightJustPressed ( )
protected

indicates whether the Right key has just been pressed this current frame.

◆ keyRightSetupFire()

void bridges.games.NonBlockingGame.keyRightSetupFire ( int  f)
protected
Parameters
fhow many frames between two fire events

◆ keyRightStillNotPressed()

boolean bridges.games.NonBlockingGame.keyRightStillNotPressed ( )
protected

indicates whether the Right key not pressed and has not been pressed for more than a frame

◆ keyRightStillPressed()

boolean bridges.games.NonBlockingGame.keyRightStillPressed ( )
protected

indicates whether the Right key is still being pressed in this frame.

◆ keyS()

boolean bridges.games.NonBlockingGame.keyS ( )
protected

Is the S key currently pressed?

Returns
true if "s" is pressed

◆ keySFire()

boolean bridges.games.NonBlockingGame.keySFire ( )
protected

indicates whether the current frame is a fire frame for the S key.

◆ keySJustNotPressed()

boolean bridges.games.NonBlockingGame.keySJustNotPressed ( )
protected

indicates whether the S key has been just released in this frame

◆ keySJustPressed()

boolean bridges.games.NonBlockingGame.keySJustPressed ( )
protected

indicates whether the S key has just been pressed this current frame.

◆ keySpace()

boolean bridges.games.NonBlockingGame.keySpace ( )
protected

Is the SpaceBar key currently pressed?

Returns
true if SpaceBar is pressed

◆ keySpaceFire()

boolean bridges.games.NonBlockingGame.keySpaceFire ( )
protected

indicates whether the current frame is a fire frame for the Space key.

◆ keySpaceJustNotPressed()

boolean bridges.games.NonBlockingGame.keySpaceJustNotPressed ( )
protected

indicates whether the Space key has been just released in this frame

◆ keySpaceJustPressed()

boolean bridges.games.NonBlockingGame.keySpaceJustPressed ( )
protected

indicates whether the Space key has just been pressed this current frame.

◆ keySpaceSetupFire()

void bridges.games.NonBlockingGame.keySpaceSetupFire ( int  f)
protected
Parameters
fhow many frames between two fire events

◆ keySpaceStillNotPressed()

boolean bridges.games.NonBlockingGame.keySpaceStillNotPressed ( )
protected

indicates whether the Space key not pressed and has not been pressed for more than a frame

◆ keySpaceStillPressed()

boolean bridges.games.NonBlockingGame.keySpaceStillPressed ( )
protected

indicates whether the Space key is still being pressed in this frame.

◆ keySSetupFire()

void bridges.games.NonBlockingGame.keySSetupFire ( int  f)
protected
Parameters
fhow many frames between two fire events

◆ keySStillNotPressed()

boolean bridges.games.NonBlockingGame.keySStillNotPressed ( )
protected

indicates whether the S key not pressed and has not been pressed for more than a frame

◆ keySStillPressed()

boolean bridges.games.NonBlockingGame.keySStillPressed ( )
protected

indicates whether the S key is still being pressed in this frame.

◆ keyUp()

boolean bridges.games.NonBlockingGame.keyUp ( )
protected

Is the UpArrow key currently pressed?

Returns
true if "up" is pressed

◆ keyUpFire()

boolean bridges.games.NonBlockingGame.keyUpFire ( )
protected

indicates whether the current frame is a fire frame for the Up key.

◆ keyUpJustNotPressed()

boolean bridges.games.NonBlockingGame.keyUpJustNotPressed ( )
protected

indicates whether the Up key has been just released in this frame

◆ keyUpJustPressed()

boolean bridges.games.NonBlockingGame.keyUpJustPressed ( )
protected

indicates whether the Up key has just been pressed this current frame.

◆ keyUpSetupFire()

void bridges.games.NonBlockingGame.keyUpSetupFire ( int  f)
protected
Parameters
fhow many frames between two fire events

◆ keyUpStillNotPressed()

boolean bridges.games.NonBlockingGame.keyUpStillNotPressed ( )
protected

indicates whether the Up key not pressed and has not been pressed for more than a frame

◆ keyUpStillPressed()

boolean bridges.games.NonBlockingGame.keyUpStillPressed ( )
protected

indicates whether the Up key is still being pressed in this frame.

◆ keyW()

boolean bridges.games.NonBlockingGame.keyW ( )
protected

Is the W key currently pressed?

Returns
true if "w" is pressed

◆ keyWFire()

boolean bridges.games.NonBlockingGame.keyWFire ( )
protected

indicates whether the current frame is a fire frame for the W key.

◆ keyWJustNotPressed()

boolean bridges.games.NonBlockingGame.keyWJustNotPressed ( )
protected

indicates whether the W key has been just released in this frame

◆ keyWJustPressed()

boolean bridges.games.NonBlockingGame.keyWJustPressed ( )
protected

indicates whether the W key has just been pressed this current frame.

◆ keyWSetupFire()

void bridges.games.NonBlockingGame.keyWSetupFire ( int  f)
protected
Parameters
fhow many frames between two fire events

◆ keyWStillNotPressed()

boolean bridges.games.NonBlockingGame.keyWStillNotPressed ( )
protected

indicates whether the W key not pressed and has not been pressed for more than a frame

◆ keyWStillPressed()

boolean bridges.games.NonBlockingGame.keyWStillPressed ( )
protected

indicates whether the W key is still being pressed in this frame.

◆ setFrameRate()

void bridges.games.NonBlockingGame.setFrameRate ( double  fps)
protected

change the frame rate is the game running at

The fps is caps at 30 fps and can't drop below 1 fps

◆ start()

void bridges.games.NonBlockingGame.start ( )

Call this function to start the game engine.

Reimplemented from bridges.games.GameBase.


The documentation for this class was generated from the following file: