Window(const char* name, int width, int height, bool fullScreen = false);
Window* window = CreateWindow("My Game", 1920, 1080);
Window* window = CreateWindow("My Game", 1920, 1080, true);
Returns a boolean depending on the state of the window. Example: returns false if the Window has closed.
bool IsClosed();
Window* window = CreateWindow("GG Engine", 1920, 1080);while (!window->IsClosed()) {// Do Something}
Clears the window ready for the next update.
void WindowClear();
Window* window = CreateWindow("GG Engine", 1920, 1080);while (!window->IsClosed()) {window->WindowClear();}
Updates the window with any new draw calls.
void WindowUpdate();
Window* window = CreateWindow("GG Engine", 1920, 1080);while (!window->IsClosed()) {window->WindowClear();window->WindowUpdate();}
Destroys the window appropriately after use.
void WindowDestroy();
Window* window = CreateWindow("GG Engine", 1920, 1080);while (!window->IsClosed()) {window->WindowClear();window->WindowUpdate();}window.WindowDestroy();Checks if the key is held down.
bool IsKeyHeldDown(unsigned int keycode);
if (window->IsKeyHeldDown(GLFW_KEY_SPACE)) {std::cout << "Space Bar Pressed" << std::endl;}Checks if the key is pressed, only returns once per key down action.
bool IsKeyDown(unsigned int keycode);
if (window->IsKeyDown(GLFW_KEY_SPACE)) {std::cout << "Space Bar Pressed" << std::endl;}Checks if the mouse button is held down.
bool IsMouseButtonHeldDown(unsigned int button);
if (window->IsMouseButtonHeldDown(GLFW_MOUSE_BUTTON_1)) {std::cout << "Left mouse button down" << std::endl;}Checks if the mouse button is held down, only returns once per mouse button down action.
bool IsMouseButtonDown(unsigned int button);
if (window->IsMouseButtonDown(GLFW_MOUSE_BUTTON_1)) {std::cout << "Left mouse button down" << std::endl;}Updates X and Y values passed in argument, with the current mouse position.
void GetMousePos(double& xpos, double& ypos);
double mouse_X, mouse_Y;window->GetMousePos(mouse_X, mouse_Y);std::cout << "X Pos: " << mouse_X << " Y Pos: " << mouse_Y << std::endl;Shader();Shader(const char* vertexPath, const char* fragmentPath);
Shader* s = new Shader();
Shader* s = new Shader(GGE_SHADER_BASIC_VERT, GGE_SHADER_BASIC_FRAG);
Choose appropriate method, depending on the uniform data type, that requires to be set.
void SetUniform1f(const GLchar* name, float value);void SetUniform2f(const GLchar* name, const maths::Vector2& vec2);void SetUniform3f(const GLchar* name, const maths::Vector3& vec3);void SetUniform4f(const GLchar* name, const maths::Vector4& vec4);
void SetUniform1fv(const GLchar* name, int count, float* value);void SetUniform1i(const GLchar* name, int value);void SetUniform1iv(const GLchar* name, int count, int* value);void SetUniformMatrix(const GLchar* name, const maths::Matrix& matrix);shader.SetUniform2f(GGE_SHADER_LIGHT_POS, Vector2(5.0f, 3.5f));The shader needs to be enabled, before setting a new uniform value and should be disabled afterwards.
void Enable() const;
void Disable() const;
Texture(const std::string filepath);Texture* image = new Texture("img/test.png");
Sprite(float x, float y, float width, float height, unsigned int colour);Sprite(float x, float y, float width, float height, Texture* texture);Sprite* sprite = new Sprite(0, 0, 2, 2, 0xffffffff);Texture* image = new Texture("img/test.png");Sprite* sprite = new Sprite(0, 0, 2, 2, image);
Container(Shader* shader);Container(Shader* shader, maths::Matrix projectionMatrix);Container(Renderer* renderer, Shader* shader, maths::Matrix projectionMatrix);
Shader* shader = new Shader();Container* bucket = new Container(shader);Shader* shader = new Shader();Container* bucket = new Container(shader, Matrix::orthographic(-16.0f, 16.0f, -9.0f, 9.0f, -1.0f, 1.0f));Shader* shader = new Shader();Container* bucket = new Container(new BatchRenderer(), shader, Matrix::orthographic(-16.0f, 16.0f, -9.0f, 9.0f, -1.0f, 1.0f));
Add a renderable object to the container array.
virtual void AddToContainer(Renderable* renderable);
Shader* shader = new Shader();Container* bucket = new Container(shader);Texture* image = new Texture("img/test.png");Sprite* sprite = new Sprite(0, 0, 2, 2, image);bucket->AddToContainer(sprite);
Each container that rendered, should call this method in the Render loop.
virtual void AddToContainer(Renderable* renderable);
void Example::Render() {bucket->RenderThisContainer();}