A bit more refactoring
This commit is contained in:
parent
6ecf220891
commit
10ecd04747
33 changed files with 503 additions and 446 deletions
|
|
@ -20,6 +20,7 @@ Implement global scale (probably query desktop scale and adjust accordingly)
|
|||
Implement show/hide functionality for widgets
|
||||
Implement Panel title
|
||||
Create reliable default stylesheet
|
||||
Implement cursors in Stylesheet
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ namespace ogfx
|
|||
if (data.button == ogfx::MouseEventData::eButton::Left && parent.m_gfx != nullptr && parent.m_mouseInside)
|
||||
{
|
||||
String text = parent.m_text;
|
||||
ostd::Vec2 relativePosition = { (f32)data.position_x, (f32)data.position_y };
|
||||
Vec2 relativePosition = { (f32)data.position_x, (f32)data.position_y };
|
||||
relativePosition -= (parent.getPosition() + parent.m_paddingX + parent.m_theme.extraPaddingLeft);
|
||||
if (text.len() > 0)
|
||||
{
|
||||
|
|
@ -196,7 +196,7 @@ namespace ogfx
|
|||
|
||||
|
||||
|
||||
RawTextInput& RawTextInput::create(const ostd::Vec2& position, const ostd::Vec2& size, const String& name)
|
||||
RawTextInput& RawTextInput::create(const Vec2& position, const Vec2& size, const String& name)
|
||||
{
|
||||
setPosition(position);
|
||||
setSize(size);
|
||||
|
|
@ -217,7 +217,7 @@ namespace ogfx
|
|||
m_fontSize = (i32)(geth() * 0.66);
|
||||
f32 cursor_height_scale = 0.75f;
|
||||
|
||||
ostd::IPoint strSize { 0, 0 };
|
||||
IPoint strSize { 0, 0 };
|
||||
if (m_cursorPosition > 0 && m_text != "")
|
||||
{
|
||||
String s1 = m_text.new_substr(0, m_cursorPosition);
|
||||
|
|
@ -226,7 +226,7 @@ namespace ogfx
|
|||
|
||||
gfx.outlinedRect(*this, m_theme.backgroundColor, m_theme.borderColor, 2);
|
||||
if (m_text.len() > 0)
|
||||
gfx.drawString(m_text, getPosition() + ostd::Vec2 { m_paddingX + m_theme.extraPaddingLeft, m_paddingX + m_theme.extraPaddingTop}, m_theme.textColor, m_fontSize);
|
||||
gfx.drawString(m_text, getPosition() + Vec2 { m_paddingX + m_theme.extraPaddingLeft, m_paddingX + m_theme.extraPaddingTop}, m_theme.textColor, m_fontSize);
|
||||
|
||||
if (m_cursorState || !m_theme.cursorBlink)
|
||||
gfx.fillRect({ getx() + m_paddingX + m_theme.extraPaddingLeft + strSize.x - 1, gety() + m_paddingX + m_theme.extraPaddingTop, (f32)m_theme.cursorWidth, (f32)m_fontSize * cursor_height_scale }, m_theme.cursorColor);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace ogfx
|
|||
{
|
||||
namespace gui
|
||||
{
|
||||
class RawTextInput : public ostd::Rectangle
|
||||
class RawTextInput : public Rectangle
|
||||
{
|
||||
public: class EventListener : public ostd::BaseObject
|
||||
{
|
||||
|
|
@ -50,10 +50,10 @@ namespace ogfx
|
|||
public: class Theme
|
||||
{
|
||||
public:
|
||||
ostd::Color textColor { 0, 0, 0, 0 };
|
||||
ostd::Color borderColor { 0, 0, 0, 0 };
|
||||
ostd::Color backgroundColor { 0, 0, 0, 0 };
|
||||
ostd::Color cursorColor { 0, 0, 0, 0 };
|
||||
Color textColor { 0, 0, 0, 0 };
|
||||
Color borderColor { 0, 0, 0, 0 };
|
||||
Color backgroundColor { 0, 0, 0, 0 };
|
||||
Color cursorColor { 0, 0, 0, 0 };
|
||||
|
||||
u8 cursorWidth { 0 };
|
||||
u8 extraPaddingTop { 0 };
|
||||
|
|
@ -114,8 +114,8 @@ namespace ogfx
|
|||
|
||||
public:
|
||||
inline RawTextInput(void) { create({ 0.0f, 0.0f }, { 200.0f, 30.0f }, "UnnamedRawTextInput"); }
|
||||
inline RawTextInput(const ostd::Vec2& position, const ostd::Vec2& size, const String& name) { create(position, size, name); }
|
||||
RawTextInput& create(const ostd::Vec2& position, const ostd::Vec2& size, const String& name);
|
||||
inline RawTextInput(const Vec2& position, const Vec2& size, const String& name) { create(position, size, name); }
|
||||
RawTextInput& create(const Vec2& position, const Vec2& size, const String& name);
|
||||
|
||||
virtual void render(ogfx::BasicRenderer2D& gfx);
|
||||
virtual void update(void);
|
||||
|
|
|
|||
|
|
@ -445,55 +445,55 @@ namespace ogfx
|
|||
m_defaultStylesheetVariables["cursor_w_resize"] = { String("").add(cast<i32>(eCursor::W_Resize)), true };
|
||||
|
||||
// Colors
|
||||
m_defaultStylesheetVariables["color_transparent"] = { "Color(" + ostd::Colors::Transparent.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_black"] = { "Color(" + ostd::Colors::Black.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_white"] = { "Color(" + ostd::Colors::White.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_gray"] = { "Color(" + ostd::Colors::Gray.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_lightgray"] = { "Color(" + ostd::Colors::LightGray.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_darkgray"] = { "Color(" + ostd::Colors::DarkGray.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_red"] = { "Color(" + ostd::Colors::Red.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_green"] = { "Color(" + ostd::Colors::Green.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_blue"] = { "Color(" + ostd::Colors::Blue.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_yellow"] = { "Color(" + ostd::Colors::Yellow.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_cyan"] = { "Color(" + ostd::Colors::Cyan.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_magenta"] = { "Color(" + ostd::Colors::Magenta.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_orange"] = { "Color(" + ostd::Colors::Orange.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_purple"] = { "Color(" + ostd::Colors::Purple.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_brown"] = { "Color(" + ostd::Colors::Brown.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_pink"] = { "Color(" + ostd::Colors::Pink.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_lime"] = { "Color(" + ostd::Colors::Lime.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_olive"] = { "Color(" + ostd::Colors::Olive.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_teal"] = { "Color(" + ostd::Colors::Teal.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_navy"] = { "Color(" + ostd::Colors::Navy.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_maroon"] = { "Color(" + ostd::Colors::Maroon.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_indigo"] = { "Color(" + ostd::Colors::Indigo.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_gold"] = { "Color(" + ostd::Colors::Gold.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_silver"] = { "Color(" + ostd::Colors::Silver.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_beige"] = { "Color(" + ostd::Colors::Beige.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_coral"] = { "Color(" + ostd::Colors::Coral.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_salmon"] = { "Color(" + ostd::Colors::Salmon.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_chocolate"] = { "Color(" + ostd::Colors::Chocolate.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_khaki"] = { "Color(" + ostd::Colors::Khaki.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_lavender"] = { "Color(" + ostd::Colors::Lavender.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_mint"] = { "Color(" + ostd::Colors::Mint.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_skyblue"] = { "Color(" + ostd::Colors::SkyBlue.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_royalblue"] = { "Color(" + ostd::Colors::RoyalBlue.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_deepskyblue"] = { "Color(" + ostd::Colors::DeepSkyBlue.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_turquoise"] = { "Color(" + ostd::Colors::Turquoise.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_aquamarine"] = { "Color(" + ostd::Colors::Aquamarine.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_forestgreen"] = { "Color(" + ostd::Colors::ForestGreen.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_seagreen"] = { "Color(" + ostd::Colors::SeaGreen.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_springgreen"] = { "Color(" + ostd::Colors::SpringGreen.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_firebrick"] = { "Color(" + ostd::Colors::Firebrick.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_crimson"] = { "Color(" + ostd::Colors::Crimson.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_tomato"] = { "Color(" + ostd::Colors::Tomato.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_darkorange"] = { "Color(" + ostd::Colors::DarkOrange.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_darkred"] = { "Color(" + ostd::Colors::DarkRed.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_darkblue"] = { "Color(" + ostd::Colors::DarkBlue.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_darkgreen"] = { "Color(" + ostd::Colors::DarkGreen.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_darkcyan"] = { "Color(" + ostd::Colors::DarkCyan.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_darkmagenta"] = { "Color(" + ostd::Colors::DarkMagenta.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_darkyellow"] = { "Color(" + ostd::Colors::DarkYellow.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_transparent"] = { "Color(" + Colors::Transparent.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_black"] = { "Color(" + Colors::Black.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_white"] = { "Color(" + Colors::White.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_gray"] = { "Color(" + Colors::Gray.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_lightgray"] = { "Color(" + Colors::LightGray.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_darkgray"] = { "Color(" + Colors::DarkGray.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_red"] = { "Color(" + Colors::Red.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_green"] = { "Color(" + Colors::Green.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_blue"] = { "Color(" + Colors::Blue.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_yellow"] = { "Color(" + Colors::Yellow.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_cyan"] = { "Color(" + Colors::Cyan.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_magenta"] = { "Color(" + Colors::Magenta.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_orange"] = { "Color(" + Colors::Orange.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_purple"] = { "Color(" + Colors::Purple.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_brown"] = { "Color(" + Colors::Brown.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_pink"] = { "Color(" + Colors::Pink.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_lime"] = { "Color(" + Colors::Lime.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_olive"] = { "Color(" + Colors::Olive.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_teal"] = { "Color(" + Colors::Teal.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_navy"] = { "Color(" + Colors::Navy.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_maroon"] = { "Color(" + Colors::Maroon.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_indigo"] = { "Color(" + Colors::Indigo.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_gold"] = { "Color(" + Colors::Gold.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_silver"] = { "Color(" + Colors::Silver.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_beige"] = { "Color(" + Colors::Beige.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_coral"] = { "Color(" + Colors::Coral.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_salmon"] = { "Color(" + Colors::Salmon.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_chocolate"] = { "Color(" + Colors::Chocolate.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_khaki"] = { "Color(" + Colors::Khaki.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_lavender"] = { "Color(" + Colors::Lavender.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_mint"] = { "Color(" + Colors::Mint.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_skyblue"] = { "Color(" + Colors::SkyBlue.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_royalblue"] = { "Color(" + Colors::RoyalBlue.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_deepskyblue"] = { "Color(" + Colors::DeepSkyBlue.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_turquoise"] = { "Color(" + Colors::Turquoise.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_aquamarine"] = { "Color(" + Colors::Aquamarine.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_forestgreen"] = { "Color(" + Colors::ForestGreen.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_seagreen"] = { "Color(" + Colors::SeaGreen.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_springgreen"] = { "Color(" + Colors::SpringGreen.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_firebrick"] = { "Color(" + Colors::Firebrick.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_crimson"] = { "Color(" + Colors::Crimson.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_tomato"] = { "Color(" + Colors::Tomato.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_darkorange"] = { "Color(" + Colors::DarkOrange.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_darkred"] = { "Color(" + Colors::DarkRed.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_darkblue"] = { "Color(" + Colors::DarkBlue.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_darkgreen"] = { "Color(" + Colors::DarkGreen.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_darkcyan"] = { "Color(" + Colors::DarkCyan.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_darkmagenta"] = { "Color(" + Colors::DarkMagenta.hexString(true, "#") + ")", true };
|
||||
m_defaultStylesheetVariables["color_darkyellow"] = { "Color(" + Colors::DarkYellow.hexString(true, "#") + ")", true };
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -89,8 +89,8 @@ namespace ogfx
|
|||
inline String getTitle(void) const { return m_title; }
|
||||
inline i32 getWindowWidth(void) const { return m_windowWidth; }
|
||||
inline i32 getWindowHeight(void) const { return m_windowHeight; }
|
||||
inline ostd::Color getClearColor(void) const { return m_clearColor; }
|
||||
inline void setClearColor(const ostd::Color& color) { m_clearColor = color; }
|
||||
inline Color getClearColor(void) const { return m_clearColor; }
|
||||
inline void setClearColor(const Color& color) { m_clearColor = color; }
|
||||
inline SDL_Renderer* getSDLRenderer(void) { return m_renderer; }
|
||||
inline void enableBlockingEvents(bool enable = true) { m_blockingEvents = enable; }
|
||||
inline bool isBlockingEventsEnabled(void) const { return m_blockingEvents; }
|
||||
|
|
@ -123,7 +123,7 @@ namespace ogfx
|
|||
const ostd::Stylesheet* m_guiTheme { nullptr };
|
||||
|
||||
private:
|
||||
ostd::Color m_clearColor { 10, 10, 10, 255 };
|
||||
Color m_clearColor { 10, 10, 10, 255 };
|
||||
|
||||
i32 m_windowWidth { 0 };
|
||||
i32 m_windowHeight { 0 };
|
||||
|
|
|
|||
|
|
@ -440,7 +440,7 @@ namespace ogfx
|
|||
if (l_endOfConsole()) return;
|
||||
if (string.len() == 0) return;
|
||||
f32 vertical_margin = 4;
|
||||
Vec2 pos = m_consolePosition + ostd::Vec2 { m_charSize.x * m_curosrPosition.x, m_charSize.y * m_curosrPosition.y };
|
||||
Vec2 pos = m_consolePosition + Vec2 { m_charSize.x * m_curosrPosition.x, m_charSize.y * m_curosrPosition.y };
|
||||
if (m_backgroundColor.a > 0)
|
||||
m_renderer.fillRect({ pos.x, pos.y + vertical_margin, m_charSize.x * string.len(), m_charSize.y - vertical_margin }, m_backgroundColor);
|
||||
if (m_foregroundColor.a > 0)
|
||||
|
|
|
|||
|
|
@ -34,35 +34,35 @@ namespace ogfx
|
|||
GraphicsWindowOutputHandler(void);
|
||||
void attachWindow(WindowCore& window);
|
||||
void setMonospaceFont(const String& filePath);
|
||||
ostd::Vec2 getStringSize(const String& str);
|
||||
Vec2 getStringSize(const String& str);
|
||||
bool isReady(void);
|
||||
void resetCursorPosition(void);
|
||||
void resetColors(void);
|
||||
void beginFrame(void);
|
||||
|
||||
void setFontSize(i32 fontSize);
|
||||
void setConsoleMaxCharacters(const ostd::IPoint& size);
|
||||
void setConsolePosition(const ostd::Vec2& pos);
|
||||
void setConsoleMaxCharacters(const IPoint& size);
|
||||
void setConsolePosition(const Vec2& pos);
|
||||
void setWrapMode(eWrapMode wrapMode);
|
||||
void setPadding(const ostd::Rectangle& rect);
|
||||
void setDefaultForegroundColor(const ostd::Color& color);
|
||||
void setDefaultBackgorundColor(const ostd::Color& color);
|
||||
void setPadding(const Rectangle& rect);
|
||||
void setDefaultForegroundColor(const Color& color);
|
||||
void setDefaultBackgorundColor(const Color& color);
|
||||
void setTabWidth(u8 tw);
|
||||
|
||||
i32 getFontSize(void);
|
||||
ostd::Vec2 getCharacterSize(i32 fontSize = 0);
|
||||
ostd::Vec2 getConsolePosition(void);
|
||||
Vec2 getCharacterSize(i32 fontSize = 0);
|
||||
Vec2 getConsolePosition(void);
|
||||
eWrapMode getWrapMode(void);
|
||||
ostd::Rectangle getPadding(void);
|
||||
ostd::Color getDefaultBackgroundColor(void);
|
||||
ostd::Color getDefaultForegroundColor(void);
|
||||
Rectangle getPadding(void);
|
||||
Color getDefaultBackgroundColor(void);
|
||||
Color getDefaultForegroundColor(void);
|
||||
u8 getTabWidth(void);
|
||||
ostd::Rectangle getConsoleBounds(void);
|
||||
Rectangle getConsoleBounds(void);
|
||||
|
||||
GraphicsWindowOutputHandler& bg(const ostd::Color& color) override;
|
||||
GraphicsWindowOutputHandler& bg(const Color& color) override;
|
||||
GraphicsWindowOutputHandler& bg(const ostd::ConsoleColors::tConsoleColor& color) override;
|
||||
GraphicsWindowOutputHandler& bg(const String& color) override;
|
||||
GraphicsWindowOutputHandler& fg(const ostd::Color& color) override;
|
||||
GraphicsWindowOutputHandler& fg(const Color& color) override;
|
||||
GraphicsWindowOutputHandler& fg(const ostd::ConsoleColors::tConsoleColor& color) override;
|
||||
GraphicsWindowOutputHandler& fg(const String& color) override;
|
||||
|
||||
|
|
@ -90,38 +90,38 @@ namespace ogfx
|
|||
GraphicsWindowOutputHandler& clear(void) override;
|
||||
GraphicsWindowOutputHandler& reset(void) override;
|
||||
|
||||
GraphicsWindowOutputHandler& xy(ostd::IPoint position) override;
|
||||
GraphicsWindowOutputHandler& xy(IPoint position) override;
|
||||
GraphicsWindowOutputHandler& xy(i32 x, i32 y) override;
|
||||
GraphicsWindowOutputHandler& x(i32 x) override;
|
||||
GraphicsWindowOutputHandler& y(i32 y) override;
|
||||
|
||||
ostd::IPoint getCursorPosition(void) override;
|
||||
IPoint getCursorPosition(void) override;
|
||||
void getCursorPosition(i32& outX, i32& outY) override;
|
||||
i32 getCursorX(void) override;
|
||||
i32 getCursorY(void) override;
|
||||
|
||||
void getConsoleSize(i32& outColumns, i32& outRows) override;
|
||||
ostd::IPoint getConsoleSize(void) override;
|
||||
IPoint getConsoleSize(void) override;
|
||||
|
||||
private:
|
||||
void __update_char_size(void);
|
||||
void __print_string(const String& str);
|
||||
|
||||
private:
|
||||
ostd::Color m_backgroundColor;
|
||||
ostd::Color m_foregroundColor;
|
||||
ostd::Color m_defaultBackgroundColor { 0, 0, 0, 0 };
|
||||
ostd::Color m_defaultForegroundColor { 0, 220, 0, 255 };
|
||||
ostd::Vec2 m_curosrPosition;
|
||||
Color m_backgroundColor;
|
||||
Color m_foregroundColor;
|
||||
Color m_defaultBackgroundColor { 0, 0, 0, 0 };
|
||||
Color m_defaultForegroundColor { 0, 220, 0, 255 };
|
||||
Vec2 m_curosrPosition;
|
||||
BasicRenderer2D m_renderer;
|
||||
WindowCore* m_window { nullptr };
|
||||
i32 m_fontSize { 20 };
|
||||
ostd::Vec2 m_charSize;
|
||||
ostd::IPoint m_consoleSize { 0, 0 };
|
||||
Vec2 m_charSize;
|
||||
IPoint m_consoleSize { 0, 0 };
|
||||
bool m_ready { false };
|
||||
ostd::Vec2 m_consolePosition { 0.0f, 0.0f };
|
||||
Vec2 m_consolePosition { 0.0f, 0.0f };
|
||||
eWrapMode m_wrapMode { eWrapMode::TripleDots };
|
||||
ostd::Rectangle m_padding { 10, 10, 10, 10 };
|
||||
Rectangle m_padding { 10, 10, 10, 10 };
|
||||
u8 m_tabWidth { 8 };
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,18 +41,18 @@ namespace ogfx
|
|||
|
||||
void CheckBox::applyTheme(const ostd::Stylesheet& theme)
|
||||
{
|
||||
setCheckBorderColor(getThemeValue<ostd::Color>(theme, "checkbox.checkBorderColor", ostd::Colors::White));
|
||||
setCheckBoxColor(getThemeValue<ostd::Color>(theme, "checkbox.checkBoxColor", ostd::Colors::White));
|
||||
setTextColor(getThemeValue<ostd::Color>(theme, "checkbox.textColor", ostd::Colors::Black));
|
||||
setBackGroundColor(getThemeValue<ostd::Color>(theme, "checkbox.backgroundColor", ostd::Colors::Transparent));
|
||||
setCheckBorderColor(getThemeValue<Color>(theme, "checkbox.checkBorderColor", Colors::White));
|
||||
setCheckBoxColor(getThemeValue<Color>(theme, "checkbox.checkBoxColor", Colors::White));
|
||||
setTextColor(getThemeValue<Color>(theme, "checkbox.textColor", Colors::Black));
|
||||
setBackGroundColor(getThemeValue<Color>(theme, "checkbox.backgroundColor", Colors::Transparent));
|
||||
setFontSize(getThemeValue<i32>(theme, "checkbox.fontSize", 28));
|
||||
setBorderRadius(getThemeValue<i32>(theme, "checkbox.borderRadius", 10));
|
||||
setBorderWidth(getThemeValue<i32>(theme, "checkbox.borderWidth", 2));
|
||||
enableBorder(getThemeValue<bool>(theme, "checkbox.showBorder", false));
|
||||
setBorderColor(getThemeValue<ostd::Color>(theme, "checkbox.borderColor", ostd::Colors::White));
|
||||
setBorderColor(getThemeValue<Color>(theme, "checkbox.borderColor", Colors::White));
|
||||
enableBackground(getThemeValue<bool>(theme, "checkbox.showBackground", false));
|
||||
setPadding(getThemeValue<ostd::Rectangle>(theme, "checkbox.padding", { 5, 5, 5, 5 }));
|
||||
setMargin(getThemeValue<ostd::Rectangle>(theme, "checkbox.margin", { 0, 0, 0, 0 }));
|
||||
setPadding(getThemeValue<Rectangle>(theme, "checkbox.padding", { 5, 5, 5, 5 }));
|
||||
setMargin(getThemeValue<Rectangle>(theme, "checkbox.margin", { 0, 0, 0, 0 }));
|
||||
m_checkBorderRadius = getThemeValue<i32>(theme, "checkbox.checkBorderRadius", 5);
|
||||
m_checkBorderWidth = getThemeValue<i32>(theme, "checkbox.checkBorderWidth", 1);
|
||||
}
|
||||
|
|
@ -64,7 +64,7 @@ namespace ogfx
|
|||
gfx.drawRoundRect({ getGlobalContentPosition(), m_checkSize }, getCheckBorderColor(), m_checkBorderRadius, m_checkBorderWidth);
|
||||
if (isChecked())
|
||||
gfx.fillRoundRect({ getGlobalContentPosition() + 5, m_checkSize - 10 }, getCheckBoxColor(), m_checkBorderRadius / 2.0f);
|
||||
gfx.drawString(getText(), getGlobalContentPosition() + ostd::Vec2 { m_checkSize.x + m_spacing, 0 }, getTextColor(), getFontSize());
|
||||
gfx.drawString(getText(), getGlobalContentPosition() + Vec2 { m_checkSize.x + m_spacing, 0 }, getTextColor(), getFontSize());
|
||||
}
|
||||
|
||||
void CheckBox::onMouseReleased(const Event& event)
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ namespace ogfx
|
|||
void setText(const String& text);
|
||||
void setChecked(bool checked);
|
||||
inline String getText(void) const { return m_text; }
|
||||
inline ostd::Color getCheckBorderColor(void) const { return m_checkBorderColor; }
|
||||
inline void setCheckBorderColor(const ostd::Color& color) { m_checkBorderColor = color; }
|
||||
inline ostd::Color getCheckBoxColor(void) const { return m_checkBoxColor; }
|
||||
inline void setCheckBoxColor(const ostd::Color& color) { m_checkBoxColor = color; }
|
||||
inline ostd::Color getTextColor(void) const { return m_textColor; }
|
||||
inline void setTextColor(const ostd::Color& color) { m_textColor = color; }
|
||||
inline Color getCheckBorderColor(void) const { return m_checkBorderColor; }
|
||||
inline void setCheckBorderColor(const Color& color) { m_checkBorderColor = color; }
|
||||
inline Color getCheckBoxColor(void) const { return m_checkBoxColor; }
|
||||
inline void setCheckBoxColor(const Color& color) { m_checkBoxColor = color; }
|
||||
inline Color getTextColor(void) const { return m_textColor; }
|
||||
inline void setTextColor(const Color& color) { m_textColor = color; }
|
||||
inline i32 getFontSize(void) const { return m_fontSize; }
|
||||
inline void setFontSize(i32 fontSize) { m_fontSize = fontSize; }
|
||||
inline bool isChecked(void) const { return m_checked; }
|
||||
|
|
@ -61,13 +61,13 @@ namespace ogfx
|
|||
String m_text { "" };
|
||||
bool m_textChanged { false };
|
||||
i32 m_fontSize { 20 };
|
||||
ostd::Color m_textColor { 255, 255, 255 };
|
||||
Color m_textColor { 255, 255, 255 };
|
||||
f32 m_spacing { 10 };
|
||||
ostd::Vec2 m_checkSize { 0, 0 };
|
||||
Vec2 m_checkSize { 0, 0 };
|
||||
i32 m_checkBorderRadius { 5 };
|
||||
i32 m_checkBorderWidth { 1 };
|
||||
ostd::Color m_checkBorderColor { 255, 255, 255 };
|
||||
ostd::Color m_checkBoxColor { 255, 255, 255 };
|
||||
Color m_checkBorderColor { 255, 255, 255 };
|
||||
Color m_checkBoxColor { 255, 255, 255 };
|
||||
|
||||
std::function<void(CheckBox&, bool)> callback_onStateChanged { nullptr };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -40,17 +40,17 @@ namespace ogfx
|
|||
|
||||
void Panel::applyTheme(const ostd::Stylesheet& theme)
|
||||
{
|
||||
setBackGroundColor(getThemeValue<ostd::Color>(theme, "panel.backgroundColor", ostd::Colors::Gray));
|
||||
setBackGroundColor(getThemeValue<Color>(theme, "panel.backgroundColor", Colors::Gray));
|
||||
setBorderRadius(getThemeValue<i32>(theme, "panel.borderRadius", 8));
|
||||
setBorderWidth(getThemeValue<i32>(theme, "panel.borderWidth", 2));
|
||||
enableBorder(getThemeValue<bool>(theme, "panel.showBorder", true));
|
||||
enableBackground(getThemeValue<bool>(theme, "panel.showBackground", true));
|
||||
setBorderColor(getThemeValue<ostd::Color>(theme, "panel.borderColor", ostd::Colors::Black));
|
||||
m_titleColor = getThemeValue<ostd::Color>(theme, "panel.titleColor", ostd::Colors::Black);
|
||||
setBorderColor(getThemeValue<Color>(theme, "panel.borderColor", Colors::Black));
|
||||
m_titleColor = getThemeValue<Color>(theme, "panel.titleColor", Colors::Black);
|
||||
m_showTitle = getThemeValue<bool>(theme, "panel.showTitle", false);
|
||||
m_titleHeight = getThemeValue<f32>(theme, "panel.titleHeight", 30);
|
||||
m_titleType = getThemeValue<String>(theme, "panel.titleHeight", "text");
|
||||
setPadding(getThemeValue<ostd::Rectangle>(theme, "panel.padding", { 15, 15, 15, 15 }));
|
||||
m_titleType = getThemeValue<String>(theme, "panel.titlebarType", TitleBarTypes::None);
|
||||
setPadding(getThemeValue<Rectangle>(theme, "panel.padding", { 15, 15, 15, 15 }));
|
||||
}
|
||||
|
||||
void Panel::onDraw(ogfx::BasicRenderer2D& gfx)
|
||||
|
|
|
|||
|
|
@ -30,18 +30,26 @@ namespace ogfx
|
|||
{
|
||||
class Panel : public Widget
|
||||
{
|
||||
public: struct TitleBarTypes
|
||||
{
|
||||
inline static const String None { "none" };
|
||||
inline static const String Full { "full" };
|
||||
inline static const String Minimal { "monimal" };
|
||||
};
|
||||
public:
|
||||
inline Panel(WindowCore& window) : Widget({ 0, 0, 0, 0 }, window) { create(); }
|
||||
Panel& create(void);
|
||||
void applyTheme(const ostd::Stylesheet& theme) override;
|
||||
void onDraw(ogfx::BasicRenderer2D& gfx) override;
|
||||
inline void setBackGroundColor(const ostd::Color& color) { m_backgroundColor = color; }
|
||||
inline ostd::Color getBackgroundColor(void) { return m_backgroundColor; }
|
||||
void setTitlebarType(const String& type);
|
||||
inline void setBackGroundColor(const Color& color) { m_backgroundColor = color; }
|
||||
inline Color getBackgroundColor(void) { return m_backgroundColor; }
|
||||
inline String getTitlebarType(void) const { return m_titleType; }
|
||||
|
||||
private:
|
||||
ostd::Color m_titleColor { 0, 0, 0 };
|
||||
Color m_titleColor { 0, 0, 0 };
|
||||
bool m_showTitle { false };
|
||||
String m_titleType = "full";
|
||||
String m_titleType = TitleBarTypes::None;
|
||||
f32 m_titleHeight { 30 };
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,16 +41,16 @@ namespace ogfx
|
|||
|
||||
void Label::applyTheme(const ostd::Stylesheet& theme)
|
||||
{
|
||||
setColor(getThemeValue<ostd::Color>(theme, "label.textColor", ostd::Colors::White));
|
||||
setBackGroundColor(getThemeValue<ostd::Color>(theme, "label.backgroundColor", ostd::Colors::Transparent));
|
||||
setColor(getThemeValue<Color>(theme, "label.textColor", Colors::White));
|
||||
setBackGroundColor(getThemeValue<Color>(theme, "label.backgroundColor", Colors::Transparent));
|
||||
setFontSize(getThemeValue<i32>(theme, "label.fontSize", 20));
|
||||
setBorderRadius(getThemeValue<i32>(theme, "label.borderRadius", 10));
|
||||
setBorderWidth(getThemeValue<i32>(theme, "label.borderWidth", 2));
|
||||
enableBorder(getThemeValue<bool>(theme, "label.showBorder", false));
|
||||
setBorderColor(getThemeValue<ostd::Color>(theme, "label.borderColor", ostd::Colors::White));
|
||||
setBorderColor(getThemeValue<Color>(theme, "label.borderColor", Colors::White));
|
||||
enableBackground(getThemeValue<bool>(theme, "label.showBackground", false));
|
||||
setPadding(getThemeValue<ostd::Rectangle>(theme, "label.padding", { 5, 5, 5, 5 }));
|
||||
setMargin(getThemeValue<ostd::Rectangle>(theme, "label.margin", { 0, 0, 0, 0 }));
|
||||
setPadding(getThemeValue<Rectangle>(theme, "label.padding", { 5, 5, 5, 5 }));
|
||||
setMargin(getThemeValue<Rectangle>(theme, "label.margin", { 0, 0, 0, 0 }));
|
||||
}
|
||||
|
||||
void Label::onDraw(ogfx::BasicRenderer2D& gfx)
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ namespace ogfx
|
|||
void onDraw(ogfx::BasicRenderer2D& gfx) override;
|
||||
void setText(const String& text);
|
||||
inline String getText(void) const { return m_text; }
|
||||
inline ostd::Color getColor(void) const { return m_color; }
|
||||
inline void setColor(const ostd::Color& color) { m_color = color; }
|
||||
inline Color getColor(void) const { return m_color; }
|
||||
inline void setColor(const Color& color) { m_color = color; }
|
||||
inline i32 getFontSize(void) const { return m_fontSize; }
|
||||
inline void setFontSize(i32 fontSize) { m_fontSize = fontSize; }
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ namespace ogfx
|
|||
String m_text { "" };
|
||||
bool m_textChanged { false };
|
||||
i32 m_fontSize { 20 };
|
||||
ostd::Color m_color { 255, 255, 255 };
|
||||
Color m_color { 255, 255, 255 };
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ namespace ogfx
|
|||
|
||||
void RootWidget::applyTheme(const ostd::Stylesheet& theme)
|
||||
{
|
||||
m_color = getThemeValue<ostd::Color>(theme, "window.backgroundColor", getWindow().getClearColor());
|
||||
m_color = getThemeValue<Color>(theme, "window.backgroundColor", getWindow().getClearColor());
|
||||
}
|
||||
|
||||
void RootWidget::onDraw(ogfx::BasicRenderer2D& gfx)
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ namespace ogfx
|
|||
void onDraw(ogfx::BasicRenderer2D& gfx) override;
|
||||
|
||||
private:
|
||||
ostd::Color m_color { ostd::Colors::Transparent };
|
||||
Color m_color { Colors::Transparent };
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ namespace ogfx
|
|||
ostd::BaseObject* Widget::s_dragAndDropData { nullptr };
|
||||
bool Widget::s_hasDragAndDropData { false };
|
||||
|
||||
Widget::Widget(const ostd::Rectangle& bounds, WindowCore& window) : Rectangle(bounds), m_widgets(window, *this)
|
||||
Widget::Widget(const Rectangle& bounds, WindowCore& window) : Rectangle(bounds), m_widgets(window, *this)
|
||||
{
|
||||
m_window = &window;
|
||||
}
|
||||
|
|
@ -44,40 +44,40 @@ namespace ogfx
|
|||
return m_widgets.addWidget(child);
|
||||
}
|
||||
|
||||
ostd::Vec2 Widget::getGlobalPosition(void) const
|
||||
Vec2 Widget::getGlobalPosition(void) const
|
||||
{
|
||||
ostd::Vec2 glob = getPosition();
|
||||
Vec2 glob = getPosition();
|
||||
if (!m_rootChild && m_parent != nullptr)
|
||||
glob += m_parent->getGlobalPosition() + m_parent->getPadding().getPosition();
|
||||
glob += m_margin.getPosition();
|
||||
return glob;
|
||||
}
|
||||
|
||||
ostd::Vec2 Widget::getGlobalContentPosition(void) const
|
||||
Vec2 Widget::getGlobalContentPosition(void) const
|
||||
{
|
||||
return getGlobalPosition() + getContentBounds().getPosition();
|
||||
}
|
||||
|
||||
ostd::Rectangle Widget::getGlobalBounds(void) const
|
||||
Rectangle Widget::getGlobalBounds(void) const
|
||||
{
|
||||
return { getGlobalPosition(), getSize() + (m_margin.getSize() * 2) };
|
||||
}
|
||||
|
||||
ostd::Rectangle Widget::getContentBounds(void) const
|
||||
Rectangle Widget::getContentBounds(void) const
|
||||
{
|
||||
auto pad = getPadding();
|
||||
return { pad.getPosition(), (getSize() - (pad.getSize() * 2)) };
|
||||
}
|
||||
|
||||
ostd::Rectangle Widget::getGlobalContentBounds(void) const
|
||||
Rectangle Widget::getGlobalContentBounds(void) const
|
||||
{
|
||||
auto pad = getPadding();
|
||||
return { getGlobalContentPosition(), getContentBounds().getSize() };
|
||||
}
|
||||
|
||||
bool Widget::contains(ostd::Vec2 p, bool includeBounds) const
|
||||
bool Widget::contains(Vec2 p, bool includeBounds) const
|
||||
{
|
||||
return ostd::Rectangle(getGlobalPosition(), getSize()).contains(p, includeBounds);
|
||||
return Rectangle(getGlobalPosition(), getSize()).contains(p, includeBounds);
|
||||
}
|
||||
|
||||
void Widget::enable(bool enable)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ namespace ogfx
|
|||
{
|
||||
namespace gui
|
||||
{
|
||||
class Widget : public ostd::BaseObject, public ostd::Rectangle
|
||||
class Widget : public ostd::BaseObject, public Rectangle
|
||||
{
|
||||
private: struct ThemeOverride
|
||||
{
|
||||
|
|
@ -40,15 +40,15 @@ namespace ogfx
|
|||
};
|
||||
public: using EventCallback = std::function<void(const Event&)>;
|
||||
public:
|
||||
Widget(const ostd::Rectangle& bounds, WindowCore& window);
|
||||
Widget(const Rectangle& bounds, WindowCore& window);
|
||||
bool addChild(Widget& child);
|
||||
virtual ostd::Vec2 getGlobalPosition(void) const;
|
||||
virtual ostd::Vec2 getGlobalContentPosition(void) const;
|
||||
virtual ostd::Rectangle getGlobalBounds(void) const;
|
||||
virtual ostd::Rectangle getContentBounds(void) const;
|
||||
virtual ostd::Rectangle getGlobalContentBounds(void) const;
|
||||
using ostd::Rectangle::contains;
|
||||
bool contains(ostd::Vec2 p, bool includeBounds = false) const override;
|
||||
virtual Vec2 getGlobalPosition(void) const;
|
||||
virtual Vec2 getGlobalContentPosition(void) const;
|
||||
virtual Rectangle getGlobalBounds(void) const;
|
||||
virtual Rectangle getContentBounds(void) const;
|
||||
virtual Rectangle getGlobalContentBounds(void) const;
|
||||
using Rectangle::contains;
|
||||
bool contains(Vec2 p, bool includeBounds = false) const override;
|
||||
void enable(bool enable = true);
|
||||
virtual void applyTheme(const ostd::Stylesheet& theme) = 0;
|
||||
void addThemeOverride(const String& fullKey, ostd::Stylesheet::TypeVariant value);
|
||||
|
|
@ -124,8 +124,8 @@ namespace ogfx
|
|||
inline Widget* getParent(void) { return m_parent; }
|
||||
inline i32 getZIndex(void) const { return m_zIndex; }
|
||||
inline bool isChildrenEnabled(void) const { return m_allowChildren; }
|
||||
inline void setPadding(const ostd::Rectangle& pad) { m_padding = pad; }
|
||||
inline void setMargin(const ostd::Rectangle& margin) { m_margin = margin; }
|
||||
inline void setPadding(const Rectangle& pad) { m_padding = pad; }
|
||||
inline void setMargin(const Rectangle& margin) { m_margin = margin; }
|
||||
inline Rectangle getPadding(void) const { return m_padding; }
|
||||
inline Rectangle getMargin(void) const { return m_margin; }
|
||||
inline bool isMouseInside(void) const { return m_mouseInside; }
|
||||
|
|
@ -140,12 +140,12 @@ namespace ogfx
|
|||
inline bool isDragAndDropEnabled(void) const { return m_acceptDragAndDrop; }
|
||||
inline void enableDragAndDrop(bool enable = true) { m_acceptDragAndDrop = enable; }
|
||||
inline void disableDragAndDrop(void) { enableDragAndDrop(false); }
|
||||
inline void setBackGroundColor(const ostd::Color& color) { m_backgroundColor = color; }
|
||||
inline ostd::Color getBackgroundColor(void) { return m_backgroundColor; }
|
||||
inline void setBackGroundColor(const Color& color) { m_backgroundColor = color; }
|
||||
inline Color getBackgroundColor(void) { return m_backgroundColor; }
|
||||
inline void enableBackground(bool enable = true) { m_showBackground = enable; }
|
||||
inline bool isBackgoundEnabled(void) const { return m_showBackground; }
|
||||
inline void setBorderColor(const ostd::Color& color) { m_borderColor = color; }
|
||||
inline ostd::Color getBorderColor(void) { return m_borderColor; }
|
||||
inline void setBorderColor(const Color& color) { m_borderColor = color; }
|
||||
inline Color getBorderColor(void) { return m_borderColor; }
|
||||
inline void enableBorder(bool enable = true) { m_showBorder = enable; }
|
||||
inline bool isBorderEnabled(void) const { return m_showBorder; }
|
||||
inline void setBorderRadius(i32 br) { m_borderRadius = br; }
|
||||
|
|
@ -168,16 +168,16 @@ namespace ogfx
|
|||
inline void disableDrawBox(void) { m_drawBox = false; }
|
||||
inline void enableDrawBox(void) { m_drawBox = true; }
|
||||
inline bool isDrawBoxEnabled(void) const { return m_drawBox; }
|
||||
inline void setDrawBoxColor(const ostd::Color& color) { m_drawBoxColor = color; }
|
||||
inline ostd::Color getDrawBoxColor(void) { return m_drawBoxColor; }
|
||||
inline void setDrawBoxColor(const Color& color) { m_drawBoxColor = color; }
|
||||
inline Color getDrawBoxColor(void) { return m_drawBoxColor; }
|
||||
|
||||
protected:
|
||||
bool m_rootChild { false };
|
||||
i32 m_borderRadius { 10 };
|
||||
i32 m_borderWidth { 2 };
|
||||
ostd::Color m_borderColor { 255, 255, 255 };
|
||||
Color m_borderColor { 255, 255, 255 };
|
||||
bool m_showBorder { false };
|
||||
ostd::Color m_backgroundColor { ostd::Colors::Transparent };
|
||||
Color m_backgroundColor { Colors::Transparent };
|
||||
bool m_showBackground { false };
|
||||
|
||||
EventCallback callback_onMousePressed { nullptr };
|
||||
|
|
@ -223,10 +223,10 @@ namespace ogfx
|
|||
stdvec<ThemeOverride> m_themeOverrides;
|
||||
|
||||
bool m_drawBox { true };
|
||||
ostd::Color m_drawBoxColor { 255, 0, 0 };
|
||||
Color m_drawBoxColor { 255, 0, 0 };
|
||||
|
||||
ostd::Rectangle m_padding { 0, 0, 0, 0 };
|
||||
ostd::Rectangle m_margin { 0, 0, 0, 0 };
|
||||
Rectangle m_padding { 0, 0, 0, 0 };
|
||||
Rectangle m_margin { 0, 0, 0, 0 };
|
||||
|
||||
static ostd::BaseObject* s_dragAndDropData;
|
||||
static bool s_hasDragAndDropData;
|
||||
|
|
|
|||
|
|
@ -91,11 +91,11 @@ namespace ogfx
|
|||
m_drawCallCount = 0;
|
||||
}
|
||||
|
||||
void BasicRenderer2D::pushClippingRect(const ostd::Rectangle& rect, bool additive)
|
||||
void BasicRenderer2D::pushClippingRect(const Rectangle& rect, bool additive)
|
||||
{
|
||||
if (!m_initialized) return;
|
||||
|
||||
ostd::Rectangle finalRect = rect;
|
||||
Rectangle finalRect = rect;
|
||||
|
||||
if (additive && !m_clipStack.empty())
|
||||
finalRect = m_clipStack.back().getIntersection(rect, false);
|
||||
|
|
@ -212,7 +212,7 @@ namespace ogfx
|
|||
return set_error_state(tErrors::NoError);
|
||||
}
|
||||
|
||||
ostd::Vec2 BasicRenderer2D::getStringDimensions(const String& message, i32 fontSize, TTF_Font* font)
|
||||
Vec2 BasicRenderer2D::getStringDimensions(const String& message, i32 fontSize, TTF_Font* font)
|
||||
{
|
||||
if (!isValid()) return { 0, 0 };
|
||||
if (fontSize <= 0) fontSize = m_fontSize;
|
||||
|
|
@ -244,7 +244,7 @@ namespace ogfx
|
|||
|
||||
|
||||
// ===================================================== SPECIALIZED =====================================================
|
||||
void BasicRenderer2D::drawImage(const ogfx::Image& image, const ostd::Vec2& position, const ostd::Vec2& size, const ostd::Rectangle& srcRect)
|
||||
void BasicRenderer2D::drawImage(const ogfx::Image& image, const Vec2& position, const Vec2& size, const Rectangle& srcRect)
|
||||
{
|
||||
if (!m_initialized || !image.isLoaded())
|
||||
return;
|
||||
|
|
@ -253,7 +253,7 @@ namespace ogfx
|
|||
if (!tex)
|
||||
return;
|
||||
|
||||
ostd::Vec2 texSize = image.getSize();
|
||||
Vec2 texSize = image.getSize();
|
||||
|
||||
// 1. Resolve source rectangle
|
||||
f32 sx, sy, sw, sh;
|
||||
|
|
@ -284,7 +284,7 @@ namespace ogfx
|
|||
f32 y2 = dy + dh;
|
||||
|
||||
// 3. Build quad vertices
|
||||
ostd::Vec2 verts[4] = {
|
||||
Vec2 verts[4] = {
|
||||
{ x1, y1 },
|
||||
{ x2, y1 },
|
||||
{ x2, y2 },
|
||||
|
|
@ -292,7 +292,7 @@ namespace ogfx
|
|||
};
|
||||
|
||||
// 4. Build UVs (normalized)
|
||||
ostd::Vec2 uvs[4] = {
|
||||
Vec2 uvs[4] = {
|
||||
{ sx / texSize.x, sy / texSize.y },
|
||||
{ (sx + sw) / texSize.x, sy / texSize.y },
|
||||
{ (sx + sw) / texSize.x, (sy + sh) / texSize.y },
|
||||
|
|
@ -301,10 +301,10 @@ namespace ogfx
|
|||
|
||||
// 5. Push quad
|
||||
u32 inds[6] = QUAD_INDICES_ARR;
|
||||
push_polygon(verts, uvs, 4, inds, 6, ostd::Colors::White, tex);
|
||||
push_polygon(verts, uvs, 4, inds, 6, Colors::White, tex);
|
||||
}
|
||||
|
||||
void BasicRenderer2D::drawAnimation(const Animation& anim, const ostd::Vec2& position, const ostd::Vec2& size)
|
||||
void BasicRenderer2D::drawAnimation(const Animation& anim, const Vec2& position, const Vec2& size)
|
||||
{
|
||||
if (!m_initialized) return;
|
||||
if (!anim.hasImage()) return;
|
||||
|
|
@ -313,7 +313,7 @@ namespace ogfx
|
|||
drawImage(img, position, size, anim.getFrameRect());
|
||||
}
|
||||
|
||||
void BasicRenderer2D::drawString(const String& str, const ostd::Vec2& position, const ostd::Color& color, i32 fontSize, f32 scale)
|
||||
void BasicRenderer2D::drawString(const String& str, const Vec2& position, const Color& color, i32 fontSize, f32 scale)
|
||||
{
|
||||
if (!isValid()) return;
|
||||
if (fontSize <= 0)
|
||||
|
|
@ -339,7 +339,7 @@ namespace ogfx
|
|||
x += (kern * scale);
|
||||
}
|
||||
|
||||
ostd::Vec2 verts[4] = {
|
||||
Vec2 verts[4] = {
|
||||
{ x, y },
|
||||
{ x + g->size.x * scale, y },
|
||||
{ x + g->size.x * scale, y + g->size.y * scale },
|
||||
|
|
@ -353,15 +353,15 @@ namespace ogfx
|
|||
setFontSize(oldFontSize);
|
||||
}
|
||||
|
||||
void BasicRenderer2D::drawCenteredString(const String& str, const ostd::Vec2& center, const ostd::Color& color, i32 fontSize, f32 scale)
|
||||
void BasicRenderer2D::drawCenteredString(const String& str, const Vec2& center, const Color& color, i32 fontSize, f32 scale)
|
||||
{
|
||||
auto dims = getStringDimensions(str, fontSize);
|
||||
drawString(str, { center.x - (dims.x * scale) * 0.5f, center.y - (dims.y * scale) * 0.5f }, color, fontSize, scale);
|
||||
}
|
||||
|
||||
void BasicRenderer2D::drawCenteredString(const String& str, const ostd::Rectangle& bounds, const ostd::Color& color, i32 fontSize, f32 scale)
|
||||
void BasicRenderer2D::drawCenteredString(const String& str, const Rectangle& bounds, const Color& color, i32 fontSize, f32 scale)
|
||||
{
|
||||
drawCenteredString(str, ostd::Vec2 { bounds.x + bounds.w * 0.5f, bounds.y + bounds.h * 0.5f }, color, fontSize, scale);
|
||||
drawCenteredString(str, Vec2 { bounds.x + bounds.w * 0.5f, bounds.y + bounds.h * 0.5f }, color, fontSize, scale);
|
||||
}
|
||||
// ===================================================== SPECIALIZED =====================================================
|
||||
|
||||
|
|
@ -370,7 +370,7 @@ namespace ogfx
|
|||
|
||||
|
||||
// ===================================================== PRIMITIVES =====================================================
|
||||
void BasicRenderer2D::drawLine(const ostd::FLine& line, const ostd::Color& color, i32 thickness, bool rounded)
|
||||
void BasicRenderer2D::drawLine(const FLine& line, const Color& color, i32 thickness, bool rounded)
|
||||
{
|
||||
if (!m_initialized || thickness <= 0) return;
|
||||
|
||||
|
|
@ -384,7 +384,7 @@ namespace ogfx
|
|||
f32 half = thickness * 0.5f;
|
||||
Vec2 off = perp * half;
|
||||
|
||||
std::array<ostd::Vec2, 4> verts = {{
|
||||
std::array<Vec2, 4> verts = {{
|
||||
p1 - off,
|
||||
p1 + off,
|
||||
p2 + off,
|
||||
|
|
@ -402,7 +402,7 @@ namespace ogfx
|
|||
generate_half_circle(p2, dir, half, segments, color);
|
||||
}
|
||||
|
||||
void BasicRenderer2D::drawRect(const ostd::Rectangle& rect, const ostd::Color& color, i32 thickness)
|
||||
void BasicRenderer2D::drawRect(const Rectangle& rect, const Color& color, i32 thickness)
|
||||
{
|
||||
if (!m_initialized || thickness <= 0)
|
||||
return;
|
||||
|
|
@ -428,12 +428,12 @@ namespace ogfx
|
|||
drawLine({ {x1, y2 + half}, {x1, y1 - half} }, color, thickness, false);
|
||||
}
|
||||
|
||||
void BasicRenderer2D::drawRect(const ostd::Vec2& center, const ostd::Vec2& size, const ostd::Color& color, i32 thickness)
|
||||
void BasicRenderer2D::drawRect(const Vec2& center, const Vec2& size, const Color& color, i32 thickness)
|
||||
{
|
||||
drawRect({ center.x - size.x * 0.5f, center.y - size.y * 0.5f, size.x, size.y }, color, thickness);
|
||||
}
|
||||
|
||||
void BasicRenderer2D::drawRoundRect(const ostd::Rectangle& rect, const ostd::Color& color, f32 radius, i32 thickness)
|
||||
void BasicRenderer2D::drawRoundRect(const Rectangle& rect, const Color& color, f32 radius, i32 thickness)
|
||||
{
|
||||
if (!m_initialized || thickness <= 0)
|
||||
return;
|
||||
|
|
@ -450,10 +450,10 @@ namespace ogfx
|
|||
f32 y2 = rect.y + rect.h - half;
|
||||
|
||||
// Corner centers
|
||||
ostd::Vec2 TL { x1 + radius, y1 + radius };
|
||||
ostd::Vec2 TR { x2 - radius, y1 + radius };
|
||||
ostd::Vec2 BR { x2 - radius, y2 - radius };
|
||||
ostd::Vec2 BL { x1 + radius, y2 - radius };
|
||||
Vec2 TL { x1 + radius, y1 + radius };
|
||||
Vec2 TR { x2 - radius, y1 + radius };
|
||||
Vec2 BR { x2 - radius, y2 - radius };
|
||||
Vec2 BL { x1 + radius, y2 - radius };
|
||||
|
||||
// Straight edges (shortened to meet the arcs cleanly)
|
||||
drawLine({ {x1 + radius, y1}, {x2 - radius, y1} }, color, thickness, false); // top
|
||||
|
|
@ -471,12 +471,12 @@ namespace ogfx
|
|||
generate_ellipse_stroke(BL, radius, radius, thickness, M_PI * 0.5f, M_PI, color, segments); // BL
|
||||
}
|
||||
|
||||
void BasicRenderer2D::drawRoundRect(const ostd::Vec2& center, const ostd::Vec2& size, const ostd::Color& color, f32 radius, i32 thickness)
|
||||
void BasicRenderer2D::drawRoundRect(const Vec2& center, const Vec2& size, const Color& color, f32 radius, i32 thickness)
|
||||
{
|
||||
drawRoundRect({ center.x - size.x * 0.5f, center.y - size.y * 0.5f, size.x, size.y }, color, radius, thickness);
|
||||
}
|
||||
|
||||
void BasicRenderer2D::drawCircle(const ostd::Vec2& center, f32 radius, const ostd::Color& color, i32 thickness)
|
||||
void BasicRenderer2D::drawCircle(const Vec2& center, f32 radius, const Color& color, i32 thickness)
|
||||
{
|
||||
if (!m_initialized || thickness <= 0)
|
||||
return;
|
||||
|
|
@ -484,12 +484,12 @@ namespace ogfx
|
|||
generate_ellipse_stroke(center, radius, radius, thickness, 0.0f, 2.0f * M_PI, color, segments);
|
||||
}
|
||||
|
||||
void BasicRenderer2D::drawCircle(const ostd::Rectangle& rect, const ostd::Color& color, i32 thickness)
|
||||
void BasicRenderer2D::drawCircle(const Rectangle& rect, const Color& color, i32 thickness)
|
||||
{
|
||||
if (!m_initialized || thickness <= 0)
|
||||
return;
|
||||
|
||||
ostd::Vec2 center {
|
||||
Vec2 center {
|
||||
rect.x + rect.w * 0.5f,
|
||||
rect.y + rect.h * 0.5f
|
||||
};
|
||||
|
|
@ -498,12 +498,12 @@ namespace ogfx
|
|||
drawCircle(center, radius, color, thickness);
|
||||
}
|
||||
|
||||
void BasicRenderer2D::drawEllipse(const ostd::Rectangle& rect, const ostd::Color& color, i32 thickness)
|
||||
void BasicRenderer2D::drawEllipse(const Rectangle& rect, const Color& color, i32 thickness)
|
||||
{
|
||||
if (!m_initialized || thickness <= 0)
|
||||
return;
|
||||
|
||||
ostd::Vec2 center = { rect.x + rect.w*0.5f, rect.y + rect.h*0.5f };
|
||||
Vec2 center = { rect.x + rect.w*0.5f, rect.y + rect.h*0.5f };
|
||||
f32 rx = rect.w * 0.5f;
|
||||
f32 ry = rect.h * 0.5f;
|
||||
|
||||
|
|
@ -511,7 +511,7 @@ namespace ogfx
|
|||
generate_ellipse_stroke(center, rx, ry, thickness, 0.0f, 2.0f * M_PI, color, segments);
|
||||
}
|
||||
|
||||
void BasicRenderer2D::fillRect(const ostd::Rectangle& rect, const ostd::Color& color)
|
||||
void BasicRenderer2D::fillRect(const Rectangle& rect, const Color& color)
|
||||
{
|
||||
if (!m_initialized)
|
||||
return;
|
||||
|
|
@ -521,7 +521,7 @@ namespace ogfx
|
|||
f32 x2 = rect.x + rect.w;
|
||||
f32 y2 = rect.y + rect.h;
|
||||
|
||||
ostd::Vec2 verts[4] = {
|
||||
Vec2 verts[4] = {
|
||||
{ x1, y1 },
|
||||
{ x2, y1 },
|
||||
{ x2, y2 },
|
||||
|
|
@ -531,12 +531,12 @@ namespace ogfx
|
|||
push_polygon(verts, nullptr, 4, inds, 6, color, nullptr);
|
||||
}
|
||||
|
||||
void BasicRenderer2D::fillRect(const ostd::Vec2& center, const ostd::Vec2& size, const ostd::Color& color)
|
||||
void BasicRenderer2D::fillRect(const Vec2& center, const Vec2& size, const Color& color)
|
||||
{
|
||||
fillRect({ center.x - size.x * 0.5f, center.y - size.y * 0.5f, size.x, size.y }, color);
|
||||
}
|
||||
|
||||
void BasicRenderer2D::fillRoundRect(const ostd::Rectangle& rect, const ostd::Color& color, f32 radius)
|
||||
void BasicRenderer2D::fillRoundRect(const Rectangle& rect, const Color& color, f32 radius)
|
||||
{
|
||||
if (!m_initialized)
|
||||
return;
|
||||
|
|
@ -561,7 +561,7 @@ namespace ogfx
|
|||
// 1. Fill the center rectangle
|
||||
//
|
||||
{
|
||||
ostd::Vec2 verts[4] = {
|
||||
Vec2 verts[4] = {
|
||||
{ cx1, cy1 },
|
||||
{ cx2, cy1 },
|
||||
{ cx2, cy2 },
|
||||
|
|
@ -578,7 +578,7 @@ namespace ogfx
|
|||
// Top
|
||||
if (radius > 0)
|
||||
{
|
||||
ostd::Vec2 verts[4] = {
|
||||
Vec2 verts[4] = {
|
||||
{ x1 + radius, y1 },
|
||||
{ x2 - radius, y1 },
|
||||
{ x2 - radius, y1 + radius },
|
||||
|
|
@ -590,7 +590,7 @@ namespace ogfx
|
|||
|
||||
// Bottom
|
||||
{
|
||||
ostd::Vec2 verts[4] = {
|
||||
Vec2 verts[4] = {
|
||||
{ x1 + radius, y2 - radius },
|
||||
{ x2 - radius, y2 - radius },
|
||||
{ x2 - radius, y2 },
|
||||
|
|
@ -602,7 +602,7 @@ namespace ogfx
|
|||
|
||||
// Left
|
||||
{
|
||||
ostd::Vec2 verts[4] = {
|
||||
Vec2 verts[4] = {
|
||||
{ x1, y1 + radius },
|
||||
{ x1 + radius, y1 + radius },
|
||||
{ x1 + radius, y2 - radius },
|
||||
|
|
@ -614,7 +614,7 @@ namespace ogfx
|
|||
|
||||
// Right
|
||||
{
|
||||
ostd::Vec2 verts[4] = {
|
||||
Vec2 verts[4] = {
|
||||
{ x2 - radius, y1 + radius },
|
||||
{ x2, y1 + radius },
|
||||
{ x2, y2 - radius },
|
||||
|
|
@ -634,12 +634,12 @@ namespace ogfx
|
|||
generate_filled_ellipse_stroke({cx1, cy2}, radius, radius, 0.5f * M_PI, color, segments); // BL
|
||||
}
|
||||
|
||||
void BasicRenderer2D::fillRoundRect(const ostd::Vec2& center, const ostd::Vec2& size, const ostd::Color& color, f32 radius)
|
||||
void BasicRenderer2D::fillRoundRect(const Vec2& center, const Vec2& size, const Color& color, f32 radius)
|
||||
{
|
||||
fillRoundRect({ center.x - size.x * 0.5f, center.y - size.y * 0.5f, size.x, size.y }, color, radius);
|
||||
}
|
||||
|
||||
void BasicRenderer2D::fillCircle(const ostd::Vec2& center, f32 radius, const ostd::Color& color)
|
||||
void BasicRenderer2D::fillCircle(const Vec2& center, f32 radius, const Color& color)
|
||||
{
|
||||
if (!m_initialized)
|
||||
return;
|
||||
|
|
@ -648,12 +648,12 @@ namespace ogfx
|
|||
generate_filled_ellipse(center, radius, radius, color, segments);
|
||||
}
|
||||
|
||||
void BasicRenderer2D::fillCircle(const ostd::Rectangle& rect, const ostd::Color& color)
|
||||
void BasicRenderer2D::fillCircle(const Rectangle& rect, const Color& color)
|
||||
{
|
||||
if (!m_initialized)
|
||||
return;
|
||||
|
||||
ostd::Vec2 center {
|
||||
Vec2 center {
|
||||
rect.x + rect.w * 0.5f,
|
||||
rect.y + rect.h * 0.5f
|
||||
};
|
||||
|
|
@ -662,12 +662,12 @@ namespace ogfx
|
|||
fillCircle(center, radius, color);
|
||||
}
|
||||
|
||||
void BasicRenderer2D::fillEllipse(const ostd::Rectangle& rect, const ostd::Color& color)
|
||||
void BasicRenderer2D::fillEllipse(const Rectangle& rect, const Color& color)
|
||||
{
|
||||
if (!m_initialized)
|
||||
return;
|
||||
|
||||
ostd::Vec2 center {
|
||||
Vec2 center {
|
||||
rect.x + rect.w * 0.5f,
|
||||
rect.y + rect.h * 0.5f
|
||||
};
|
||||
|
|
@ -679,45 +679,45 @@ namespace ogfx
|
|||
generate_filled_ellipse(center, radiusX, radiusY, color, segments);
|
||||
}
|
||||
|
||||
void BasicRenderer2D::outlinedRect(const ostd::Rectangle& rect, const ostd::Color& fillColor, const ostd::Color& outlineColor, i32 outlineThickness)
|
||||
void BasicRenderer2D::outlinedRect(const Rectangle& rect, const Color& fillColor, const Color& outlineColor, i32 outlineThickness)
|
||||
{
|
||||
if (!m_initialized) return;
|
||||
ostd::Rectangle offset = { 1, 1, -2, -2 };
|
||||
Rectangle offset = { 1, 1, -2, -2 };
|
||||
fillRect(rect + offset, fillColor);
|
||||
drawRect(rect, outlineColor, outlineThickness);
|
||||
}
|
||||
|
||||
void BasicRenderer2D::outlinedRect(const ostd::Vec2& center, const ostd::Vec2& size, const ostd::Color& fillColor, const ostd::Color& outlineColor, i32 outlineThickness)
|
||||
void BasicRenderer2D::outlinedRect(const Vec2& center, const Vec2& size, const Color& fillColor, const Color& outlineColor, i32 outlineThickness)
|
||||
{
|
||||
outlinedRect({ center.x - size.x * 0.5f, center.y - size.y * 0.5f, size.x, size.y }, fillColor, outlineColor, outlineThickness);
|
||||
}
|
||||
|
||||
void BasicRenderer2D::outlinedRoundRect(const ostd::Rectangle& rect, const ostd::Color& fillColor, const ostd::Color& outlineColor, f32 radius, i32 outlineThickness)
|
||||
void BasicRenderer2D::outlinedRoundRect(const Rectangle& rect, const Color& fillColor, const Color& outlineColor, f32 radius, i32 outlineThickness)
|
||||
{
|
||||
if (!m_initialized) return;
|
||||
ostd::Rectangle offset = { 1, 1, -2, -2 };
|
||||
Rectangle offset = { 1, 1, -2, -2 };
|
||||
fillRoundRect(rect + offset, fillColor, radius);
|
||||
drawRoundRect(rect, outlineColor, radius, outlineThickness);
|
||||
}
|
||||
|
||||
void BasicRenderer2D::outlinedRoundRect(const ostd::Vec2& center, const ostd::Vec2& size, const ostd::Color& fillColor, const ostd::Color& outlineColor, f32 radius, i32 outlineThickness)
|
||||
void BasicRenderer2D::outlinedRoundRect(const Vec2& center, const Vec2& size, const Color& fillColor, const Color& outlineColor, f32 radius, i32 outlineThickness)
|
||||
{
|
||||
outlinedRoundRect({ center.x - size.x * 0.5f, center.y - size.y * 0.5f, size.x, size.y }, fillColor, outlineColor, radius, outlineThickness);
|
||||
}
|
||||
|
||||
void BasicRenderer2D::outlinedCircle(const ostd::Vec2& center, f32 radius, const ostd::Color& fillColor, const ostd::Color& outlineColor, i32 outlineThickness)
|
||||
void BasicRenderer2D::outlinedCircle(const Vec2& center, f32 radius, const Color& fillColor, const Color& outlineColor, i32 outlineThickness)
|
||||
{
|
||||
if (!m_initialized) return;
|
||||
fillCircle(center, radius - 1, fillColor);
|
||||
drawCircle(center, radius, outlineColor, outlineThickness);
|
||||
}
|
||||
|
||||
void BasicRenderer2D::outlinedCircle(const ostd::Rectangle& rect, const ostd::Color& fillColor, const ostd::Color& outlineColor, i32 outlineThickness)
|
||||
void BasicRenderer2D::outlinedCircle(const Rectangle& rect, const Color& fillColor, const Color& outlineColor, i32 outlineThickness)
|
||||
{
|
||||
if (!m_initialized)
|
||||
return;
|
||||
|
||||
ostd::Vec2 center {
|
||||
Vec2 center {
|
||||
rect.x + rect.w * 0.5f,
|
||||
rect.y + rect.h * 0.5f
|
||||
};
|
||||
|
|
@ -726,10 +726,10 @@ namespace ogfx
|
|||
outlinedCircle(center, radius, fillColor, outlineColor, outlineThickness);
|
||||
}
|
||||
|
||||
void BasicRenderer2D::outlinedEllipse(const ostd::Rectangle& rect, const ostd::Color& fillColor, const ostd::Color& outlineColor, i32 outlineThickness)
|
||||
void BasicRenderer2D::outlinedEllipse(const Rectangle& rect, const Color& fillColor, const Color& outlineColor, i32 outlineThickness)
|
||||
{
|
||||
if (!m_initialized) return;
|
||||
ostd::Rectangle offset = { 1, 1, -2, -2 };
|
||||
Rectangle offset = { 1, 1, -2, -2 };
|
||||
fillEllipse(rect + offset, fillColor);
|
||||
drawEllipse(rect, outlineColor, outlineThickness);
|
||||
}
|
||||
|
|
@ -744,7 +744,7 @@ namespace ogfx
|
|||
{
|
||||
for (auto& v : m_vertices)
|
||||
{
|
||||
v.color = COLOR_CAST(ostd::Colors::Transparent);
|
||||
v.color = COLOR_CAST(Colors::Transparent);
|
||||
v.position = { 0, 0 };
|
||||
v.tex_coord = { 0, 0 };
|
||||
}
|
||||
|
|
@ -752,7 +752,7 @@ namespace ogfx
|
|||
i = 0;
|
||||
}
|
||||
|
||||
void BasicRenderer2D::generate_half_circle(const ostd::Vec2& center, const ostd::Vec2& dir, f32 radius, i32 segments, const ostd::Color& color)
|
||||
void BasicRenderer2D::generate_half_circle(const Vec2& center, const Vec2& dir, f32 radius, i32 segments, const Color& color)
|
||||
{
|
||||
// Ensure we have room
|
||||
if (m_vertexCount + segments + 2 >= MaxVertices || m_indexCount + segments * 3 >= MaxIndices)
|
||||
|
|
@ -802,7 +802,7 @@ namespace ogfx
|
|||
}
|
||||
}
|
||||
|
||||
void BasicRenderer2D::generate_quarter_circle(const ostd::Vec2& center, f32 radius, f32 thickness, f32 startAngle, const ostd::Color& color, i32 segments)
|
||||
void BasicRenderer2D::generate_quarter_circle(const Vec2& center, f32 radius, f32 thickness, f32 startAngle, const Color& color, i32 segments)
|
||||
{
|
||||
f32 half = thickness * 0.5f;
|
||||
|
||||
|
|
@ -866,7 +866,7 @@ namespace ogfx
|
|||
}
|
||||
}
|
||||
|
||||
void BasicRenderer2D::generate_circle_stroke(const ostd::Vec2& center, f32 radius, f32 thickness, const ostd::Color& color, i32 segments)
|
||||
void BasicRenderer2D::generate_circle_stroke(const Vec2& center, f32 radius, f32 thickness, const Color& color, i32 segments)
|
||||
{
|
||||
f32 half = thickness * 0.5f;
|
||||
|
||||
|
|
@ -927,7 +927,7 @@ namespace ogfx
|
|||
}
|
||||
}
|
||||
|
||||
void BasicRenderer2D::generate_ellipse_stroke(const ostd::Vec2& center, f32 radiusX, f32 radiusY, f32 thickness, f32 startAngle, f32 endAngle, const ostd::Color& color, i32 segments)
|
||||
void BasicRenderer2D::generate_ellipse_stroke(const Vec2& center, f32 radiusX, f32 radiusY, f32 thickness, f32 startAngle, f32 endAngle, const Color& color, i32 segments)
|
||||
{
|
||||
f32 half = thickness * 0.5f;
|
||||
|
||||
|
|
@ -993,7 +993,7 @@ namespace ogfx
|
|||
}
|
||||
}
|
||||
|
||||
void BasicRenderer2D::generate_filled_ellipse_stroke(const ostd::Vec2& center, f32 radiusX, f32 radiusY, f32 startAngle, const ostd::Color& color, i32 segments)
|
||||
void BasicRenderer2D::generate_filled_ellipse_stroke(const Vec2& center, f32 radiusX, f32 radiusY, f32 startAngle, const Color& color, i32 segments)
|
||||
{
|
||||
// Ensure capacity
|
||||
if (m_vertexCount + segments + 2 >= MaxVertices || m_indexCount + segments * 3 >= MaxIndices)
|
||||
|
|
@ -1036,7 +1036,7 @@ namespace ogfx
|
|||
}
|
||||
}
|
||||
|
||||
void BasicRenderer2D::generate_filled_ellipse(const ostd::Vec2& center, f32 radiusX, f32 radiusY, const ostd::Color& color, i32 segments)
|
||||
void BasicRenderer2D::generate_filled_ellipse(const Vec2& center, f32 radiusX, f32 radiusY, const Color& color, i32 segments)
|
||||
{
|
||||
// Ensure capacity
|
||||
if (m_vertexCount + segments + 2 >= MaxVertices || m_indexCount + segments * 3 >= MaxIndices)
|
||||
|
|
@ -1078,7 +1078,7 @@ namespace ogfx
|
|||
}
|
||||
}
|
||||
|
||||
void BasicRenderer2D::push_polygon(const ostd::Vec2* verts, const ostd::Vec2* texCoords, u32 vertCount, const u32* inds, u32 indexCount, const ostd::Color& color, SDL_Texture* texture)
|
||||
void BasicRenderer2D::push_polygon(const Vec2* verts, const Vec2* texCoords, u32 vertCount, const u32* inds, u32 indexCount, const Color& color, SDL_Texture* texture)
|
||||
{
|
||||
if (!m_initialized || vertCount <= 0 || indexCount <= 0)
|
||||
return;
|
||||
|
|
@ -1100,7 +1100,7 @@ namespace ogfx
|
|||
bool hasTexCoords = texCoords != nullptr;
|
||||
for (i32 i = 0; i < vertCount; i++)
|
||||
{
|
||||
ostd::Vec2 tc { 0.0f, 0.0f };
|
||||
Vec2 tc { 0.0f, 0.0f };
|
||||
if (hasTexCoords)
|
||||
tc = texCoords[i];
|
||||
m_vertices[m_vertexCount++] = {
|
||||
|
|
|
|||
|
|
@ -61,14 +61,14 @@ namespace ogfx
|
|||
SDL_Renderer* getSDLRenderer(void) const;
|
||||
void flushBatch(void);
|
||||
void endFrame(void);
|
||||
void pushClippingRect(const ostd::Rectangle& rect, bool additive = false);
|
||||
void pushClippingRect(const Rectangle& rect, bool additive = false);
|
||||
void popClippingRect(void);
|
||||
i32 loadDefaultFont(i32 fontSize = 0);
|
||||
void closeFont(void);
|
||||
i32 openFont(const String& fontPath, i32 fontSize = 0);
|
||||
i32 openFont(const ostd::UByte resource_data[], u32 data_size, i32 fontSize = 0);
|
||||
i32 setFontSize(i32 fontSize);
|
||||
ostd::Vec2 getStringDimensions(const String& message, i32 fontSize = 0, TTF_Font* font = nullptr);
|
||||
Vec2 getStringDimensions(const String& message, i32 fontSize = 0, TTF_Font* font = nullptr);
|
||||
|
||||
inline u32 getDrawCallCount(void) { return m_drawCallCount; }
|
||||
inline bool hasOpenFont(void) { return m_fontOpen; }
|
||||
|
|
@ -80,48 +80,48 @@ namespace ogfx
|
|||
inline bool isInitialized(void) { return m_initialized; }
|
||||
inline FontGlyphAtlas& getFontGlyphAtlas(void) { return m_fontGlyphAtlas; }
|
||||
|
||||
void drawImage(const ogfx::Image& image, const ostd::Vec2& position, const ostd::Vec2& size = { 0, 0 }, const ostd::Rectangle& srcRect = { 0, 0, 0, 0 });
|
||||
void drawAnimation(const Animation& anim, const ostd::Vec2& position, const ostd::Vec2& size = { 0, 0 });
|
||||
void drawImage(const ogfx::Image& image, const Vec2& position, const Vec2& size = { 0, 0 }, const Rectangle& srcRect = { 0, 0, 0, 0 });
|
||||
void drawAnimation(const Animation& anim, const Vec2& position, const Vec2& size = { 0, 0 });
|
||||
|
||||
void drawString(const String& str, const ostd::Vec2& position, const ostd::Color& color, i32 fontSize = 0, f32 scale = 1.0f);
|
||||
void drawCenteredString(const String& str, const ostd::Vec2& center, const ostd::Color& color, i32 fontSize = 0, f32 scale = 1.0f);
|
||||
void drawCenteredString(const String& str, const ostd::Rectangle& bounds, const ostd::Color& color, i32 fontSize = 0, f32 scale = 1.0f);
|
||||
void drawString(const String& str, const Vec2& position, const Color& color, i32 fontSize = 0, f32 scale = 1.0f);
|
||||
void drawCenteredString(const String& str, const Vec2& center, const Color& color, i32 fontSize = 0, f32 scale = 1.0f);
|
||||
void drawCenteredString(const String& str, const Rectangle& bounds, const Color& color, i32 fontSize = 0, f32 scale = 1.0f);
|
||||
|
||||
void drawLine(const ostd::FLine& line, const ostd::Color& color, i32 thickness = 1, bool rounded = true);
|
||||
void drawLine(const FLine& line, const Color& color, i32 thickness = 1, bool rounded = true);
|
||||
|
||||
void drawRect(const ostd::Rectangle& rect, const ostd::Color& color, i32 thickness = 1);
|
||||
void drawRect(const ostd::Vec2& center, const ostd::Vec2& size, const ostd::Color& color, i32 thickness = 1);
|
||||
void drawRoundRect(const ostd::Vec2& center, const ostd::Vec2& size, const ostd::Color& color, f32 radius, i32 thickness = 1);
|
||||
void drawRoundRect(const ostd::Rectangle& rect, const ostd::Color& color, f32 radius, i32 thickness = 1);
|
||||
void drawCircle(const ostd::Vec2& center, f32 radius, const ostd::Color& color, i32 thickness = 1);
|
||||
void drawCircle(const ostd::Rectangle& rect, const ostd::Color& color, i32 thickness = 1);
|
||||
void drawEllipse(const ostd::Rectangle& rect, const ostd::Color& color, i32 thickness = 1);
|
||||
void drawRect(const Rectangle& rect, const Color& color, i32 thickness = 1);
|
||||
void drawRect(const Vec2& center, const Vec2& size, const Color& color, i32 thickness = 1);
|
||||
void drawRoundRect(const Vec2& center, const Vec2& size, const Color& color, f32 radius, i32 thickness = 1);
|
||||
void drawRoundRect(const Rectangle& rect, const Color& color, f32 radius, i32 thickness = 1);
|
||||
void drawCircle(const Vec2& center, f32 radius, const Color& color, i32 thickness = 1);
|
||||
void drawCircle(const Rectangle& rect, const Color& color, i32 thickness = 1);
|
||||
void drawEllipse(const Rectangle& rect, const Color& color, i32 thickness = 1);
|
||||
|
||||
void fillRect(const ostd::Rectangle& rect, const ostd::Color& color);
|
||||
void fillRect(const ostd::Vec2& center, const ostd::Vec2& size, const ostd::Color& color);
|
||||
void fillRoundRect(const ostd::Rectangle& rect, const ostd::Color& color, f32 radius);
|
||||
void fillRoundRect(const ostd::Vec2& center, const ostd::Vec2& size, const ostd::Color& color, f32 radius);
|
||||
void fillCircle(const ostd::Vec2& center, f32 radius, const ostd::Color& color);
|
||||
void fillCircle(const ostd::Rectangle& rect, const ostd::Color& color);
|
||||
void fillEllipse(const ostd::Rectangle& rect, const ostd::Color& color);
|
||||
void fillRect(const Rectangle& rect, const Color& color);
|
||||
void fillRect(const Vec2& center, const Vec2& size, const Color& color);
|
||||
void fillRoundRect(const Rectangle& rect, const Color& color, f32 radius);
|
||||
void fillRoundRect(const Vec2& center, const Vec2& size, const Color& color, f32 radius);
|
||||
void fillCircle(const Vec2& center, f32 radius, const Color& color);
|
||||
void fillCircle(const Rectangle& rect, const Color& color);
|
||||
void fillEllipse(const Rectangle& rect, const Color& color);
|
||||
|
||||
void outlinedRect(const ostd::Vec2& center, const ostd::Vec2& size, const ostd::Color& fillColor, const ostd::Color& outlineColor, i32 outlineThickness = 1);
|
||||
void outlinedRect(const ostd::Rectangle& rect, const ostd::Color& fillColor, const ostd::Color& outlineColor, i32 outlineThickness = 1);
|
||||
void outlinedRoundRect(const ostd::Rectangle& rect, const ostd::Color& fillColor, const ostd::Color& outlineColor, f32 radius, i32 outlineThickness = 1);
|
||||
void outlinedRoundRect(const ostd::Vec2& center, const ostd::Vec2& size, const ostd::Color& fillColor, const ostd::Color& outlineColor, f32 radius, i32 outlineThickness = 1);
|
||||
void outlinedCircle(const ostd::Vec2& center, f32 radius, const ostd::Color& fillColor, const ostd::Color& outlineColor, i32 outlineThickness = 1);
|
||||
void outlinedCircle(const ostd::Rectangle& rect, const ostd::Color& fillColor, const ostd::Color& outlineColor, i32 outlineThickness = 1);
|
||||
void outlinedEllipse(const ostd::Rectangle& rect, const ostd::Color& fillColor, const ostd::Color& outlineColor, i32 outlineThickness = 1);
|
||||
void outlinedRect(const Vec2& center, const Vec2& size, const Color& fillColor, const Color& outlineColor, i32 outlineThickness = 1);
|
||||
void outlinedRect(const Rectangle& rect, const Color& fillColor, const Color& outlineColor, i32 outlineThickness = 1);
|
||||
void outlinedRoundRect(const Rectangle& rect, const Color& fillColor, const Color& outlineColor, f32 radius, i32 outlineThickness = 1);
|
||||
void outlinedRoundRect(const Vec2& center, const Vec2& size, const Color& fillColor, const Color& outlineColor, f32 radius, i32 outlineThickness = 1);
|
||||
void outlinedCircle(const Vec2& center, f32 radius, const Color& fillColor, const Color& outlineColor, i32 outlineThickness = 1);
|
||||
void outlinedCircle(const Rectangle& rect, const Color& fillColor, const Color& outlineColor, i32 outlineThickness = 1);
|
||||
void outlinedEllipse(const Rectangle& rect, const Color& fillColor, const Color& outlineColor, i32 outlineThickness = 1);
|
||||
|
||||
private:
|
||||
void init_arrays(void);
|
||||
void generate_half_circle(const ostd::Vec2& center, const ostd::Vec2& dir, f32 radius, i32 segments, const ostd::Color& color);
|
||||
void generate_quarter_circle(const ostd::Vec2& center, f32 radius, f32 thickness, f32 startAngle, const ostd::Color& color, i32 segments);
|
||||
void generate_circle_stroke(const ostd::Vec2& center, f32 radius, f32 thickness, const ostd::Color& color, i32 segments);
|
||||
void generate_ellipse_stroke(const ostd::Vec2& center, f32 radiusX, f32 radiusY, f32 thickness, f32 startAngle, f32 endAngle, const ostd::Color& color, i32 segments);
|
||||
void generate_filled_ellipse_stroke(const ostd::Vec2& center, f32 radiusX, f32 radiusY, f32 startAngle, const ostd::Color& color, i32 segments);
|
||||
void generate_filled_ellipse(const ostd::Vec2& center, f32 radiusX, f32 radiusY, const ostd::Color& color, i32 segments);
|
||||
void push_polygon(const ostd::Vec2* verts, const ostd::Vec2* texCoords, u32 vertCount, const u32* inds, u32 indexCount, const ostd::Color& color, SDL_Texture* texture);
|
||||
void generate_half_circle(const Vec2& center, const Vec2& dir, f32 radius, i32 segments, const Color& color);
|
||||
void generate_quarter_circle(const Vec2& center, f32 radius, f32 thickness, f32 startAngle, const Color& color, i32 segments);
|
||||
void generate_circle_stroke(const Vec2& center, f32 radius, f32 thickness, const Color& color, i32 segments);
|
||||
void generate_ellipse_stroke(const Vec2& center, f32 radiusX, f32 radiusY, f32 thickness, f32 startAngle, f32 endAngle, const Color& color, i32 segments);
|
||||
void generate_filled_ellipse_stroke(const Vec2& center, f32 radiusX, f32 radiusY, f32 startAngle, const Color& color, i32 segments);
|
||||
void generate_filled_ellipse(const Vec2& center, f32 radiusX, f32 radiusY, const Color& color, i32 segments);
|
||||
void push_polygon(const Vec2* verts, const Vec2* texCoords, u32 vertCount, const u32* inds, u32 indexCount, const Color& color, SDL_Texture* texture);
|
||||
void print_ttf_error(const String& funcName);
|
||||
inline i32 set_error_state(i32 err) { m_errorState = err; return m_errorState; }
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ namespace ogfx
|
|||
WindowCore* m_window { nullptr };
|
||||
ostd::ConsoleOutputHandler m_out;
|
||||
bool m_initialized { false };
|
||||
stdvec<ostd::Rectangle> m_clipStack;
|
||||
stdvec<Rectangle> m_clipStack;
|
||||
|
||||
std::array<SDL_Vertex, MaxVertices> m_vertices;
|
||||
std::array<i32, MaxIndices> m_indices;
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ namespace ogfx
|
|||
{
|
||||
public: struct GlyphInfo
|
||||
{
|
||||
ostd::Vec2 uvs[4];
|
||||
Vec2 uvs[4];
|
||||
SDL_Texture* atlas { nullptr };
|
||||
ostd::Vec2 size;
|
||||
Vec2 size;
|
||||
u32 codepoint { 0 };
|
||||
i32 advance { 0 };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ namespace ogfx
|
|||
characterMap[c] = getCharacterIndex(c);
|
||||
}
|
||||
|
||||
bool PixelRenderer::TextRenderer::drawString(const String& str, u32 column, u32 row, u32* screenPixels, i32 screenWidth, i32 screenHeight, u32* fontPixels, const ostd::Color& color, const ostd::Color& background)
|
||||
bool PixelRenderer::TextRenderer::drawString(const String& str, u32 column, u32 row, u32* screenPixels, i32 screenWidth, i32 screenHeight, u32* fontPixels, const Color& color, const Color& background)
|
||||
{
|
||||
String se(str);
|
||||
if (se == "") return false;
|
||||
|
|
@ -64,7 +64,7 @@ namespace ogfx
|
|||
return charIndex;
|
||||
}
|
||||
|
||||
ostd::Color PixelRenderer::TextRenderer::applyTint(const ostd::Color& baseColor, const ostd::Color& tintColor)
|
||||
Color PixelRenderer::TextRenderer::applyTint(const Color& baseColor, const Color& tintColor)
|
||||
{
|
||||
auto nBase = baseColor.getNormalizedColor();
|
||||
auto nTint = tintColor.getNormalizedColor();
|
||||
|
|
@ -73,12 +73,12 @@ namespace ogfx
|
|||
f32 g = nBase.r * nTint.g;
|
||||
f32 b = nBase.r * nTint.b;
|
||||
|
||||
ostd::Color::FloatCol nTinted(r, g, b, 1.0f);
|
||||
Color::FloatCol nTinted(r, g, b, 1.0f);
|
||||
|
||||
return ostd::Color(nTinted);
|
||||
return Color(nTinted);
|
||||
}
|
||||
|
||||
void PixelRenderer::TextRenderer::drawCharacter(u8* screenPixels, i32 screenWidth, i32 screenHeight, u8* fontPixels, i32 x, i32 y, char c, const ostd::Color& color, const ostd::Color& background)
|
||||
void PixelRenderer::TextRenderer::drawCharacter(u8* screenPixels, i32 screenWidth, i32 screenHeight, u8* fontPixels, i32 x, i32 y, char c, const Color& color, const Color& background)
|
||||
{
|
||||
using namespace ostd;
|
||||
i32 charIndex = characterMap[c];
|
||||
|
|
@ -86,7 +86,7 @@ namespace ogfx
|
|||
|
||||
i32 screenx = x * 4, screeny = y;
|
||||
|
||||
ostd::Color tintedColor;
|
||||
Color tintedColor;
|
||||
|
||||
bool applyBackground = false;
|
||||
for (i32 y = charCoords.y; y < charCoords.y + (FONT_CHAR_H); y += 1)
|
||||
|
|
@ -176,7 +176,7 @@ namespace ogfx
|
|||
SDL_RenderTexture(m_parent->getSDLRenderer(), m_texture, NULL, &rect);
|
||||
}
|
||||
|
||||
void PixelRenderer::clear(const ostd::Color& color)
|
||||
void PixelRenderer::clear(const Color& color)
|
||||
{
|
||||
if (isInvalid()) return;
|
||||
for (i32 y = 0; y < m_windowHeight; y++)
|
||||
|
|
@ -184,7 +184,7 @@ namespace ogfx
|
|||
for (u32 x = 0; x < m_windowWidth; x++)
|
||||
{
|
||||
i32 index = CONVERT_2D_1D(x, y, m_windowWidth);
|
||||
m_pixels[index] = color.asInteger(ostd::Color::eColorFormat::ARGB);
|
||||
m_pixels[index] = color.asInteger(Color::eColorFormat::ARGB);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,12 +38,12 @@ namespace ogfx
|
|||
|
||||
public:
|
||||
static void initialize(void);
|
||||
static bool drawString(const String& str, u32 column, u32 row, u32* screenPixels, i32 screenWidth, i32 screenHeight, u32* fontPixels, const ostd::Color& color = { 255, 255, 255, 255 }, const ostd::Color& background = { 255, 255, 255, 0 });
|
||||
static bool drawString(const String& str, u32 column, u32 row, u32* screenPixels, i32 screenWidth, i32 screenHeight, u32* fontPixels, const Color& color = { 255, 255, 255, 255 }, const Color& background = { 255, 255, 255, 0 });
|
||||
|
||||
private:
|
||||
static i32 getCharacterIndex(char c);
|
||||
static ostd::Color applyTint(const ostd::Color& baseColor, const ostd::Color& tintColor);
|
||||
static void drawCharacter(u8* screenPixels, i32 screenWidth, i32 screenHeight, u8* fontPixels, i32 x, i32 y, char c, const ostd::Color& color = { 255, 255, 255, 255 }, const ostd::Color& background = { 255, 255, 255, 0 });
|
||||
static Color applyTint(const Color& baseColor, const Color& tintColor);
|
||||
static void drawCharacter(u8* screenPixels, i32 screenWidth, i32 screenHeight, u8* fontPixels, i32 x, i32 y, char c, const Color& color = { 255, 255, 255, 255 }, const Color& background = { 255, 255, 255, 0 });
|
||||
|
||||
public:
|
||||
inline static constexpr i32 FONT_CHAR_W = 11;
|
||||
|
|
@ -89,7 +89,7 @@ namespace ogfx
|
|||
void displayBuffer(void);
|
||||
inline u32* getScreenPixels(void) { return m_pixels; }
|
||||
|
||||
void clear(const ostd::Color& color);
|
||||
void clear(const Color& color);
|
||||
|
||||
private:
|
||||
u32* m_pixels { nullptr };
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace ogfx
|
|||
inline ~Image(void) { destroy(); }
|
||||
void destroy(void);
|
||||
Image& loadFromFile(const String& filePath, BasicRenderer2D& gfx);
|
||||
inline ostd::Vec2 getSize(void) const { return { m_width, m_height }; }
|
||||
inline Vec2 getSize(void) const { return { m_width, m_height }; }
|
||||
inline bool isLoaded(void) const { return m_loaded; }
|
||||
inline SDL_Texture* getSDLTexture(void) const { return m_sdl_texture; }
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ namespace ogfx
|
|||
inline i32 getColumnOffset(void) const { return m_column_offset; }
|
||||
inline i32 getRowOffset(void) const { return m_row_offset; }
|
||||
inline bool isStill(void) const { return m_still; }
|
||||
inline ostd::Rectangle getFrameRect(void) const { return m_frame_rect; }
|
||||
inline Rectangle getFrameRect(void) const { return m_frame_rect; }
|
||||
inline const Image& getSpriteSheet(void) const { return (m_spriteSheet != nullptr ? *m_spriteSheet : InvalidImage); }
|
||||
inline Image& getSpriteSheet(void) { return (m_spriteSheet != nullptr ? *m_spriteSheet : InvalidImage); }
|
||||
inline bool hasImage(void) const { return m_spriteSheet != nullptr; }
|
||||
|
|
@ -114,6 +114,6 @@ namespace ogfx
|
|||
bool m_still;
|
||||
bool m_random;
|
||||
|
||||
ostd::Rectangle m_frame_rect;
|
||||
Rectangle m_frame_rect;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,3 +154,9 @@ namespace ostd
|
|||
inline static const Color DarkYellow { 204, 204, 0, 255 };
|
||||
};
|
||||
}
|
||||
|
||||
using Colors = ostd::Colors;
|
||||
namespace ogfx
|
||||
{
|
||||
using Color = ostd::Color;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,10 +46,10 @@ namespace ostd
|
|||
catch (const json::exception&) { return String(""); }
|
||||
}
|
||||
};
|
||||
// ----- ostd::Color -------------------------------------------------
|
||||
template<> struct Getter<ostd::Color>
|
||||
// ----- Color -------------------------------------------------
|
||||
template<> struct Getter<Color>
|
||||
{
|
||||
static ostd::Color exec_impl(const std::string& p, const json& root)
|
||||
static Color exec_impl(const std::string& p, const json& root)
|
||||
{
|
||||
try {
|
||||
const json& node = root.at(p);
|
||||
|
|
@ -59,8 +59,8 @@ namespace ostd
|
|||
{
|
||||
const std::string& hex = node.get<std::string>();
|
||||
if (hex.starts_with("#") && hex.size() == 9) // 9 for #RRGGBBAA
|
||||
return ostd::Color(hex);
|
||||
return ostd::Color(); // Not a valid hex format
|
||||
return Color(hex);
|
||||
return Color(); // Not a valid hex format
|
||||
}
|
||||
|
||||
// Case 2: Array of integers
|
||||
|
|
@ -69,31 +69,31 @@ namespace ostd
|
|||
stdvec<i32> vals;
|
||||
for (const auto& v : node)
|
||||
{
|
||||
if (!v.is_number_integer()) return ostd::Color();
|
||||
if (!v.is_number_integer()) return Color();
|
||||
i32 iv = v.get<i32>();
|
||||
if (iv < 0 || iv > 255) return ostd::Color();
|
||||
if (iv < 0 || iv > 255) return Color();
|
||||
vals.push_back(iv);
|
||||
}
|
||||
|
||||
switch (vals.size())
|
||||
{
|
||||
case 1: return ostd::Color(vals[0], vals[0], vals[0]);
|
||||
case 3: return ostd::Color(vals[0], vals[1], vals[2]);
|
||||
case 4: return ostd::Color(vals[0], vals[1], vals[2], vals[3]);
|
||||
default: return ostd::Color();
|
||||
case 1: return Color(vals[0], vals[0], vals[0]);
|
||||
case 3: return Color(vals[0], vals[1], vals[2]);
|
||||
case 4: return Color(vals[0], vals[1], vals[2], vals[3]);
|
||||
default: return Color();
|
||||
}
|
||||
}
|
||||
|
||||
// Anything else → default color
|
||||
return ostd::Color();
|
||||
return Color();
|
||||
}
|
||||
catch (...) { return ostd::Color(); }
|
||||
catch (...) { return Color(); }
|
||||
}
|
||||
};
|
||||
// ----- ostd::Rectangle -------------------------------------------------
|
||||
template<> struct Getter<ostd::Rectangle>
|
||||
// ----- Rectangle -------------------------------------------------
|
||||
template<> struct Getter<Rectangle>
|
||||
{
|
||||
static ostd::Rectangle exec_impl(const std::string& p, const json& root)
|
||||
static Rectangle exec_impl(const std::string& p, const json& root)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -105,16 +105,16 @@ namespace ostd
|
|||
for (const auto& v : node)
|
||||
{
|
||||
if (!v.is_number_float() && !v.is_number_integer())
|
||||
return ostd::Rectangle();
|
||||
return Rectangle();
|
||||
vals.push_back(v.get<f32>());
|
||||
}
|
||||
return ostd::Rectangle(vals[0], vals[1], vals[2], vals[3]);
|
||||
return Rectangle(vals[0], vals[1], vals[2], vals[3]);
|
||||
}
|
||||
return ostd::Rectangle();
|
||||
return Rectangle();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return ostd::Rectangle();
|
||||
return Rectangle();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -175,12 +175,12 @@ namespace ostd
|
|||
return result;
|
||||
}
|
||||
};
|
||||
// ----- stdvec<ostd::Color> -----------------------------------
|
||||
template<> struct Getter<stdvec<ostd::Color>>
|
||||
// ----- stdvec<Color> -----------------------------------
|
||||
template<> struct Getter<stdvec<Color>>
|
||||
{
|
||||
static stdvec<ostd::Color> exec_impl(const std::string& p, const json& root)
|
||||
static stdvec<Color> exec_impl(const std::string& p, const json& root)
|
||||
{
|
||||
stdvec<ostd::Color> result;
|
||||
stdvec<Color> result;
|
||||
try
|
||||
{
|
||||
const json& node = root.at(p);
|
||||
|
|
@ -190,9 +190,9 @@ namespace ostd
|
|||
for (const auto& element : node)
|
||||
{
|
||||
// We temporarily create a fake "sub-root" that only contains one key "color"
|
||||
// This lets us call the existing Getter<ostd::Color> without modifying it
|
||||
// This lets us call the existing Getter<Color> without modifying it
|
||||
json fake_root = { { "color", element } };
|
||||
ostd::Color color = Getter<ostd::Color>::exec_impl("color", fake_root);
|
||||
Color color = Getter<Color>::exec_impl("color", fake_root);
|
||||
result.push_back(color);
|
||||
}
|
||||
return result;
|
||||
|
|
@ -203,30 +203,30 @@ namespace ostd
|
|||
}
|
||||
}
|
||||
};
|
||||
// ----- stdvec<ostd::Vec2> -----------------------------------
|
||||
template<> struct Getter<ostd::Vec2>
|
||||
// ----- stdvec<Vec2> -----------------------------------
|
||||
template<> struct Getter<Vec2>
|
||||
{
|
||||
static ostd::Vec2 exec_impl(const std::string& p, const json& root)
|
||||
static Vec2 exec_impl(const std::string& p, const json& root)
|
||||
{
|
||||
try
|
||||
{
|
||||
const json& arr = root.at(p);
|
||||
if (!arr.is_array() || arr.size() != 2)
|
||||
return ostd::Vec2();
|
||||
return ostd::Vec2(arr[0].get<f32>(), arr[1].get<f32>());
|
||||
return Vec2();
|
||||
return Vec2(arr[0].get<f32>(), arr[1].get<f32>());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return ostd::Vec2();
|
||||
return Vec2();
|
||||
}
|
||||
}
|
||||
};
|
||||
// ----- stdvec<ostd::Rectangle> -----------------------------------
|
||||
template<> struct Getter<stdvec<ostd::Rectangle>>
|
||||
// ----- stdvec<Rectangle> -----------------------------------
|
||||
template<> struct Getter<stdvec<Rectangle>>
|
||||
{
|
||||
static stdvec<ostd::Rectangle> exec_impl(const std::string& p, const json& root)
|
||||
static stdvec<Rectangle> exec_impl(const std::string& p, const json& root)
|
||||
{
|
||||
stdvec<ostd::Rectangle> result;
|
||||
stdvec<Rectangle> result;
|
||||
try
|
||||
{
|
||||
const json& node = root.at(p);
|
||||
|
|
@ -236,7 +236,7 @@ namespace ostd
|
|||
for (const auto& element : node)
|
||||
{
|
||||
json fake_root = { { "rect", element } };
|
||||
ostd::Rectangle rect = Getter<ostd::Rectangle>::exec_impl("rect", fake_root);
|
||||
Rectangle rect = Getter<Rectangle>::exec_impl("rect", fake_root);
|
||||
result.push_back(rect);
|
||||
}
|
||||
return result;
|
||||
|
|
@ -310,10 +310,10 @@ namespace ostd
|
|||
catch (...) { return false; }
|
||||
}
|
||||
};
|
||||
// ----- ostd::Color -------------------------------------------------
|
||||
template<> struct Setter<ostd::Color>
|
||||
// ----- Color -------------------------------------------------
|
||||
template<> struct Setter<Color>
|
||||
{
|
||||
static bool exec_impl(const std::string& p, json& root, const ostd::Color& value)
|
||||
static bool exec_impl(const std::string& p, json& root, const Color& value)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -327,10 +327,10 @@ namespace ostd
|
|||
} catch (...) { return false; }
|
||||
}
|
||||
};
|
||||
// ----- stdvec<ostd::Vec2> -----------------------------------
|
||||
template<> struct Setter<ostd::Vec2>
|
||||
// ----- stdvec<Vec2> -----------------------------------
|
||||
template<> struct Setter<Vec2>
|
||||
{
|
||||
static bool exec_impl(const std::string& p, json& root, const ostd::Vec2& value)
|
||||
static bool exec_impl(const std::string& p, json& root, const Vec2& value)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -346,10 +346,10 @@ namespace ostd
|
|||
}
|
||||
}
|
||||
};
|
||||
// ----- ostd::Rectangle -------------------------------------------------
|
||||
template<> struct Setter<ostd::Rectangle>
|
||||
// ----- Rectangle -------------------------------------------------
|
||||
template<> struct Setter<Rectangle>
|
||||
{
|
||||
static bool exec_impl(const std::string& p, json& root, const ostd::Rectangle& value)
|
||||
static bool exec_impl(const std::string& p, json& root, const Rectangle& value)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -409,10 +409,10 @@ namespace ostd
|
|||
} catch (...) { return false; }
|
||||
}
|
||||
};
|
||||
// ----- stdvec<ostd::Color> -----------------------------------
|
||||
template<> struct Setter<stdvec<ostd::Color>>
|
||||
// ----- stdvec<Color> -----------------------------------
|
||||
template<> struct Setter<stdvec<Color>>
|
||||
{
|
||||
static bool exec_impl(const std::string& p, json& root, const stdvec<ostd::Color>& value)
|
||||
static bool exec_impl(const std::string& p, json& root, const stdvec<Color>& value)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -428,10 +428,10 @@ namespace ostd
|
|||
}
|
||||
}
|
||||
};
|
||||
// ----- stdvec<ostd::Rectangle> -----------------------------------
|
||||
template<> struct Setter<stdvec<ostd::Rectangle>>
|
||||
// ----- stdvec<Rectangle> -----------------------------------
|
||||
template<> struct Setter<stdvec<Rectangle>>
|
||||
{
|
||||
static bool exec_impl(const std::string& p, json& root, const stdvec<ostd::Rectangle>& value)
|
||||
static bool exec_impl(const std::string& p, json& root, const stdvec<Rectangle>& value)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -534,27 +534,27 @@ namespace ostd
|
|||
i32 JsonFile::get_int(const String& name) { return get<i32>(name); }
|
||||
f64 JsonFile::get_double(const String& name) { return get<f64>(name); }
|
||||
String JsonFile::get_string(const String& name) { return get<String>(name); }
|
||||
ostd::Color JsonFile::get_color(const String& name) { return get<ostd::Color>(name); }
|
||||
ostd::Vec2 JsonFile::get_vec2(const String& name) { return get<ostd::Vec2>(name); }
|
||||
ostd::Rectangle JsonFile::get_rect(const String& name) { return get<ostd::Rectangle>(name); }
|
||||
Color JsonFile::get_color(const String& name) { return get<Color>(name); }
|
||||
Vec2 JsonFile::get_vec2(const String& name) { return get<Vec2>(name); }
|
||||
Rectangle JsonFile::get_rect(const String& name) { return get<Rectangle>(name); }
|
||||
stdvec<i32> JsonFile::get_int_array(const String& name) { return get<stdvec<i32>>(name); }
|
||||
stdvec<f64> JsonFile::get_double_array(const String& name) { return get<stdvec<f64>>(name); }
|
||||
stdvec<String> JsonFile::get_string_array(const String& name) { return get<stdvec<String>>(name); }
|
||||
stdvec<ostd::Color> JsonFile::get_color_array(const String& name) { return get<stdvec<ostd::Color>>(name); }
|
||||
stdvec<ostd::Rectangle> JsonFile::get_rect_array(const String& name) { return get<stdvec<ostd::Rectangle>>(name); }
|
||||
stdvec<Color> JsonFile::get_color_array(const String& name) { return get<stdvec<Color>>(name); }
|
||||
stdvec<Rectangle> JsonFile::get_rect_array(const String& name) { return get<stdvec<Rectangle>>(name); }
|
||||
|
||||
bool JsonFile::set_bool(const String& name, bool value) { return set<bool>(name, value); }
|
||||
bool JsonFile::set_int(const String& name, i32 value) { return set<i32>(name, value); }
|
||||
bool JsonFile::set_double(const String& name, f64 value) { return set<f64>(name, value); }
|
||||
bool JsonFile::set_string(const String& name, const String& value) { return set<String>(name, value); }
|
||||
bool JsonFile::set_color(const String& name, const ostd::Color& value) { return set<ostd::Color>(name, value); }
|
||||
bool JsonFile::set_vec2(const String& name, const ostd::Vec2& value) { return set<ostd::Vec2>(name, value); }
|
||||
bool JsonFile::set_rect(const String& name, const ostd::Rectangle& value) { return set<ostd::Rectangle>(name, value); }
|
||||
bool JsonFile::set_color(const String& name, const Color& value) { return set<Color>(name, value); }
|
||||
bool JsonFile::set_vec2(const String& name, const Vec2& value) { return set<Vec2>(name, value); }
|
||||
bool JsonFile::set_rect(const String& name, const Rectangle& value) { return set<Rectangle>(name, value); }
|
||||
bool JsonFile::set_int_array(const String& name, const stdvec<i32>& value) { return set<stdvec<i32>>(name, value); }
|
||||
bool JsonFile::set_double_array(const String& name, const stdvec<f64>& value) { return set<stdvec<f64>>(name, value); }
|
||||
bool JsonFile::set_string_array(const String& name, const stdvec<String>& value) { return set<stdvec<String>>(name, value); }
|
||||
bool JsonFile::set_color_array(const String& name, const stdvec<ostd::Color>& value) { return set<stdvec<ostd::Color>>(name, value); }
|
||||
bool JsonFile::set_rect_array(const String& name, const stdvec<ostd::Rectangle>& value) { return set<stdvec<ostd::Rectangle>>(name, value); }
|
||||
bool JsonFile::set_color_array(const String& name, const stdvec<Color>& value) { return set<stdvec<Color>>(name, value); }
|
||||
bool JsonFile::set_rect_array(const String& name, const stdvec<Rectangle>& value) { return set<stdvec<Rectangle>>(name, value); }
|
||||
|
||||
|
||||
bool JsonFile::init(const String& filePath, bool writeable, const json* obj)
|
||||
|
|
|
|||
|
|
@ -46,28 +46,28 @@ namespace ostd
|
|||
i32 get_int(const String& name);
|
||||
f64 get_double(const String& name);
|
||||
String get_string(const String& name);
|
||||
ostd::Color get_color(const String& name);
|
||||
ostd::Vec2 get_vec2(const String& name);
|
||||
ostd::Rectangle get_rect(const String& name);
|
||||
Color get_color(const String& name);
|
||||
Vec2 get_vec2(const String& name);
|
||||
Rectangle get_rect(const String& name);
|
||||
stdvec<i32> get_int_array(const String& name);
|
||||
stdvec<f64> get_double_array(const String& name);
|
||||
stdvec<String> get_string_array(const String& name);
|
||||
stdvec<ostd::Color> get_color_array(const String& name);
|
||||
stdvec<ostd::Rectangle> get_rect_array(const String& name);
|
||||
stdvec<Color> get_color_array(const String& name);
|
||||
stdvec<Rectangle> get_rect_array(const String& name);
|
||||
|
||||
// --- SETTERS ---
|
||||
bool set_bool(const String& name, bool value);
|
||||
bool set_int(const String& name, i32 value);
|
||||
bool set_double(const String& name, f64 value);
|
||||
bool set_string(const String& name, const String& value);
|
||||
bool set_color(const String& name, const ostd::Color& value);
|
||||
bool set_vec2(const String& name, const ostd::Vec2& value);
|
||||
bool set_rect(const String& name, const ostd::Rectangle& value);
|
||||
bool set_color(const String& name, const Color& value);
|
||||
bool set_vec2(const String& name, const Vec2& value);
|
||||
bool set_rect(const String& name, const Rectangle& value);
|
||||
bool set_int_array(const String& name, const stdvec<i32>& value);
|
||||
bool set_double_array(const String& name, const stdvec<f64>& value);
|
||||
bool set_string_array(const String& name, const stdvec<String>& value);
|
||||
bool set_color_array(const String& name, const stdvec<ostd::Color>& value);
|
||||
bool set_rect_array(const String& name, const stdvec<ostd::Rectangle>& value);
|
||||
bool set_color_array(const String& name, const stdvec<Color>& value);
|
||||
bool set_rect_array(const String& name, const stdvec<Rectangle>& value);
|
||||
|
||||
// --- WRAPPERS ---
|
||||
inline f32 get_float(const String& name) { return cast<f32>(get_double(name)); }
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ custom_continue:
|
|||
else if (value.startsWith("color(") && value.endsWith(")"))
|
||||
{
|
||||
value.substr(6, value.len() - 1).trim();
|
||||
set(key, ostd::Color(value), themeID);
|
||||
set(key, Color(value), themeID);
|
||||
}
|
||||
else if (value.startsWith("vec2(") && value.endsWith(")"))
|
||||
{
|
||||
|
|
@ -267,7 +267,7 @@ custom_continue:
|
|||
return false;
|
||||
vec.push_back(tok.toFloat());
|
||||
}
|
||||
set(key, ostd::Vec2(vec[0], vec[1]), themeID);
|
||||
set(key, Vec2(vec[0], vec[1]), themeID);
|
||||
}
|
||||
else if (value.startsWith("rect(") && value.endsWith(")"))
|
||||
{
|
||||
|
|
@ -282,7 +282,7 @@ custom_continue:
|
|||
return false;
|
||||
vec.push_back(tok.toFloat());
|
||||
}
|
||||
set(key, ostd::Rectangle(vec[0], vec[1], vec[2], vec[3]), themeID);
|
||||
set(key, Rectangle(vec[0], vec[1], vec[2], vec[3]), themeID);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -361,11 +361,11 @@ custom_continue:
|
|||
return STR_BOOL(*p);
|
||||
else if (auto p = std::get_if<String>(&v))
|
||||
return *p;
|
||||
else if (auto p = std::get_if<ostd::Color>(&v))
|
||||
else if (auto p = std::get_if<Color>(&v))
|
||||
return *p;
|
||||
else if (auto p = std::get_if<ostd::Rectangle>(&v))
|
||||
else if (auto p = std::get_if<Rectangle>(&v))
|
||||
return *p;
|
||||
else if (auto p = std::get_if<ostd::Vec2>(&v))
|
||||
else if (auto p = std::get_if<Vec2>(&v))
|
||||
return *p;
|
||||
return "";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ namespace ostd
|
|||
{
|
||||
public: using QualifierList = stdvec<std::pair<const String, bool>>;
|
||||
public: using VariableList = stdumap<String, std::pair<String, bool>>;
|
||||
public: using TypeVariant = std::variant<i32, f32, bool, String, ostd::Color, ostd::Rectangle, ostd::Vec2>;
|
||||
public: using TypeVariant = std::variant<i32, f32, bool, String, Color, Rectangle, Vec2>;
|
||||
public:
|
||||
Stylesheet(void);
|
||||
Stylesheet& clear(void);
|
||||
|
|
|
|||
|
|
@ -475,3 +475,45 @@ namespace ostd
|
|||
typedef Line<i16> I16Line;
|
||||
typedef Line<i8> I8Line;
|
||||
}
|
||||
|
||||
namespace ogfx
|
||||
{
|
||||
using Vec2 = ostd::Vec2;
|
||||
using Vec3 = ostd::Vec3;
|
||||
using Vec4 = ostd::Vec4;
|
||||
using Triangle = ostd::Triangle;
|
||||
using Rectangle = ostd::Rectangle;
|
||||
|
||||
using FPoint = ostd::FPoint;
|
||||
using DPoint = ostd::DPoint;
|
||||
using UIPoint = ostd::UIPoint;
|
||||
using UI64Point = ostd::UI64Point;
|
||||
using UI16Point = ostd::UI16Point;
|
||||
using UI8Point = ostd::UI8Point;
|
||||
using IPoint = ostd::IPoint;
|
||||
using I64Point = ostd::I64Point;
|
||||
using I16Point = ostd::I16Point;
|
||||
using I8Point = ostd::I8Point;
|
||||
|
||||
using FRect = ostd::FRect;
|
||||
using DRect = ostd::DRect;
|
||||
using UIRect = ostd::UIRect;
|
||||
using UI64Rect = ostd::UI64Rect;
|
||||
using UI16Rect = ostd::UI16Rect;
|
||||
using UI8Rect = ostd::UI8Rect;
|
||||
using IRect = ostd::IRect;
|
||||
using I64Rect = ostd::I64Rect;
|
||||
using I16Rect = ostd::I16Rect;
|
||||
using I8Rect = ostd::I8Rect;
|
||||
|
||||
using FLine = ostd::FLine;
|
||||
using DLine = ostd::DLine;
|
||||
using UILine = ostd::UILine;
|
||||
using UI64Line = ostd::UI64Line;
|
||||
using UI16Line = ostd::UI16Line;
|
||||
using UI8Line = ostd::UI8Line;
|
||||
using ILine = ostd::ILine;
|
||||
using I64Line = ostd::I64Line;
|
||||
using I16Line = ostd::I16Line;
|
||||
using I8Line = ostd::I8Line;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace ostd
|
|||
// ogfx::MouseEventData& evt = cast<ogfx::MouseEventData&>(signal.userData);
|
||||
// for (auto& node : m_points)
|
||||
// {
|
||||
// if (ostd::Rectangle(node.position.x - 20, node.position.y - 20, 40, 40).contains((f32)evt.position_x, (f32)evt.position_y))
|
||||
// if (Rectangle(node.position.x - 20, node.position.y - 20, 40, 40).contains((f32)evt.position_x, (f32)evt.position_y))
|
||||
// {
|
||||
// m_selectedNode = &node;
|
||||
// return;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class Window : public ogfx::GraphicsWindow
|
|||
return rnd::getVec2({ 0, (f32)getWindowWidth() }, { 0, (f32)getWindowHeight() });
|
||||
};
|
||||
for (i32 i = 0; i < 10000; i++)
|
||||
m_gfx.drawLine({ l_rndPoint(), l_rndPoint() }, ostd::Colors::Crimson, 10);
|
||||
m_gfx.drawLine({ l_rndPoint(), l_rndPoint() }, Colors::Crimson, 10);
|
||||
m_gfx.endFrame();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -122,12 +122,12 @@ class Window : public ogfx::gui::Window
|
|||
});
|
||||
m_panel1.addChild(m_label2);
|
||||
|
||||
m_label1.addThemeOverride("@:pressed.label.textColor", ostd::Colors::Crimson);
|
||||
m_label1.addThemeOverride("@:pressed.label.textColor", Colors::Crimson);
|
||||
|
||||
m_theme.loadFromFile("./testTheme.txt", true, getDefaultStylesheetVariableList());
|
||||
|
||||
m_label2.addThemeOverride("@:hover.label.showBackground", true);
|
||||
m_label2.addThemeOverride("@:hover.label.backgroundColor", ostd::Colors::DarkGreen);
|
||||
m_label2.addThemeOverride("@:hover.label.backgroundColor", Colors::DarkGreen);
|
||||
|
||||
m_label3.setPosition(0, 30);
|
||||
m_label3.setText("Bella!");
|
||||
|
|
@ -153,7 +153,7 @@ class Window : public ogfx::gui::Window
|
|||
void onRedraw(ogfx::BasicRenderer2D& gfx) override
|
||||
{
|
||||
gfx.drawAnimation(m_anim, { 200, 200 });
|
||||
wout().xy(100, 100).fg(ostd::Colors::Crimson).p("CIAO BELLA").resetColors();
|
||||
wout().xy(100, 100).fg(Colors::Crimson).p("CIAO BELLA").resetColors();
|
||||
}
|
||||
|
||||
void onFixedUpdate(void) override
|
||||
|
|
|
|||
Loading…
Reference in a new issue