Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Commits on Source (2)
......@@ -12,6 +12,7 @@
#include "logger.h"
#include "entity-manager.h"
#include "game-state.h"
#include "scene.h"
#include "asset.h"
#include "save-manager.h"
......@@ -43,6 +44,7 @@ class GameEngine
void handleInput();
private:
SaveManager _saveManager;
GameState _state = Uninitialised;
size_t _frame = 0;
std::time_t _frametime = 0;
EntityManager _entityManager;
......
#ifndef __GAME_STATE__H__
#define __GAME_STATE__H__
enum GameState
{
Uninitialised,
......@@ -6,3 +8,5 @@ enum GameState
Active,
Exit
};
#endif // __GAME_STATE__H__
\ No newline at end of file
......@@ -15,6 +15,7 @@ void GameEngine::init()
{
this->isRunning = false;
this->_currScene = "";
this->_state = Initialise;
// this->_saveManager.list();
}
void GameEngine::changeScene( std::string label, Scene* scene )
......
......@@ -3,54 +3,15 @@
#ifndef __TEST_RUNNER__
int main( int argc, char* argv[] ) {
// const uint16_t SCREEN_HEIGHT = 600;
// const uint16_t SCREEN_WIDTH = 800;
// GameState state = Uninitialised;
// Initialise
Logger& logger = Logger::instance();
// SaveManager saveManager;
// state = Initialise;
// ConfigParser userSettings = ConfigParser::UserSettings();
// EntityManager entityManager;
// Seed the random number generator
srand(static_cast<unsigned int>(time(nullptr)));
// std::vector< Entity* > entities;
// Genrate a Random chunk
// WorldHex2D map( 5 );
//Chunk* chunk = new Chunk( 0, 0, 0);
//std::cout << chunk.getString() << std::endl;
// Chunk* chunk = map.getMidChunk();
// std::cout << chunk->getString() << std::endl;
// map.showChunk( 0, 0, 0 );
// map.moveInto( -2, 1, 1 );
// map.moveInto( -3, 2, 1 );
// map.moveInto( 5, -2, -3 )->visualise();
// map.visualise();
// Menu Loop
// List Saves
// saveManager.list();
GameEngine* game = new GameEngine();
game->run();
// userSettings.set( "exit", "teset" );
// std::cout << userSettings;
// Clean-up
// while( entities.size() > 0 )
// {
// Entity* entity = entities.back();
// entities.pop_back();
// delete entity;
// }
delete game;
// Return
......
......@@ -29,6 +29,17 @@ TEST_CASE( "Testing Operator Comparisons" ) {
CHECK( d.x == 4 );
CHECK( d.y == 400 );
}
SUBCASE( "Scale Multiplication" )
{
Vec2 c = a * scale_a;
CHECK( c.x == 100 );
CHECK( c.y == 500 );
Vec2 d = a * scale_b;
CHECK( d.x == 0.5 );
CHECK( d.y == 2.5 );
}
SUBCASE( "Division" )
{
Vec2 c = a / b;
......@@ -51,4 +62,15 @@ TEST_CASE( "Testing Operator Comparisons" ) {
CHECK( c.x == 0.0 );
CHECK( c.y == 0.0 );
}
SUBCASE( "Scale Division" )
{
Vec2 c = a / scale_a;
CHECK( c.x == ( 1 / scale_a ) );
CHECK( c.y == ( 5 / scale_a ) );
Vec2 d = a / scale_b;
CHECK( d.x == ( 1 / scale_b ) );
CHECK( d.y == ( 5 / scale_b ) );
}
}
\ No newline at end of file