Archimedes/Dash Da Capo!
Loading...
Searching...
No Matches
Public Member Functions | List of all members
CharacterInMap Class Reference

Game-specific class for the character representation in map. More...

#include <CharacterInMap.h>

Inheritance diagram for CharacterInMap:
BaseSingleTexture

Public Member Functions

 CharacterInMap (int mainVelocity, int velocityX, int velocityY, SDL_Rect collisionBox)
 
bool isMoveValid (std::string direction, std::map< std::pair< int, int >, TileType > &coordinateToTileTypeMap)
 helper function to check if the user move was valid
 
void updateEvent (std::string &nextMapEvent, bool &boxOpen, std::pair< int, int > coordinates, std::map< std::pair< int, int >, std::string > &coordinateToEventTypeMap)
 Helper function that updates the next map event.
 
void onInput (SDL_Event &event, std::string &nextMapEvent, bool &boxOpen, int &STATE_characterDirection, std::map< std::pair< int, int >, TileType > &coordinateToTileTypeMap, std::map< std::pair< int, int >, std::string > &coordinateToEventTypeMap)
 defines the movement for the character in the map
 
void move (int xBoundary, int yBoundary)
 Updates the character state in the map.
 
void centerScreen (SDL_Rect &camera, int xBoundary, int yBoundary)
 
void render (SDL_Renderer *renderer, const SDL_Rect &camera, TextureWrapper &characterTexture)
 renders the texture
 
- Public Member Functions inherited from BaseSingleTexture
 BaseSingleTexture (int mainVelocity, int velocityX, int velocityY, SDL_Rect collisionBox)
 
virtual void onInput (SDL_Event &event)
 processes user input
 
virtual void move (int xBoundary, int yBoundary)=0
 updates the textures position
 
virtual void centerScreen (SDL_Rect &camera)
 if there is a camera, will center it on the texture
 
virtual void render (SDL_Renderer *renderer, const SDL_Rect &camera, TextureWrapper &debugControllerTexture)=0
 renders the texture
 
SDL_Rect getCollisionBox () const
 returns the collisionBox
 

Detailed Description

Game-specific class for the character representation in map.

Member Function Documentation

◆ isMoveValid()

bool CharacterInMap::isMoveValid ( std::string  direction,
std::map< std::pair< int, int >, TileType > &  coordinateToTileTypeMap 
)

helper function to check if the user move was valid

Parameters
direction
coordinateToTileTypeMap
Returns

◆ move()

void CharacterInMap::move ( int  xBoundary,
int  yBoundary 
)
virtual

Updates the character state in the map.

Parameters
xBoundary
yBoundary

Implements BaseSingleTexture.

◆ onInput()

void CharacterInMap::onInput ( SDL_Event &  event,
std::string &  nextMapEvent,
bool &  boxOpen,
int &  STATE_characterDirection,
std::map< std::pair< int, int >, TileType > &  coordinateToTileTypeMap,
std::map< std::pair< int, int >, std::string > &  coordinateToEventTypeMap 
)

defines the movement for the character in the map

Parameters
event
nextMapEvent
boxOpen
coordinateToTileTypeMap
coordinateToEventTypeMap

◆ render()

void CharacterInMap::render ( SDL_Renderer *  renderer,
const SDL_Rect &  camera,
TextureWrapper debugControllerTexture 
)
virtual

renders the texture

Parameters
renderer
camera
debugControllerTexture

Implements BaseSingleTexture.

◆ updateEvent()

void CharacterInMap::updateEvent ( std::string &  nextMapEvent,
bool &  boxOpen,
std::pair< int, int >  coordinates,
std::map< std::pair< int, int >, std::string > &  coordinateToEventTypeMap 
)

Helper function that updates the next map event.

Parameters
nextMapEventstring holding the state of the nextMapEvent
boxOpenchecks if event box is already open
coordinatesmap coordinates
coordinateToEventTypeMapcoordinate-to-event map

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