Bridges-C++  3.4.2
Bridges(C++ API)
Public Member Functions | Protected Member Functions | List of all members
bridges::game::NonBlockingGame Class Reference

#include <NonBlockingGame.h>

Inheritance diagram for bridges::game::NonBlockingGame:
bridges::game::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:

using namespace bridges::game;
struct my_game : public NonBlockingGame {
my_game() : NonBlockingGame (1, "myuserid", "myapikey") {}
virtual void initialize() override { }
virtual void GameLoop() override { }
};
int main () {
my_game g;
g.start();
}
virtual void initialize()=0
This function is called once when the game starts.
NonBlockingGame(int assignmentID, std::string username, std::string apikey, int nbRow=10, int nbCol=10)
Definition: NonBlockingGame.h:247
Definition: Bridges.h:20

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 3 parameters to the constructor of NonBlockingGame(). These three parameters are the classic parameters that the constructor of bridges::Bridges takes (e.g., assignmentID, username, apikey).

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:

virtual void initialize() override {
setBGColor(0, 0, NamedColor.lightsalmon);
drawSymbol(0, 0, NamedSymbol.sword, NamedColor.blue);
}
void drawSymbol(int row, int col, NamedSymbol symb, NamedColor nc)
Draw an object on the game.
Definition: GameBase.h:137
void setBGColor(int row, int col, NamedColor nc)
Change the background color of a cell.
Definition: GameBase.h:127
NamedSymbol
Definition: GameGrid.h:164
NamedColor
Definition: GameGrid.h:14

Note that the size of the board is set by default 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 passing additional parameters to the NonBlockingGame constructor. However, the game 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:

my_game() : NonBlockingGame (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.

virtual void gameLoop() override {
setBGColor(rand()%10, rand()%10, NamedColor.lightsalmon);
}
virtual void gameLoop()=0
This function is called once per frame of the game.

There are three ways for your game to take input.

The gameLoop can 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 indicates 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.

virtual void gameLoop() override {
if (keyUp())
setBGColor(rand()%10, rand()%10, NamedColor.lightsalmon);
}
bool keyUp()
Is Up currently pressed?
Definition: NonBlockingGame.h:388

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:

virtual void initialize() override {
}
virtual void gameLoop() override {
if (keyUpFire()) //will only be true once every 20 frames
setBGColor(rand()%10, rand()%10, NamedColor.lightsalmon);
}
bool keyUpFire()
indicates whether the current frame is a fire frame for the Up key.
Definition: NonBlockingGame.h:413
void keyUpSetupFire(int f)
configures how many frames between two fire events for the Up key.
Definition: NonBlockingGame.h:420

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);
}
bool keyUpStillPressed()
indicates whether the Up key is still being pressed this current frame.
Definition: NonBlockingGame.h:398
bool keyUpJustNotPressed()
indicates whether the Up key has just been released this current frame.
Definition: NonBlockingGame.h:403
bool keyUpJustPressed()
indicates whether the Up key has just been pressed this current frame.
Definition: NonBlockingGame.h:393
bool keyUpStillNotPressed()
indicates whether the Up key is not pressed and has not been pressed for more than a frame.
Definition: NonBlockingGame.h:408
See also
There is a tutorial at: https://bridgesuncc.github.io/tutorials/NonBlockingGame.html
Author
Erik Saule
Date
7/21/2019, 12/28/2020, 1/11/2023

Public Member Functions

 NonBlockingGame (int assignmentID, std::string username, std::string apikey, int nbRow=10, int nbCol=10)
 
virtual ~NonBlockingGame ()=default
 
void start ()
 Call this function from main to start the game. Runs exactly once. More...
 

Protected Member Functions

double getFrameRate () const
 What frame rate is the game running at? More...
 
bool keyLeft ()
 Is Left currently pressed? More...
 
bool keyLeftJustPressed ()
 indicates whether the Left key has just been pressed this current frame. More...
 
bool keyLeftStillPressed ()
 indicates whether the Left key is still being pressed this current frame. More...
 
bool keyLeftJustNotPressed ()
 indicates whether the Left key has just been released this current frame. More...
 
bool keyLeftStillNotPressed ()
 indicates whether the Left key is not pressed and has not been pressed for more than a frame. More...
 
bool keyLeftFire ()
 indicates whether the current frame is a fire frame for the Left key. More...
 
void keyLeftSetupFire (int f)
 configures how many frames between two fire events for the Left key. More...
 
bool keyRight ()
 Is Right currently pressed? More...
 
bool keyRightJustPressed ()
 indicates whether the right key has just been pressed this current frame. More...
 
bool keyRightStillPressed ()
 indicates whether the Right key is still being pressed this current frame. More...
 
bool keyRightJustNotPressed ()
 indicates whether the Right key has just been released this current frame. More...
 
bool keyRightStillNotPressed ()
 indicates whether the Right key is not pressed and has not been pressed for more than a frame. More...
 
bool keyRightFire ()
 indicates whether the current frame is a fire frame for the Right key. More...
 
void keyRightSetupFire (int f)
 configures how many frames between two fire events for the Right key. More...
 
bool keyUp ()
 Is Up currently pressed? More...
 
bool keyUpJustPressed ()
 indicates whether the Up key has just been pressed this current frame. More...
 
bool keyUpStillPressed ()
 indicates whether the Up key is still being pressed this current frame. More...
 
bool keyUpJustNotPressed ()
 indicates whether the Up key has just been released this current frame. More...
 
bool keyUpStillNotPressed ()
 indicates whether the Up key is not pressed and has not been pressed for more than a frame. More...
 
bool keyUpFire ()
 indicates whether the current frame is a fire frame for the Up key. More...
 
void keyUpSetupFire (int f)
 configures how many frames between two fire events for the Up key. More...
 
bool keyDown ()
 Is Down currently pressed? More...
 
bool keyDownJustPressed ()
 indicates whether the Down key has just been pressed this current frame. More...
 
bool keyDownStillPressed ()
 indicates whether the Down key is still being pressed this current frame. More...
 
bool keyDownJustNotPressed ()
 indicates whether the Down key has just been released this current frame. More...
 
bool keyDownStillNotPressed ()
 indicates whether the Down key is not pressed and has not been pressed for more than a frame. More...
 
bool keyDownFire ()
 indicates whether the current frame is a fire frame for the Down key. More...
 
void keyDownSetupFire (int f)
 configures how many frames between two fire events for the Down key. More...
 
bool keyW ()
 Is W currently pressed? More...
 
bool keyWJustPressed ()
 indicates whether the W key has just been pressed this current frame. More...
 
bool keyWStillPressed ()
 indicates whether the W key is still being pressed this current frame. More...
 
bool keyWJustNotPressed ()
 indicates whether the W key has just been released this current frame. More...
 
bool keyWStillNotPressed ()
 indicates whether the W key is not pressed and has not been pressed for more than a frame. More...
 
bool keyWFire ()
 indicates whether the current frame is a fire frame for the W key. More...
 
void keyWSetupFire (int f)
 configures how many frames between two fire events for the W key. More...
 
bool keyA ()
 Is A currently pressed? More...
 
bool keyAJustPressed ()
 indicates whether the A key has just been pressed this current frame. More...
 
bool keyAStillPressed ()
 indicates whether the A key is still being pressed this current frame. More...
 
bool keyAJustNotPressed ()
 indicates whether the A key has just been released this current frame. More...
 
bool keyAStillNotPressed ()
 indicates whether the A key is not pressed and has not been pressed for more than a frame. More...
 
bool keyAFire ()
 indicates whether the current frame is a fire frame for the A key. More...
 
void keyASetupFire (int f)
 configures how many frames between two fire events for the A key. More...
 
bool keyS ()
 Is S currently pressed? More...
 
bool keySJustPressed ()
 indicates whether the S key has just been pressed this current frame. More...
 
bool keySStillPressed ()
 indicates whether the S key is still being pressed this current frame. More...
 
bool keySJustNotPressed ()
 indicates whether the S key has just been released this current frame. More...
 
bool keySStillNotPressed ()
 indicates whether the S key is not pressed and has not been pressed for more than a frame. More...
 
bool keySFire ()
 indicates whether the current frame is a fire frame for the S key. More...
 
void keySSetupFire (int f)
 configures how many frames between two fire events for the S key. More...
 
bool keyD ()
 Is D currently pressed? More...
 
bool keyDJustPressed ()
 indicates whether the D key has just been pressed this current frame. More...
 
bool keyDStillPressed ()
 indicates whether the D key is still being pressed this current frame. More...
 
bool keyDJustNotPressed ()
 indicates whether the D key has just been released this current frame. More...
 
bool keyDStillNotPressed ()
 indicates whether the D key is not pressed and has not been pressed for more than a frame. More...
 
bool keyDFire ()
 indicates whether the current frame is a fire frame for the D key. More...
 
void keyDSetupFire (int f)
 configures how many frames between two fire events for the D key. More...
 
bool keyQ ()
 Is Q currently pressed? More...
 
bool keyQJustPressed ()
 indicates whether the Q key has just been pressed this current frame. More...
 
bool keyQStillPressed ()
 indicates whether the Q key is still being pressed this current frame. More...
 
bool keyQJustNotPressed ()
 indicates whether the Q key has just been released this current frame. More...
 
bool keyQStillNotPressed ()
 indicates whether the Q key is not pressed and has not been pressed for more than a frame. More...
 
bool keyQFire ()
 indicates whether the current frame is a fire frame for the Q key. More...
 
void keyQSetupFire (int f)
 configures how many frames between two fire events for the Q key. More...
 
bool keySpace ()
 Is Space currently pressed? More...
 
bool keySpaceJustPressed ()
 indicates whether the Space key has just been pressed this current frame. More...
 
bool keySpaceStillPressed ()
 indicates whether the Space key is still being pressed this current frame. More...
 
bool keySpaceJustNotPressed ()
 indicates whether the Space key has just been released this current frame. More...
 
bool keySpaceStillNotPressed ()
 indicates whether the Space key is not pressed and has not been pressed for more than a frame. More...
 
bool keySpaceFire ()
 indicates whether the current frame is a fire frame for the Space key. More...
 
void keySpaceSetupFire (int f)
 configures how many frames between two fire events for the Space key. More...
 
- Protected Member Functions inherited from bridges::game::GameBase
 GameBase (int assignmentID, std::string username, std::string apikey, int nbRow=10, int nbColumn=10)
 Protected constructed prevens direct creation. More...
 
virtual ~GameBase ()=default
 
virtual void initialize ()=0
 This function is called once when the game starts. More...
 
virtual void gameLoop ()=0
 This function is called once per frame of the game. More...
 
void registerKeyListener (KeypressListener *p)
 register a new KeypressListener More...
 
void render ()
 Renders the game. More...
 
bool gameover () const
 
void quit ()
 calling this function causes the game to end. More...
 
void setBGColor (int row, int col, NamedColor nc)
 Change the background color of a cell. More...
 
void drawSymbol (int row, int col, NamedSymbol symb, NamedColor nc)
 Draw an object on the game. More...
 
void setTitle (std::string title)
 Set the title of the game. More...
 
void setDescription (std::string desc)
 Set a short description of the game. 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...
 
int getBoardWidth ()
 How wide is the Game Board? More...
 
int getBoardHeight ()
 How tall is the Game Board? More...
 

Additional Inherited Members

- Protected Attributes inherited from bridges::game::GameBase
bool debug = false
 

Constructor & Destructor Documentation

◆ NonBlockingGame()

bridges::game::NonBlockingGame::NonBlockingGame ( int  assignmentID,
std::string  username,
std::string  apikey,
int  nbRow = 10,
int  nbCol = 10 
)
inline

constructor

Parameters
assignmentIDBridges assignment id
usernameBridges user name
apikeyBridges API authentication key
nbRowGameGrid height
nbColGameGrid width

◆ ~NonBlockingGame()

virtual bridges::game::NonBlockingGame::~NonBlockingGame ( )
virtualdefault

Member Function Documentation

◆ getFrameRate()

double bridges::game::NonBlockingGame::getFrameRate ( ) const
inlineprotected

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()

bool bridges::game::NonBlockingGame::keyA ( )
inlineprotected

Is A currently pressed?

Returns
true if A is currently pressed

◆ keyAFire()

bool bridges::game::NonBlockingGame::keyAFire ( )
inlineprotected

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

◆ keyAJustNotPressed()

bool bridges::game::NonBlockingGame::keyAJustNotPressed ( )
inlineprotected

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

◆ keyAJustPressed()

bool bridges::game::NonBlockingGame::keyAJustPressed ( )
inlineprotected

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

◆ keyASetupFire()

void bridges::game::NonBlockingGame::keyASetupFire ( int  f)
inlineprotected

configures how many frames between two fire events for the A key.

Parameters
fhow many frames between two fire events

◆ keyAStillNotPressed()

bool bridges::game::NonBlockingGame::keyAStillNotPressed ( )
inlineprotected

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

◆ keyAStillPressed()

bool bridges::game::NonBlockingGame::keyAStillPressed ( )
inlineprotected

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

◆ keyD()

bool bridges::game::NonBlockingGame::keyD ( )
inlineprotected

Is D currently pressed?

Returns
true if D is currently pressed

◆ keyDFire()

bool bridges::game::NonBlockingGame::keyDFire ( )
inlineprotected

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

◆ keyDJustNotPressed()

bool bridges::game::NonBlockingGame::keyDJustNotPressed ( )
inlineprotected

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

◆ keyDJustPressed()

bool bridges::game::NonBlockingGame::keyDJustPressed ( )
inlineprotected

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

◆ keyDown()

bool bridges::game::NonBlockingGame::keyDown ( )
inlineprotected

Is Down currently pressed?

Returns
true if Down is currently pressed

◆ keyDownFire()

bool bridges::game::NonBlockingGame::keyDownFire ( )
inlineprotected

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

◆ keyDownJustNotPressed()

bool bridges::game::NonBlockingGame::keyDownJustNotPressed ( )
inlineprotected

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

◆ keyDownJustPressed()

bool bridges::game::NonBlockingGame::keyDownJustPressed ( )
inlineprotected

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

◆ keyDownSetupFire()

void bridges::game::NonBlockingGame::keyDownSetupFire ( int  f)
inlineprotected

configures how many frames between two fire events for the Down key.

Parameters
fhow many frames between two fire events

◆ keyDownStillNotPressed()

bool bridges::game::NonBlockingGame::keyDownStillNotPressed ( )
inlineprotected

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

◆ keyDownStillPressed()

bool bridges::game::NonBlockingGame::keyDownStillPressed ( )
inlineprotected

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

◆ keyDSetupFire()

void bridges::game::NonBlockingGame::keyDSetupFire ( int  f)
inlineprotected

configures how many frames between two fire events for the D key.

Parameters
fhow many frames between two fire events

◆ keyDStillNotPressed()

bool bridges::game::NonBlockingGame::keyDStillNotPressed ( )
inlineprotected

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

◆ keyDStillPressed()

bool bridges::game::NonBlockingGame::keyDStillPressed ( )
inlineprotected

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

◆ keyLeft()

bool bridges::game::NonBlockingGame::keyLeft ( )
inlineprotected

Is Left currently pressed?

Returns
true if Left is currently pressed

◆ keyLeftFire()

bool bridges::game::NonBlockingGame::keyLeftFire ( )
inlineprotected

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

◆ keyLeftJustNotPressed()

bool bridges::game::NonBlockingGame::keyLeftJustNotPressed ( )
inlineprotected

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

◆ keyLeftJustPressed()

bool bridges::game::NonBlockingGame::keyLeftJustPressed ( )
inlineprotected

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

◆ keyLeftSetupFire()

void bridges::game::NonBlockingGame::keyLeftSetupFire ( int  f)
inlineprotected

configures how many frames between two fire events for the Left key.

Parameters
fhow many frames between two fire events

◆ keyLeftStillNotPressed()

bool bridges::game::NonBlockingGame::keyLeftStillNotPressed ( )
inlineprotected

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

◆ keyLeftStillPressed()

bool bridges::game::NonBlockingGame::keyLeftStillPressed ( )
inlineprotected

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

◆ keyQ()

bool bridges::game::NonBlockingGame::keyQ ( )
inlineprotected

Is Q currently pressed?

Returns
true if S is currently pressed

◆ keyQFire()

bool bridges::game::NonBlockingGame::keyQFire ( )
inlineprotected

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

◆ keyQJustNotPressed()

bool bridges::game::NonBlockingGame::keyQJustNotPressed ( )
inlineprotected

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

◆ keyQJustPressed()

bool bridges::game::NonBlockingGame::keyQJustPressed ( )
inlineprotected

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

◆ keyQSetupFire()

void bridges::game::NonBlockingGame::keyQSetupFire ( int  f)
inlineprotected

configures how many frames between two fire events for the Q key.

Parameters
fhow many frames between two fire events

◆ keyQStillNotPressed()

bool bridges::game::NonBlockingGame::keyQStillNotPressed ( )
inlineprotected

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

◆ keyQStillPressed()

bool bridges::game::NonBlockingGame::keyQStillPressed ( )
inlineprotected

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

◆ keyRight()

bool bridges::game::NonBlockingGame::keyRight ( )
inlineprotected

Is Right currently pressed?

Returns
true if Right is currently pressed

◆ keyRightFire()

bool bridges::game::NonBlockingGame::keyRightFire ( )
inlineprotected

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

◆ keyRightJustNotPressed()

bool bridges::game::NonBlockingGame::keyRightJustNotPressed ( )
inlineprotected

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

◆ keyRightJustPressed()

bool bridges::game::NonBlockingGame::keyRightJustPressed ( )
inlineprotected

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

◆ keyRightSetupFire()

void bridges::game::NonBlockingGame::keyRightSetupFire ( int  f)
inlineprotected

configures how many frames between two fire events for the Right key.

Parameters
fhow many frames between two fire events

◆ keyRightStillNotPressed()

bool bridges::game::NonBlockingGame::keyRightStillNotPressed ( )
inlineprotected

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

◆ keyRightStillPressed()

bool bridges::game::NonBlockingGame::keyRightStillPressed ( )
inlineprotected

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

◆ keyS()

bool bridges::game::NonBlockingGame::keyS ( )
inlineprotected

Is S currently pressed?

Returns
true if S is currently pressed

◆ keySFire()

bool bridges::game::NonBlockingGame::keySFire ( )
inlineprotected

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

◆ keySJustNotPressed()

bool bridges::game::NonBlockingGame::keySJustNotPressed ( )
inlineprotected

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

◆ keySJustPressed()

bool bridges::game::NonBlockingGame::keySJustPressed ( )
inlineprotected

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

◆ keySpace()

bool bridges::game::NonBlockingGame::keySpace ( )
inlineprotected

Is Space currently pressed?

Returns
true if Space is currently pressed

◆ keySpaceFire()

bool bridges::game::NonBlockingGame::keySpaceFire ( )
inlineprotected

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

◆ keySpaceJustNotPressed()

bool bridges::game::NonBlockingGame::keySpaceJustNotPressed ( )
inlineprotected

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

◆ keySpaceJustPressed()

bool bridges::game::NonBlockingGame::keySpaceJustPressed ( )
inlineprotected

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

◆ keySpaceSetupFire()

void bridges::game::NonBlockingGame::keySpaceSetupFire ( int  f)
inlineprotected

configures how many frames between two fire events for the Space key.

Parameters
fhow many frames between two fire events

◆ keySpaceStillNotPressed()

bool bridges::game::NonBlockingGame::keySpaceStillNotPressed ( )
inlineprotected

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

◆ keySpaceStillPressed()

bool bridges::game::NonBlockingGame::keySpaceStillPressed ( )
inlineprotected

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

◆ keySSetupFire()

void bridges::game::NonBlockingGame::keySSetupFire ( int  f)
inlineprotected

configures how many frames between two fire events for the S key.

Parameters
fhow many frames between two fire events

◆ keySStillNotPressed()

bool bridges::game::NonBlockingGame::keySStillNotPressed ( )
inlineprotected

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

◆ keySStillPressed()

bool bridges::game::NonBlockingGame::keySStillPressed ( )
inlineprotected

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

◆ keyUp()

bool bridges::game::NonBlockingGame::keyUp ( )
inlineprotected

Is Up currently pressed?

Returns
true if Up is currently pressed

◆ keyUpFire()

bool bridges::game::NonBlockingGame::keyUpFire ( )
inlineprotected

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

◆ keyUpJustNotPressed()

bool bridges::game::NonBlockingGame::keyUpJustNotPressed ( )
inlineprotected

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

◆ keyUpJustPressed()

bool bridges::game::NonBlockingGame::keyUpJustPressed ( )
inlineprotected

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

◆ keyUpSetupFire()

void bridges::game::NonBlockingGame::keyUpSetupFire ( int  f)
inlineprotected

configures how many frames between two fire events for the Up key.

Parameters
fhow many frames between two fire events

◆ keyUpStillNotPressed()

bool bridges::game::NonBlockingGame::keyUpStillNotPressed ( )
inlineprotected

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

◆ keyUpStillPressed()

bool bridges::game::NonBlockingGame::keyUpStillPressed ( )
inlineprotected

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

◆ keyW()

bool bridges::game::NonBlockingGame::keyW ( )
inlineprotected

Is W currently pressed?

Returns
true if W is currently pressed

◆ keyWFire()

bool bridges::game::NonBlockingGame::keyWFire ( )
inlineprotected

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

◆ keyWJustNotPressed()

bool bridges::game::NonBlockingGame::keyWJustNotPressed ( )
inlineprotected

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

◆ keyWJustPressed()

bool bridges::game::NonBlockingGame::keyWJustPressed ( )
inlineprotected

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

◆ keyWSetupFire()

void bridges::game::NonBlockingGame::keyWSetupFire ( int  f)
inlineprotected

configures how many frames between two fire events for the W key.

Parameters
fhow many frames between two fire events

◆ keyWStillNotPressed()

bool bridges::game::NonBlockingGame::keyWStillNotPressed ( )
inlineprotected

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

◆ keyWStillPressed()

bool bridges::game::NonBlockingGame::keyWStillPressed ( )
inlineprotected

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

◆ start()

void bridges::game::NonBlockingGame::start ( )
inline

Call this function from main to start the game. Runs exactly once.


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