added camera implementation and plenty of other rendering related stuff - splitted out the initialization of the render context
This commit is contained in:
parent
ae37273021
commit
f7043fc0cb
43 changed files with 23280 additions and 15161 deletions
|
@ -1,43 +0,0 @@
|
|||
#ifndef PW_WINDOW_HPP
|
||||
#define PW_WINDOW_HPP
|
||||
|
||||
//#include "glad/glad.h"
|
||||
#include "GLFW/glfw3.h"
|
||||
|
||||
//#include "sol.hpp"
|
||||
|
||||
namespace pw {
|
||||
|
||||
class window;
|
||||
|
||||
class context {
|
||||
GLFWwindow* _window;
|
||||
public:
|
||||
context(window& other);
|
||||
~context();
|
||||
};
|
||||
|
||||
|
||||
class window {
|
||||
|
||||
GLFWwindow* _window;
|
||||
|
||||
public:
|
||||
|
||||
window();
|
||||
~window();
|
||||
|
||||
bool update();
|
||||
|
||||
void set_title(const char* t);
|
||||
void set_size(int w, int h);
|
||||
|
||||
context* get_context();
|
||||
|
||||
// static void load(sol::table &ns);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,66 +0,0 @@
|
|||
#include "pw/ui/window.hpp"
|
||||
|
||||
//#include "glad/glad.h"
|
||||
|
||||
pw::window::window()
|
||||
{
|
||||
glfwInit();
|
||||
|
||||
_window = glfwCreateWindow(640, 480, "pixwerxs", nullptr, nullptr);
|
||||
|
||||
#if 0
|
||||
glfwMakeContextCurrent(_window);
|
||||
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
pw::window::~window() {
|
||||
|
||||
glfwDestroyWindow(_window);
|
||||
}
|
||||
|
||||
bool pw::window::update()
|
||||
{
|
||||
if (!glfwWindowShouldClose(_window)) {
|
||||
|
||||
// do other stuff
|
||||
#if 0
|
||||
glClearColor(1,0,0,1);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
#endif
|
||||
|
||||
glfwSwapBuffers(_window);
|
||||
glfwPollEvents();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void pw::window::set_title(const char *t)
|
||||
{
|
||||
glfwSetWindowTitle(_window,t);
|
||||
}
|
||||
|
||||
void pw::window::set_size(int w,int h) {
|
||||
glfwSetWindowSize(_window,w,h);
|
||||
}
|
||||
|
||||
std::pair<int,int> pw::window::get_size()
|
||||
{
|
||||
int x,y;
|
||||
glfwGetWindowSize(_window,&x,&y);
|
||||
return std::make_pair(x,y);
|
||||
}
|
||||
|
||||
//void pw::window::load(sol::table &ns)
|
||||
//{
|
||||
//
|
||||
|
||||
|
||||
//}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue