1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-15 06:52:34 +02:00

Initial log framework and timekeeping

This commit is contained in:
Daniel Evans 2013-07-02 11:48:01 +01:00
parent 71850ad847
commit 37f4e58a02
4 changed files with 44 additions and 2 deletions

View File

@ -2,7 +2,7 @@
#include <renderwure/loaders/LoaderIPL.hpp>
GTAEngine::GTAEngine(const std::string& path)
: gameData(path)
: gameData(path), gameTime(0.f)
{
}
@ -14,6 +14,16 @@ bool GTAEngine::load()
return true;
}
void GTAEngine::logInfo(const std::string& info)
{
log.push({LogEntry::Info, gameTime, info});
}
void GTAEngine::logError(const std::string& error)
{
log.push({LogEntry::Error, gameTime, error});
}
bool GTAEngine::loadItems(const std::string& name)
{
auto i = gameData.iplLocations.find(name);

View File

@ -55,7 +55,7 @@ GLuint compileShader(GLenum type, const char *source)
GTARenderer::GTARenderer()
: camera()
{
{
GLuint vertexShader = compileShader(GL_VERTEX_SHADER, vertexShaderSource);
GLuint fragmentShader = compileShader(GL_FRAGMENT_SHADER, fragmentShaderSource);
GLuint worldProgram = glCreateProgram();

View File

@ -9,6 +9,7 @@
#include <glm/glm.hpp>
#include <vector>
#include <queue>
/**
* @class GTAEngine
@ -25,6 +26,31 @@ public:
*/
bool load();
struct LogEntry
{
enum Type {
Info,
Error,
Warning
};
Type type;
float time;
std::string message;
};
std::queue<LogEntry> log;
/**
* Displays an informative message
*/
void logInfo(const std::string& info);
/**
* Displays an alarming error
*/
void logError(const std::string& error);
/**
* Loads an IPL into the game.
* @param name The name of the IPL as it appears in the games' gta.dat
@ -36,6 +62,11 @@ public:
*/
glm::vec3 itemCentroid;
/**
* Game Clock
*/
float gameTime;
/**
* Game data
*/

View File

@ -11,6 +11,7 @@
#include <SFML/Graphics.hpp>
#include <memory>
#include <sstream>
constexpr int WIDTH = 800,
HEIGHT = 600;