Skip to content

Instantly share code, notes, and snippets.

View terryjsmith's full-sized avatar

Terry Smith terryjsmith

View GitHub Profile
@terryjsmith
terryjsmith / error.h
Created September 28, 2014 19:57
Evolution Error class
enum {
ERROR_NONE,
ERROR_DEBUG,
ERROR_INFO,
ERROR_WARN,
ERROR_FATAL
};
class Error {
public:
@terryjsmith
terryjsmith / shaderloader.cpp
Created September 28, 2014 19:26
Evolution ShaderLoader implementation
ShaderLoader* ShaderLoader::GetInstance() {
if(!m_instance) {
m_instance = new ShaderLoader();
}
return((ShaderLoader*)m_instance);
}
int ShaderLoader::Load(char* shader) {
// Try to find the shader program in our resource cache first
@terryjsmith
terryjsmith / shaderloader.h
Created September 28, 2014 19:22
Evolution ShaderLoader class
class ShaderLoader : public Loader<int> {
public:
// Load the shaders (don't give the file extension)
int Load(char* shader);
public:
static ShaderLoader* GetInstance();
};
@terryjsmith
terryjsmith / loader.h
Created September 28, 2014 19:17
Loader base class
#include <string.h>
template<class T>
class Loader {
public:
Loader();
~Loader();
// Load a resource from a filename
T Find(char* filename);
@terryjsmith
terryjsmith / resource.h
Created September 28, 2014 19:12
Evolution Resource class
template<class T>
class Resource {
public:
Resource();
~Resource();
public:
char* filename;
T resource;
@terryjsmith
terryjsmith / main.cpp
Created September 28, 2014 00:40
Early main loop
/* INCLUDES */
#include <GLFW/glfw3.h>
#include <component.h>
#include <system.h>
#include <rendersystem.h>
/* GLOBAL VARIABLES */
@terryjsmith
terryjsmith / rendersystem.cpp
Last active August 29, 2015 14:06
RenderSystem Implementation
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
#include <glm/gtc/quaternion.hpp>
#include <error.h>
#include <component.h>
#include <system.h>
#include <rendersystem.h>
#include <renderable.h>
@terryjsmith
terryjsmith / rendersystem.h
Last active August 29, 2015 14:06
Evolution RenderSystem class
class RenderSystem : System {
public:
RenderSystem();
~RenderSystem();
// Initialize/shut down the render system
void Initialize();
void Shutdown();
// Our main update function
@terryjsmith
terryjsmith / renderable.h
Last active August 29, 2015 14:06
Evolution Renderable class
class Renderable : public Component {
public:
Renderable();
~Renderable();
public:
// Position in world space
glm::vec3 position;
// Local rotation
@terryjsmith
terryjsmith / gist:d9a3a610f0a9dd36ca51
Last active August 29, 2015 14:06
Entity GetComponent Example
Renderable* renderable = (Renderable*)entity->GetComponent<Renderable>();