mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-04-21 17:27:25 +09:00
Add checkbox, scale more sizes by window scale
This commit is contained in:
@@ -19,11 +19,13 @@ namespace gsr {
|
||||
void draw(mgl::Window &window, mgl::vec2f offset) override;
|
||||
|
||||
mgl::vec2f get_size() override;
|
||||
void set_border_scale(float scale);
|
||||
|
||||
std::function<void()> on_click;
|
||||
private:
|
||||
mgl::vec2f size;
|
||||
mgl::Color bg_color;
|
||||
mgl::Text text;
|
||||
float border_scale = 0.0015f;
|
||||
};
|
||||
}
|
||||
28
include/gui/CheckBox.hpp
Normal file
28
include/gui/CheckBox.hpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "Widget.hpp"
|
||||
#include <functional>
|
||||
|
||||
#include <mglpp/graphics/Color.hpp>
|
||||
#include <mglpp/graphics/Text.hpp>
|
||||
|
||||
namespace gsr {
|
||||
class CheckBox : public Widget {
|
||||
public:
|
||||
CheckBox(mgl::Font *font, const char *text);
|
||||
CheckBox(const CheckBox&) = delete;
|
||||
CheckBox& operator=(const CheckBox&) = delete;
|
||||
|
||||
bool on_event(mgl::Event &event, mgl::Window &window, mgl::vec2f offset) override;
|
||||
void draw(mgl::Window &window, mgl::vec2f offset) override;
|
||||
|
||||
mgl::vec2f get_size() override;
|
||||
|
||||
std::function<void()> on_click;
|
||||
private:
|
||||
mgl::vec2f get_checkbox_size();
|
||||
private:
|
||||
mgl::Text text;
|
||||
bool checked = false;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user