Nano v1.0.0
Simulating Natural Selection
ss::pl::simulator::Simulator Class Reference

#include <simulator.h>

Inheritance diagram for ss::pl::simulator::Simulator:
Scene

Classes

struct  SummaryInfo
 

Public Member Functions

 Simulator (std::string sceneName, SceneManager &sceneManager)
 Constructor for the Simulation class. More...
 
virtual void Start ()
 Method which is called in the start of the Simulation page. More...
 
virtual void Update ()
 Method which is called every frame. More...
 
virtual void onExit ()
 Method which is called when we exit the program or the Simulation page. More...
 
virtual void loadAssets ()
 Method for loading all the needed assets in the Simulation page. More...
 
virtual void deleteAssets ()
 Method for deallocating the dynamically created assets. More...
 
- Public Member Functions inherited from Scene
 Scene (std::string sceneName)
 
virtual void Start ()=0
 
virtual void Update ()=0
 
virtual void onExit ()=0
 
virtual void loadAssets ()=0
 
virtual void deleteAssets ()=0
 

Private Types

enum class  SLECTED_TRAITS_MONITOR { SPEED , ENERGY }
 
enum class  SimulatorState { Setup , Simulation }
 

Private Member Functions

void drawSetup ()
 Method for drawing the setUp page before the actual simulation. More...
 
void drawSimulation ()
 Method for drawing the actual simulation. More...
 
void drawSummary ()
 Method for drawing summary screen at the end of the simulation. More...
 
void drawAdditionalMenu ()
 Method for drawing controls menu at simulation runtime. More...
 
void drawTraitsSwitch ()
 Function to draw the switch in the additionals menu. More...
 
void drawProgressBar ()
 Method for drawing the progress bar at the bottom of simuation. More...
 
void drawEntity (const ss::bll::simulation::Entity &entity)
 Method for drawing every entity at the simulation field. More...
 
void drawFood (const auto &food)
 Method for drawing every food on the simulation field. More...
 
void drawEntityThoughts (const ss::bll::simulation::Entity *entity)
 Function that draws the thoughts of a desired entity. More...
 
float animateProgress ()
 Method for animating the progress bar at the bottom of simuation. More...
 
SummaryInfo getSummaryData ()
 Method for getting the data for summary screen. More...
 
void checkInput ()
 This method creates checks for the mouse input during the actual simulation. More...
 
void handleEntityClick ()
 Method for handling the camera and collision for clickig on entity. More...
 
void resetCamera ()
 Method for reseting the camera to its initial position. More...
 

Private Attributes

SceneManagerm_sceneManager
 
ss::bll::simulation::Simulationsimulation
 
Vector2 mousePos
 
Vector2 planePos
 
Texture2D setupContainer_Texture
 
Texture2D backArrow_Texture
 
Texture2D simulateButton_Texture
 
Texture2D summary_Container
 
Texture2D exit_Button
 
Texture2D save_Data_Button
 
Texture2D checkmark
 
Texture2D dropDown_Arrow
 
Texture2D dropDown_Arrow_Selected
 
Texture2D entitySearchingFood
 
Texture2D entityGoingHome
 
Texture2D entityGoingTowardsFood
 
Texture2D entityShouldBreed
 
Camera3D camera {0}
 
Camera3D entityCamera {0}
 
Font fontInter
 
float graphsContainerPos
 
size_t cyclesCount
 
size_t worldSize
 
size_t entities
 
size_t food
 
float offset
 
float entityLookingDirRadian
 
float aminationProgress
 
bool simulating
 
size_t selectedEntityId
 
ss::bll::simulation::EntityselectedEntity
 
bool followingEntity
 
bool additionalMenuTriggered
 
float timeScale
 
int foodChange
 
int newFoodChange
 
bool shouldShowProgressBar
 
bool shouldShowTraits
 
enum ss::pl::simulator::Simulator::SLECTED_TRAITS_MONITOR selectedTraitsMonitor
 
enum ss::pl::simulator::Simulator::SimulatorState currentState = SimulatorState::Setup
 
struct ss::pl::simulator::Simulator::SummaryInfo summaryInfo
 
bool catchSummaryInfo
 
bool savedSimulationInfo
 
const std::array< std::string, 4 > entityThoughts = {"SearchingFood", "GoingFood", "GoingHome", "Idle"}
 

Additional Inherited Members

- Public Types inherited from Scene
enum class  ThemeTypes { LightTheme , DarkTheme }
 
- Public Attributes inherited from Scene
bool isSetUp = false
 
std::string m_sceneName
 
- Static Public Attributes inherited from Scene
static ThemeTypes currentTheme = ThemeTypes::LightTheme
 
static const std::array< std::string, 2 > themePaths = {"lightTheme", "darkTheme"}
 
static const std::array< Color, 2 > backgroundColors {{{239, 239, 239, 255}, {5, 11, 30, 255}}}
 

Member Enumeration Documentation

◆ SimulatorState

Enumerator
Setup 
Simulation 

◆ SLECTED_TRAITS_MONITOR

Enumerator
SPEED 
ENERGY 

Constructor & Destructor Documentation

◆ Simulator()

ss::pl::simulator::Simulator::Simulator ( std::string  sceneName,
SceneManager sceneManager 
)

Constructor for the Simulation class.

Parameters
sceneNameThe name of the current scene. Which here is "Simulation".
sceneManagerA reference to already existing SceneManager object to control the program flow.

Member Function Documentation

◆ animateProgress()

float ss::pl::simulator::Simulator::animateProgress ( )
private

Method for animating the progress bar at the bottom of simuation.

Returns
current progress bar's position along the X axis.

◆ checkInput()

void ss::pl::simulator::Simulator::checkInput ( )
private

This method creates checks for the mouse input during the actual simulation.

Used to determine and act on mouse clicks.

◆ deleteAssets()

void ss::pl::simulator::Simulator::deleteAssets ( )
virtual

Method for deallocating the dynamically created assets.

Implements Scene.

◆ drawAdditionalMenu()

void ss::pl::simulator::Simulator::drawAdditionalMenu ( )
private

Method for drawing controls menu at simulation runtime.

◆ drawEntity()

void ss::pl::simulator::Simulator::drawEntity ( const ss::bll::simulation::Entity entity)
private

Method for drawing every entity at the simulation field.

Parameters
entityReference to the entity that should be drawn.

◆ drawEntityThoughts()

void ss::pl::simulator::Simulator::drawEntityThoughts ( const ss::bll::simulation::Entity entity)
private

Function that draws the thoughts of a desired entity.

Parameters
entityReference to the desired entity

◆ drawFood()

void ss::pl::simulator::Simulator::drawFood ( const auto &  food)
private

Method for drawing every food on the simulation field.

Parameters
foodReference to the food that should be drawn.

◆ drawProgressBar()

void ss::pl::simulator::Simulator::drawProgressBar ( )
private

Method for drawing the progress bar at the bottom of simuation.

◆ drawSetup()

void ss::pl::simulator::Simulator::drawSetup ( )
private

Method for drawing the setUp page before the actual simulation.

◆ drawSimulation()

void ss::pl::simulator::Simulator::drawSimulation ( )
private

Method for drawing the actual simulation.

◆ drawSummary()

void ss::pl::simulator::Simulator::drawSummary ( )
private

Method for drawing summary screen at the end of the simulation.

◆ drawTraitsSwitch()

void ss::pl::simulator::Simulator::drawTraitsSwitch ( )
private

Function to draw the switch in the additionals menu.

◆ getSummaryData()

ss::pl::simulator::Simulator::SummaryInfo ss::pl::simulator::Simulator::getSummaryData ( )
private

Method for getting the data for summary screen.

Returns
Data for summary screen.

◆ handleEntityClick()

void ss::pl::simulator::Simulator::handleEntityClick ( )
private

Method for handling the camera and collision for clickig on entity.

◆ loadAssets()

void ss::pl::simulator::Simulator::loadAssets ( )
virtual

Method for loading all the needed assets in the Simulation page.

Implements Scene.

◆ onExit()

void ss::pl::simulator::Simulator::onExit ( )
virtual

Method which is called when we exit the program or the Simulation page.

It deallocates every dynamically created object in the class' instance.

Implements Scene.

◆ resetCamera()

void ss::pl::simulator::Simulator::resetCamera ( )
private

Method for reseting the camera to its initial position.

◆ Start()

void ss::pl::simulator::Simulator::Start ( )
virtual

Method which is called in the start of the Simulation page.

Used to set up variables, needed throughout the simulation.

Implements Scene.

◆ Update()

void ss::pl::simulator::Simulator::Update ( )
virtual

Method which is called every frame.

Main functionallity of the simulator is located here.

Implements Scene.

Member Data Documentation

◆ additionalMenuTriggered

bool ss::pl::simulator::Simulator::additionalMenuTriggered
private

◆ aminationProgress

float ss::pl::simulator::Simulator::aminationProgress
private

◆ backArrow_Texture

Texture2D ss::pl::simulator::Simulator::backArrow_Texture
private

◆ camera

Camera3D ss::pl::simulator::Simulator::camera {0}
private

◆ catchSummaryInfo

bool ss::pl::simulator::Simulator::catchSummaryInfo
private

◆ checkmark

Texture2D ss::pl::simulator::Simulator::checkmark
private

◆ currentState

enum ss::pl::simulator::Simulator::SimulatorState ss::pl::simulator::Simulator::currentState = SimulatorState::Setup
private

◆ cyclesCount

size_t ss::pl::simulator::Simulator::cyclesCount
private

◆ dropDown_Arrow

Texture2D ss::pl::simulator::Simulator::dropDown_Arrow
private

◆ dropDown_Arrow_Selected

Texture2D ss::pl::simulator::Simulator::dropDown_Arrow_Selected
private

◆ entities

size_t ss::pl::simulator::Simulator::entities
private

◆ entityCamera

Camera3D ss::pl::simulator::Simulator::entityCamera {0}
private

◆ entityGoingHome

Texture2D ss::pl::simulator::Simulator::entityGoingHome
private

◆ entityGoingTowardsFood

Texture2D ss::pl::simulator::Simulator::entityGoingTowardsFood
private

◆ entityLookingDirRadian

float ss::pl::simulator::Simulator::entityLookingDirRadian
private

◆ entitySearchingFood

Texture2D ss::pl::simulator::Simulator::entitySearchingFood
private

◆ entityShouldBreed

Texture2D ss::pl::simulator::Simulator::entityShouldBreed
private

◆ entityThoughts

const std::array<std::string, 4> ss::pl::simulator::Simulator::entityThoughts = {"SearchingFood", "GoingFood", "GoingHome", "Idle"}
private

◆ exit_Button

Texture2D ss::pl::simulator::Simulator::exit_Button
private

◆ followingEntity

bool ss::pl::simulator::Simulator::followingEntity
private

◆ fontInter

Font ss::pl::simulator::Simulator::fontInter
private

◆ food

size_t ss::pl::simulator::Simulator::food
private

◆ foodChange

int ss::pl::simulator::Simulator::foodChange
private

◆ graphsContainerPos

float ss::pl::simulator::Simulator::graphsContainerPos
private

◆ m_sceneManager

SceneManager& ss::pl::simulator::Simulator::m_sceneManager
private

◆ mousePos

Vector2 ss::pl::simulator::Simulator::mousePos
private

◆ newFoodChange

int ss::pl::simulator::Simulator::newFoodChange
private

◆ offset

float ss::pl::simulator::Simulator::offset
private

◆ planePos

Vector2 ss::pl::simulator::Simulator::planePos
private

◆ save_Data_Button

Texture2D ss::pl::simulator::Simulator::save_Data_Button
private

◆ savedSimulationInfo

bool ss::pl::simulator::Simulator::savedSimulationInfo
private

◆ selectedEntity

ss::bll::simulation::Entity* ss::pl::simulator::Simulator::selectedEntity
private

◆ selectedEntityId

size_t ss::pl::simulator::Simulator::selectedEntityId
private

◆ selectedTraitsMonitor

enum ss::pl::simulator::Simulator::SLECTED_TRAITS_MONITOR ss::pl::simulator::Simulator::selectedTraitsMonitor
private

◆ setupContainer_Texture

Texture2D ss::pl::simulator::Simulator::setupContainer_Texture
private

◆ shouldShowProgressBar

bool ss::pl::simulator::Simulator::shouldShowProgressBar
private

◆ shouldShowTraits

bool ss::pl::simulator::Simulator::shouldShowTraits
private

◆ simulateButton_Texture

Texture2D ss::pl::simulator::Simulator::simulateButton_Texture
private

◆ simulating

bool ss::pl::simulator::Simulator::simulating
private

◆ simulation

ss::bll::simulation::Simulation* ss::pl::simulator::Simulator::simulation
private

◆ summary_Container

Texture2D ss::pl::simulator::Simulator::summary_Container
private

◆ summaryInfo

struct ss::pl::simulator::Simulator::SummaryInfo ss::pl::simulator::Simulator::summaryInfo
private

◆ timeScale

float ss::pl::simulator::Simulator::timeScale
private

◆ worldSize

size_t ss::pl::simulator::Simulator::worldSize
private

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