52 lines
1.3 KiB
C++
52 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <array>
|
|
#include <memory>
|
|
|
|
#include "uui/component.hpp"
|
|
#include "uui/opengl/graphic_context.hpp"
|
|
#include "uui/opengl/window.hpp"
|
|
#include "uui/types.hpp"
|
|
|
|
namespace uui
|
|
{
|
|
class GlContainer;
|
|
class GlFlex;
|
|
class GlStack;
|
|
class GlComponent: public std::enable_shared_from_this<GlComponent>, virtual public Component
|
|
{
|
|
friend class GlContainer;
|
|
friend class GlWindow;
|
|
friend class GlFlex;
|
|
friend class GlStack;
|
|
|
|
public:
|
|
virtual ~GlComponent();
|
|
|
|
void set_background_color(float r, float g, float b, float a = 1.0f) final;
|
|
|
|
protected:
|
|
std::shared_ptr<GlWindow> gl_window;
|
|
GLuint gl_vbo;
|
|
GLuint gl_vao;
|
|
GLuint gl_ebo;
|
|
|
|
GlComponent(
|
|
std::shared_ptr<GlWindow> window, std::size_t window_index, std::shared_ptr<GlContainer> parent,
|
|
std::size_t parent_index, const ComponentParams& params);
|
|
GlComponent(std::shared_ptr<GlWindow> window, std::size_t window_index, const ComponentParams& params):
|
|
GlComponent(window, window_index, nullptr, 0, params)
|
|
{}
|
|
GlComponent(const GlComponent&) = delete;
|
|
GlComponent(GlComponent&&) = default;
|
|
std::shared_ptr<GlComponent> getptr() { return shared_from_this(); }
|
|
|
|
virtual void render();
|
|
|
|
virtual void init();
|
|
virtual void set_vbo_data();
|
|
virtual void deinit();
|
|
virtual void on_resize();
|
|
};
|
|
|
|
} // namespace uui
|