Game of Ur 0.3.3
This is a computer adaptation of Game of Ur, written in C++ mainly using SDL and OpenGL.
Loading...
Searching...
No Matches
UrPlayerControls Class Reference

The definition for the object that acts as the interface between the game controller and any systems or objects interested in interacting with it. More...

#include <ur_controller.hpp>

Public Member Functions

PlayerID getPlayer () const
 Gets the ID of the player associated with this object.
 
void attemptLaunchPiece (PieceTypeID pieceType, glm::u8vec2 launchLocation=glm::u8vec2{0, 0})
 Attempts to launch a game piece to some location on the game board.
 
void attemptMoveBoardPiece (PieceIdentity piece)
 Attempts to move a piece already on the board to a new location based on the current dice roll.
 
void attemptNextTurn ()
 Attempts to end the current turn and begin the next one.
 
void attemptDiceRoll ()
 Attempts to roll the dice.
 
const GameOfUrModelgetModel ()
 Gets a constant reference to the underlying data model used by UrController.
 

Private Member Functions

 UrPlayerControls (PlayerID player, UrController &urController)
 Constructs a new UrPlayerControls object.
 

Static Private Member Functions

static std::unique_ptr< UrPlayerControlscreate (PlayerID player, UrController &urController)
 Creates an instance of UrPlayerControls.
 

Private Attributes

PlayerID mPlayer
 The ID of the player to whom these controls belong.
 
UrControllermUrController
 The reference to the game controller connected with these controls.
 

Friends

class UrController
 

Detailed Description

The definition for the object that acts as the interface between the game controller and any systems or objects interested in interacting with it.

Contains methods for prompting updates in the state of the game data model managed by the controller. Each instance of this represents a single player playing the game.

Constructor & Destructor Documentation

◆ UrPlayerControls()

UrPlayerControls::UrPlayerControls ( PlayerID player,
UrController & urController )
inlineprivate

Constructs a new UrPlayerControls object.

Parameters
playerThe player to whom these controls belong.
urControllerThe reference to the game controller connected with these controls.

Member Function Documentation

◆ attemptLaunchPiece()

void UrPlayerControls::attemptLaunchPiece ( PieceTypeID pieceType,
glm::u8vec2 launchLocation = glm::u8vec2{0,0} )

Attempts to launch a game piece to some location on the game board.

Parameters
pieceTypeThe type of piece being launched.
launchLocationThe location on the board to which the piece is being launched.

◆ attemptMoveBoardPiece()

void UrPlayerControls::attemptMoveBoardPiece ( PieceIdentity piece)

Attempts to move a piece already on the board to a new location based on the current dice roll.

Parameters
pieceThe type of piece being moved.

◆ create()

static std::unique_ptr< UrPlayerControls > UrPlayerControls::create ( PlayerID player,
UrController & urController )
inlinestaticprivate

Creates an instance of UrPlayerControls.

Parameters
playerThe player to whom these controls belong.
urControllerThe reference to the game controller connected with these controls.
Returns
std::unique_ptr<UrPlayerControls> The newly created instance.

◆ getModel()

const GameOfUrModel & UrPlayerControls::getModel ( )
inline

Gets a constant reference to the underlying data model used by UrController.

Returns
const GameOfUrModel& A constant reference to the underlying game data model.

◆ getPlayer()

PlayerID UrPlayerControls::getPlayer ( ) const
inline

Gets the ID of the player associated with this object.

Returns
PlayerID The player using this object.

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