Initial commit

This commit is contained in:
Stefan Stefanov 2023-10-20 17:14:46 +03:00 committed by GitHub
commit fce29361f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 59905 additions and 0 deletions

View file

@ -0,0 +1,27 @@
#pragma once
#include "glad.h"
#include "glfw3.h"
#include "imgui.h"
#include "imgui_impl_glfw.h"
#include "imgui_impl_opengl3.h"
#include <string>
class BaseWindow {
public:
int windowWidth, windowHeight;
std::string windowTitle;
GLFWwindow* windowHandle;
public:
BaseWindow();
BaseWindow(int width, int height, std::string title);
int Run();
protected:
virtual void Initialize() = 0;
virtual void LoadContent() = 0;
virtual void Update() = 0;
virtual void Render() = 0;
virtual void Unload() = 0;
};

View file

@ -0,0 +1,11 @@
#include "display/base_window.hpp"
class GameWindow : public BaseWindow {
public:
GameWindow(int width, int height, std::string title) : BaseWindow(width, height, title) {};
void Initialize();
void LoadContent();
void Update();
void Render();
void Unload();
};

View file

@ -0,0 +1,25 @@
#pragma once
#include "glad.h"
#include "glfw3.h"
#include <string>
#include <iostream>
class Shader {
public:
unsigned int programID;
std::string vertexFile;
std::string fragmentFile;
long fragmentModTimeOnLoad;
Shader();
void Unload();
void ReloadFromFile();
static Shader LoadShader(std::string fileVertexShader, std::string fileFragmentShader);
private:
static bool CompileShader(unsigned int shaderId, char(&infoLog)[512]);
static bool LinkProgram(unsigned int programID, char(&infoLog)[512]);
};

12
include/utils/utility.hpp Normal file
View file

@ -0,0 +1,12 @@
#pragma once
#include <string>
#include <iostream>
#include <fstream>
#include <ctime>
#include <sys/types.h>
#include <sys/stat.h>
#include <cerrno>
using namespace std;
bool ReadFile(std::string file, std::string& fileContents, bool addLineTerminator = false);
long GetFileModTime(std::string file);