Sending Up Work

This commit is contained in:
2024-10-23 14:16:54 -04:00
parent 63ff2e6ef2
commit 781c9882d4
8 changed files with 28 additions and 18 deletions

View File

@@ -53,7 +53,7 @@ CPMAddPackage(
CPMAddPackage(
NAME JGL
URL https://git.redacted.cc/josh/JGL/archive/Prerelease-35.zip
URL https://git.redacted.cc/josh/JGL/archive/Prerelease-37.zip
)
target_include_directories(JUI PUBLIC ${Event_SOURCE_DIR}/include)

View File

@@ -36,12 +36,16 @@ namespace JUI
//Event<Vector2> MousePress;
//Event<Vector2, bool> MouseRelease;
public:
void SetCornerRounding(float radius);
void SetCornerRounding(float tlRadius, float trRadius, float blRadius, float brRadius);
void SetCornerRoundingTL(float radius);
void SetCornerRoundingTR(float radius);
void SetCornerRoundingBL(float radius);
void SetCornerRoundingBR(float radius);
void CornerRounding(float radius);
float CornerRounding() const;
// TODO: Implement per-corner rounding in JGL::Outline/FillRect
//void CornerRounding(float tlRadius, float trRadius, float blRadius, float brRadius);
//void CornerRoundingTL(float radius);
//void CornerRoundingTR(float radius);
//void CornerRoundingBL(float radius);
//void CornerRoundingBR(float radius);
void SetClipsDescendants(bool clipping);
void BGColor(const Color4& col);

View File

@@ -208,7 +208,6 @@ namespace JUI
/// @see IsVisible().
void Visible(bool enabled);
/// Returns the first ancestor in this widgets hierarchy that does not have its own parent.
/// In a well-formed JUI menu, this **should** always be a Scene.
Widget* GetFamilyTreeRoot() const;

View File

@@ -33,7 +33,7 @@ namespace JUI
/// A container widget class, with title bar and buttons,
/// which can be dragged around, resized, and docked into other applicable widgets.
class Window : public Widget, RectBase, public Clickable, public Hoverable, public Draggable, public Resizable, public Dockable
class Window : public Widget, public RectBase, public Clickable, public Hoverable, public Draggable, public Resizable, public Dockable
{
public:
/// The default constructor sets a default style for this Window.

View File

@@ -127,6 +127,7 @@ JUI::Scene* CreateScene() {
// Window //
JUI::Window* win_element = new JUI::Window(root);
win_element->SetTitleFont(FreeSans);
win_element->CornerRounding(5);
win_element->Size({50_percent, 50_percent});
win_element->SetTitle("JUI Example Window Widget");
//win_element->Padding(1_px);

View File

@@ -31,9 +31,9 @@ namespace JUI {
// Background rect
J2D::Begin();
//if (corner_rounding_radius > 0)
// J2D::FillRoundedRect(bg_color, abs_pos, abs_size, corner_rounding_radius);
//else
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
@@ -50,9 +50,9 @@ namespace JUI {
// TODO: implement border_mode behavior when rendering here.
//if (corner_rounding_radius > 0)
// J2D::OutlineRoundedRect(border_color, abs_pos - border_offset, abs_size + (border_offset*2), corner_rounding_radius, border_width);
//else
if (corner_rounding_radius > 0)
J2D::OutlineRoundedRect(border_color, abs_pos - border_offset, abs_size + (border_offset*2), corner_rounding_radius, border_width);
else
J2D::OutlineRect(border_color, abs_pos - border_offset, abs_size + (border_offset*2), border_width);
J2D::End();
@@ -64,5 +64,11 @@ namespace JUI {
BorderMode RectBase::BorderMode() const { return border_mode; }
void RectBase::CornerRounding(float radius) {
corner_rounding_radius = radius;
}
float RectBase::CornerRounding() const { return corner_rounding_radius; }
}

View File

@@ -1,4 +1,4 @@
#include "JUI/Base/Widget.hpp"
#include <JUI/Base/Widget.hpp>
#include <jlog/Logger.hpp>
#include <J3ML/Geometry/AABB2D.hpp>

View File

@@ -1,5 +1,5 @@
#include "JGL/JGL.h"
#include "JUI/Widgets/Rect.hpp"
#include <JGL/JGL.h>
#include <JUI/Widgets/Rect.hpp>
#include <jlog/Logger.hpp>
namespace JUI {