mirror of
https://github.com/rwengine/openrw.git
synced 2025-01-31 20:11:37 +01:00
Initial log framework and timekeeping
This commit is contained in:
parent
71850ad847
commit
37f4e58a02
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <SFML/Graphics.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
|
||||
constexpr int WIDTH = 800,
|
||||
HEIGHT = 600;
|
||||
|
Loading…
x
Reference in New Issue
Block a user