Game class. Updates and draws all ships and bullets. Culls dead bullets and ships.
More...
#include <Game.hpp>
|
void | wrap (sf::ConvexShape *cs) |
| Wraps a passed convexShape to the opposite side of game bounds. More...
|
|
void | playerDeath () |
| Resets behaviours dependant on player existing. More...
|
|
void | clearLists () |
| Clears the game of entities. More...
|
|
void | reset () |
| Resets the game. More...
|
|
void | addBoidSwarm (sf::Vector2f const &pos, float amount, float radius) |
| Adds a swarm of [amount] boids in circle around [pos] with [radius]. More...
|
|
void | handleEvents () |
| Polls the RenderWindow for events and handles these events accordingly. More...
|
|
void | update () |
| Calls Update on all bullets and ships. More...
|
|
void | draw () |
| Draws all bullets and ships. Also draws the backdrop_ of stars. More...
|
|
Game class. Updates and draws all ships and bullets. Culls dead bullets and ships.
Game::Game |
( |
sf::RenderWindow & |
window, |
|
|
unsigned int |
timePerTick = 16U |
|
) |
| |
void Game::addBoidSwarm |
( |
sf::Vector2f const & |
pos, |
|
|
float |
amount, |
|
|
float |
radius |
|
) |
| |
|
private |
Adds a swarm of [amount] boids in circle around [pos] with [radius].
void Game::clearLists |
( |
| ) |
|
|
private |
Clears the game of entities.
Draws all bullets and ships. Also draws the backdrop_ of stars.
void Game::handleEvents |
( |
| ) |
|
|
private |
Polls the RenderWindow for events and handles these events accordingly.
void Game::playerDeath |
( |
| ) |
|
|
private |
Resets behaviours dependant on player existing.
Resets the game.
Game setup variables
Implements the main game loop. While window_ is open: Calls handleEvents(), Implements a fixed timestep and calls update() and draw() inside it.
Calls Update on all bullets and ships.
void Game::wrap |
( |
sf::ConvexShape * |
cs | ) |
|
|
private |
Wraps a passed convexShape to the opposite side of game bounds.
sf::SoundBuffer Game::backSBuffer_ |
|
private |
sf::Sound Game::backSound_ |
|
private |
The background music forthe game.
std::list<Bullet*> Game::bullets_ |
|
private |
Camera that follows ships and has a HUD.
Used to check for collision between shapes.
For taking input from an Xbox controller.
sf::SoundBuffer Game::erasedSBuffer_ |
|
private |
Buffers for the sounds in the game.
sf::Sound Game::erasedSound_ |
|
private |
Sounds that the game will play.
std::function<void(Bullet*)> Game::fireBulletCallback_ |
|
private |
Adds a bullet to the bulletList_. Given to ships so that they can fire bullets.
sf::FloatRect Game::gameBounds_ |
|
private |
sf::SoundBuffer Game::mineSBuffer_ |
|
private |
sf::Sound Game::mineSound_ |
|
private |
thor::ParticleSystem Game::particleSystem_ |
|
private |
sf::Texture Game::particleTexture_ |
|
private |
Texture for all particles.
std::list<Pickup*> Game::pickups_ |
|
private |
sf::SoundBuffer Game::planSBuffer_ |
|
private |
sf::Sound Game::planSound_ |
|
private |
std::list<Ship*> Game::ships_ |
|
private |
std::function<void(Ship*)> Game::spawnShipCallback_ |
|
private |
Adds a ship to the shipList_. Given to Motherships so that they can spawn other ships.
std::chrono::steady_clock Game::tickClock_ |
|
private |
std::chrono::time_point<std::chrono::system_clock> Game::timeOfLastTick_ |
|
private |
Time at which the last update/draw tick occurred.
std::chrono::milliseconds Game::timePerTick_ |
|
private |
Milliseconds per update/draw tick.
sf::RenderWindow& Game::window_ |
|
private |
Window that everything will be drawn to.
The documentation for this class was generated from the following files: