Wolf3D
Public Member Functions | List of all members
Weapon Class Reference
Inheritance diagram for Weapon:
Pistol

Public Member Functions

 Weapon ()
 Construct the Weapon object.
 
int get_magazine ()
 Get the Weapon's magazine. More...
 
void set_magazine (int value)
 Set the Weapon's magazine. More...
 
int get_capacity ()
 Get the Weapon's capacity (clip) More...
 
void set_capacity (int value)
 Set the Weapon's capacity (clip) More...
 
void set_weapon_specifications (std::vector< SDL_Texture * > texture, int fire_frame=3, int fire_cooldown=0.75, int max_fire_distance=6)
 Set the Weapon's specifications. More...
 
void set_audio (Sample *sample)
 Set the Weapon's fire sound effect. More...
 
void fire (double *position_x, double *position_y, double *direction_x, double *direction_y, double *plane_x, double *plane_y, std::vector< std::vector< int >> *world_map, json *sprite, std::vector< Enemy * > *enemies, SDL_Haptic *haptic=NULL)
 Fire the Weapon. More...
 
void render (RenderWindow *window)
 Render the weapon to the renderer. More...
 

Member Function Documentation

◆ fire()

void Weapon::fire ( double *  position_x,
double *  position_y,
double *  direction_x,
double *  direction_y,
double *  plane_x,
double *  plane_y,
std::vector< std::vector< int >> *  world_map,
json *  sprite,
std::vector< Enemy * > *  enemies,
SDL_Haptic *  haptic = NULL 
)

Fire the Weapon.

Parameters
position_xThe Player's Position X
position_yThe Player's Position Y
direction_xThe Player's Direction X
direction_yThe Player's Direction Y
plane_xThe Camera's Plane X
plane_yThe Camera'S Plane Y
world_mapThe vector of the world map
spriteThe "vector" of sprites
enemiesThe vector of enemies
hapticThe controller's haptic feedback for when the Weapon fires

◆ get_capacity()

int Weapon::get_capacity ( )

Get the Weapon's capacity (clip)

Returns
int

◆ get_magazine()

int Weapon::get_magazine ( )

Get the Weapon's magazine.

Returns
int

◆ render()

void Weapon::render ( RenderWindow window)

Render the weapon to the renderer.

Parameters
windowRenderWindow Renderer to render too

◆ set_audio()

void Weapon::set_audio ( Sample sample)

Set the Weapon's fire sound effect.

Parameters
sampleSample for the Weapon's fire sound effect

◆ set_capacity()

void Weapon::set_capacity ( int  value)

Set the Weapon's capacity (clip)

Parameters
valueValue to set the Weapon's capacity (clip) to

◆ set_magazine()

void Weapon::set_magazine ( int  value)

Set the Weapon's magazine.

Parameters
valueValue to set the Weapon's magazine to

◆ set_weapon_specifications()

void Weapon::set_weapon_specifications ( std::vector< SDL_Texture * >  texture,
int  fire_frame = 3,
int  fire_cooldown = 0.75,
int  max_fire_distance = 6 
)

Set the Weapon's specifications.

Parameters
textureVector of the frames of the Weapon
fire_frameThe frame (0,1,2,..) of the texture of when the Weapon has "fired", example of when the muzzle flash is showing
fire_cooldownWeapon's fire cooldown in seconds before it can shoot again
max_fire_distanceThe Weapon's maximum fire range

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