Spastic Edits

This commit is contained in:
2025-06-23 22:47:27 -05:00
parent 8af6030d1a
commit 72e21451a6
9 changed files with 136 additions and 20 deletions

View File

@@ -27,6 +27,10 @@ namespace JUI
Inset /// As BorderWidth increases, the border grows inward only. The dimensions of the widget's contents are reduced at a 1:2 ratio.
};
enum class CornerRoundingMode {
None, Circular, Chamfer,
};
/// Base implementation for rendering rectangles with decorations.
class RectBase {
public:
@@ -40,6 +44,7 @@ namespace JUI
virtual void CornerRounding(float radius);
[[nodiscard]] float CornerRounding() const;
enum CornerRoundingMode CornerRoundingMode() const;
// TODO: Implement per-corner rounding in JGL::Outline/FillRect
//void CornerRounding(float tlRadius, float trRadius, float blRadius, float brRadius);

View File

@@ -0,0 +1,31 @@
#pragma once
#include <Color4.hpp>
#include <Colors.hpp>
namespace JUI {
class RectStyler {
public:
#pragma region Getters
virtual Color4 BGColor() const = 0;
virtual Color4 BorderColor() const = 0;
virtual enum BorderMode BorderMode() const = 0;
virtual float BorderWidth() const = 0;
virtual float CornerRounding() const = 0;
#pragma endregion
#pragma region Setters
virtual void BGColor(const Color4& color) = 0;
virtual void BorderColor(const Color4& color) = 0;
virtual void BorderMode(const enum BorderMode& borderMode) = 0;
virtual void BorderWidth(float width) = 0;
#pragma endregion
protected:
float border_width = 1.f;
Color4 border_color {192, 192, 192};
enum BorderMode border_mode;
float corner_rounding = 0.f;
private:
};
}

View File

@@ -32,19 +32,7 @@ namespace JUI {
virtual Separator* AddSeparator(const UDim& size = 5_px) = 0;
};
class RectStyleInterface {
public:
virtual Color4 BGColor() const = 0;
virtual Color4 BorderColor() const = 0;
virtual enum BorderMode BorderMode() const = 0;
virtual float BorderWidth() const = 0;
virtual float CornerRounding() const = 0;
virtual void BGColor(const Color4& color) = 0;
virtual void BorderColor(const Color4& color) = 0;
virtual void BorderMode(const enum BorderMode& borderMode) = 0;
};

View File

@@ -7,11 +7,14 @@
namespace JUI {
///
struct DataPoint {
Vector2 pos;
Color4 color;
};
///
class FpsGraph : public JUI::ImageRect
{
public:

View File

@@ -2,8 +2,35 @@
#include "Rect.hpp"
#include "ImageRect.hpp"
class Graph : public JUI::ImageRect {
public:
protected:
private:
};
namespace JUI {
/// A widget that plots and displays a data set in the form of various graphs.
class Graph : public ImageRect {
public:
/// The default constructor sets sensible defaults for style properties and zero-initializes other members.
Graph()
{
}
/// Constructs a Graph by explicitly specifying its parent element.
explicit Graph(Widget* parent) : Graph() {
this->Parent(parent);
}
protected:
private:
};
class PieChart : public Graph {
public:
protected:
private:
};
class LineGraph : public Graph {
public:
protected:
private:
};
}

View File

@@ -27,6 +27,17 @@ namespace JUI
struct Scrubber {
public:
Color4 color;
UDim2 size;
protected:
private:
};
/// A slider is a widget with a handle which can be pulled back and forth to change the value.
class Slider : public Rect, public Clickable, public Hoverable
{
@@ -42,6 +53,7 @@ namespace JUI
[[nodiscard]] float CurrentValue() const;
[[nodiscard]] Color4 ScrubberColor() const;
[[nodiscard]] float ScrubberWidth() const;
[[nodiscard]] UDim2 ScrubberSize() const;
[[nodiscard]] bool Dragging() const;
[[nodiscard]] float Range() const;
@@ -64,6 +76,7 @@ namespace JUI
void OnExit(const J3ML::LinearAlgebra::Vector2 &MousePos) override;
void Update(float delta) override;
void Draw() override;
void InnerDraw() override;
protected:
float minimum = 0;
@@ -76,4 +89,12 @@ namespace JUI
Color4 scrubber_color = Colors::White;
private:
};
class VerticalSlider {
public:
protected:
private:
};
}