Current State

This commit is contained in:
2024-11-25 17:51:41 -05:00
parent 0ffb750f82
commit 9b3bf93ea1
11 changed files with 22 additions and 51 deletions

View File

@@ -19,7 +19,6 @@ using J3ML::LinearAlgebra::Vector2;
namespace JUI
{
/// The ImageBase class is an object that handles managing and rendering a texture reference.
/// This class is used as a mixin on widgets that must render images. i.e. Image class
class ImageBase

View File

@@ -59,7 +59,7 @@ namespace JUI
GLint old_scissor_bounds[4];
bool clip_was_enabled;
// TODO: Re-enable clipping
/*if (clips_descendants) {
clip_was_enabled = glIsEnabled(GL_SCISSOR_TEST);
if (clip_was_enabled)

View File

@@ -65,7 +65,6 @@ namespace JUI
float interval = 0.1;
float current;
bool dragging;
// TODO: Later refactor scrubber into a RectBase class?
float scrubber_width = 20;
Color4 scrubber_color;
private:

View File

@@ -29,7 +29,6 @@ namespace JUI
using J3ML::LinearAlgebra::Vector2;
/// TODO: Scope out.
class DockingStation {};
/// A container widget class, with title bar and buttons,
@@ -117,10 +116,10 @@ namespace JUI
//bool resizing = false;
bool draggable = true;
bool dockable = false;
int titlebar_height = 16;
int titlebar_height = 20;
int title_font_size = 16;
Vector2 max_size;
Vector2 min_size; //= {30, 30};
UDim2 size_when_restart_began;
};
}

View File

@@ -99,8 +99,6 @@ JUI::Scene* CreateScene() {
//auto* left = new HorizontalListLayout();
//auto* btn = new TextButton(root);

View File

@@ -28,16 +28,16 @@ namespace JUI {
}
void RectBase::Draw(const Vector2 &abs_pos, const Vector2 &abs_size) {
// Background rect
J2D::Begin();
// Background rect
if (corner_rounding_radius > 0)
J2D::FillRoundedRect(bg_color, abs_pos, abs_size, corner_rounding_radius);
else
J2D::FillRect(bg_color, abs_pos, abs_size);
// Outline rect
// Outline rect - compute the size change to fit the border accurately.
Vector2 border_offset = {0, 0};
if (border_mode == BorderMode::Inset)
@@ -47,9 +47,7 @@ namespace JUI {
if (border_mode == BorderMode::Outline)
border_offset = {border_width/2.f, border_width/2.f};
// TODO: implement border_mode behavior when rendering here.
// Draw the outline.
if (border_width > 0)
{
if (corner_rounding_radius > 0)

View File

@@ -405,7 +405,6 @@ namespace JUI {
anchor_point = point;
}
// TODO: Implement Z-Index sorting in render routine.
int Widget::ZIndex() const { return zindex;}
void Widget::ZIndex(int new_zindex) { zindex = new_zindex; }

View File

@@ -4,9 +4,12 @@
namespace JUI
{
Button::Button(): Widget() {}
Button::Button(): Widget(), Clickable() {
BGColor(BaseBGColor());
BorderColor(BaseBorderColor());
}
Button::Button(Widget *parent): Clickable() {
Button::Button(Widget *parent): Button() {
this->Parent(parent);
};

View File

@@ -40,7 +40,6 @@ namespace JUI
consumed_height -= pad_bottom.Pixels;
}
}
}
void VerticalListLayout::LayoutOrder(LayoutOrder::V order) {

View File

@@ -34,7 +34,7 @@ namespace JUI {
GLint old_scissor_bounds[4];
bool clip_was_enabled;
// TODO: Re-enable clipping
if (clips_descendants) {
clip_was_enabled = glIsEnabled(GL_SCISSOR_TEST);
if (clip_was_enabled)

View File

@@ -14,26 +14,6 @@ namespace JUI
this->SetBorderWidth(2);
this->BorderMode(BorderMode::Middle);
//this->OnHoverEvent += [&] (Vector2 MousePos) {
//};
//this->OnExitEvent += [&] (Vector2 MousePos) {
// hovered;
//};
/*
this->OnClickEvent += [&] (Vector2 dummy, MouseButton btn) {
if (draggable && btn == MouseButton::Left) {
DEBUG("Window draggable")
SetDrag(true);
}
if (resizable && btn == MouseButton::Right)
DEBUG("Window resizable")
};
*/
// TODO: Move out of Event callback
this->OnReleaseEvent += [&] (Vector2 dummy, MouseButton btn, bool dummy3) {
if (dragging) {
@@ -56,7 +36,7 @@ namespace JUI
Topbar = new Rect(this);
Topbar->Position({0_px, 0_px});
Topbar->Size({100_percent, 20_px});
Topbar->Size({100_percent, UDim(titlebar_height, 0)});
Topbar->BGColor({92,92,192, 255});
Topbar->BorderColor({128, 128, 128, 0});
Topbar->SetBorderWidth(0);
@@ -64,7 +44,7 @@ namespace JUI
TitleLabel = new Text(Topbar);
TitleLabel->Center();
TitleLabel->SetContent(title);
TitleLabel->SetTextSize(titlebar_height);
TitleLabel->SetTextSize(title_font_size);
// TODO: auto* list = new HorizontalListLayout(Topbar);
@@ -79,24 +59,21 @@ namespace JUI
//exit_btn->SetHoverColor({255, 0, 0, 255});
//exit_btn->BGColor({192, 64, 64, 255});
exit_btn->SetContent("X");
exit_btn->BGColor({92,92,192, 255});
exit_btn->BaseBGColor({92,92,192, 255});
exit_btn->BGColor(exit_btn->BaseBGColor());
exit_btn->BorderColors({0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0});
exit_btn->BorderColor({0,0,0,0});
exit_btn->SetBorderWidth(0.f);
//JGL::Font FreeSans
//exit_btn_text->SetFont(TitleLabel->GetFont());
exit_btn->SetTextSize(titlebar_height);
exit_btn->SetTextSize(title_font_size);
exit_btn->SetTextColor({255, 0, 0});
//exit_btn->Center();
exit_btn->Center();
exit_btn->OnClickEvent += [&] (auto... _) {
this->Visible(false);
};
jlog::Debug(std::format("{} {} {} {}", Topbar->Size().X.Pixels, Topbar->Size().Y.Pixels, Topbar->Size().X.Scale,
Topbar->Size().Y.Scale));
//min_size = exit_btn->GetSize() + Topbar->GetSize() + TitleLabel->Size();
//= Topbar->GetSize();//+ exit_btn->Size();
// TODO: fs_btn
}
Window::Window(Widget* parent) : Window() {