Initial commit, showing ui above target window

This commit is contained in:
dec05eba
2022-03-30 16:16:51 +02:00
parent 44b986c762
commit 889efe51b2
14 changed files with 398 additions and 73 deletions

16
include/gui/Button.hpp Normal file
View File

@@ -0,0 +1,16 @@
#pragma once
#include "Widget.hpp"
#include <string>
namespace gsr {
class Button : public Widget {
public:
Button(mgl::vec2f size);
void on_event(mgl::Event &event, mgl::Window &window) override;
void draw(mgl::Window &window) override;
private:
mgl::vec2f size;
bool mouse_inside = false;
};
}

21
include/gui/Widget.hpp Normal file
View File

@@ -0,0 +1,21 @@
#pragma once
#include <mglpp/system/vec.hpp>
namespace mgl {
class Event;
class Window;
}
namespace gsr {
class Widget {
public:
virtual ~Widget() = default;
virtual void on_event(mgl::Event &event, mgl::Window &window) = 0;
virtual void draw(mgl::Window &window) = 0;
virtual void set_position(mgl::vec2f position);
protected:
mgl::vec2f position;
};
}