working port from C++ to Lua with very basic shader and geometry functionality in place
This commit is contained in:
parent
0d2138c9f2
commit
3471196830
8 changed files with 154 additions and 20 deletions
|
@ -12,7 +12,8 @@ namespace pw {
|
|||
class window {
|
||||
public:
|
||||
|
||||
typedef std::function<void(window&)> on_update_t;
|
||||
using on_update_t = std::function<void(window&)> ;
|
||||
using on_resize_t = std::function<void(window&)> ;
|
||||
|
||||
window();
|
||||
~window();
|
||||
|
@ -34,6 +35,7 @@ public:
|
|||
void set_fullscreen(bool use_fullscreen);
|
||||
|
||||
void set_on_update(on_update_t f) { _on_update = f; }
|
||||
void set_on_resize(on_resize_t f) { _on_resize = f; }
|
||||
|
||||
bool visible() const;
|
||||
void set_visible(bool is_visible);
|
||||
|
@ -43,6 +45,7 @@ protected:
|
|||
std::unique_ptr<impl> _impl;
|
||||
|
||||
on_update_t _on_update;
|
||||
on_resize_t _on_resize;
|
||||
|
||||
|
||||
};
|
||||
|
|
|
@ -104,13 +104,14 @@ struct window::impl {
|
|||
static void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
{
|
||||
window::impl* impl = static_cast<window::impl*>(glfwGetWindowUserPointer(window));
|
||||
impl->_parent._on_resize(impl->_parent);
|
||||
|
||||
debug::d() << "window::frame_buffer_size_callback " << width << "x" << height;
|
||||
// debug::d() << "window::frame_buffer_size_callback " << width << "x" << height;
|
||||
|
||||
// impl->on_resize(width,height);
|
||||
|
||||
// std::cout << "framebuffer " << width << "x" << height << std::endl;
|
||||
// glViewport(0, 0, width, height);
|
||||
// glViewport(0, 0, width, height);
|
||||
}
|
||||
|
||||
void update_display_list()
|
||||
|
@ -190,7 +191,7 @@ struct window::impl {
|
|||
|
||||
glfwSetWindowUserPointer(_window,this);
|
||||
|
||||
//glfwSetFramebufferSizeCallback(_window, window::impl::framebuffer_size_callback);
|
||||
glfwSetFramebufferSizeCallback(_window, window::impl::framebuffer_size_callback);
|
||||
glfwSetKeyCallback(_window, window::impl::key_callback);
|
||||
// glfwSetCharCallback(_window, character_callback);
|
||||
glfwSetCharModsCallback(_window, charmods_callback);
|
||||
|
@ -314,6 +315,7 @@ struct window::impl {
|
|||
window::window()
|
||||
: _impl(std::make_unique<window::impl>(*this))
|
||||
, _on_update([](window&){})
|
||||
, _on_resize([](window&){})
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue