now uses cmake

This commit is contained in:
MitchellHansen
2016-11-25 21:37:26 -08:00
parent fc11ebfafb
commit 394e98baa7
20 changed files with 416 additions and 280 deletions

78
App.h Normal file
View File

@@ -0,0 +1,78 @@
#pragma once
#include <SFML/Graphics.hpp>
#include "Map.h"
#include "Explorer.h"
// 2d heap allocated array structure stolen off of stackOverflow
template<typename T, int width, int height>
class MultiArray {
private:
typedef T cols[height];
cols * data;
public:
T& operator() (int x, int y) { return data[x][y]; }
MultiArray() { data = new cols[width]; }
~MultiArray() { delete[] data; }
};
class App {
public:
// Constants
static const int WINDOW_HEIGHT = 766;
static const int WINDOW_WIDTH = 1596;
const double PI = 3.141592653589793238462643383279;
App();
~App();
// Start the app
void Run();
private:
// Map and its data
Map map;
// The explorer that will traverse the map
Explorer* explorer;
// Art assets
sf::Texture* background_texture;
sf::Sprite backgroundSprite;
// Data required for hand drawing pixels
sf::Uint8* _pixelArray;
sf::Sprite pixel_array_sprite;
sf::Texture pixel_array_texture;
void Init();
void Input();
void Update(double step_size);
void Render();
// The main render window, probably should think about supporting multiple of these
sf::RenderWindow* window;
// The events for the event handler
sf::Event event;
// ============= Loop data ==================
float time();
// Size of the physics steps to take
float step_size = 0.005f;
double current_time = 0.0;
double frame_time = 0.0;
double instant_fps = 0.0;
double accumulator_time = 0.0;
int render_frame_count = 0;
double render_fps = 0;
int physics_frame_count = 0;
double physics_fps = 0;
double elapsed_time = 0;
double delta_time = 0;
};