Releases: Gabidal/GGUI
GGUI 0.1.8 Update
GGUI 0.1.8 Update
/$$$$$$ /$$$$$$ /$$ /$$ /$$$$$$
/$$__ $$ /$$__ $$| $$ | $$|_ $$_/
| $$ \__/| $$ \__/| $$ | $$ | $$
| $$ /$$$$| $$ /$$$$| $$ | $$ | $$
| $$|_ $$| $$|_ $$| $$ | $$ | $$
| $$ \ $$| $$ \ $$| $$ | $$ | $$
| $$$$$$/| $$$$$$/| $$$$$$/ /$$$$$$
\______/ \______/ \______/ |______/
/$$$$$$ /$$ /$$$$$$
/$$$_ $$ /$$$$ /$$__ $$
| $$$$\ $$ |_ $$ | $$ \ $$
| $$ $$ $$ | $$ | $$$$$$/
| $$\ $$$$ | $$ >$$__ $$
| $$ \ $$$ | $$ | $$ \ $$
| $$$$$$//$$ /$$$$$$ /$$| $$$$$$/
\______/|__/|______/|__/ \______/
Overview
Major restructuring and modernization of the project. Heaps of optimization and custom containers made for most optimal results.
Whole new styling system for more HTML/XML like styling and node tree construction.
Clipped off internal components from getting into auto generated header on export.
Since this update almost re-wrote the whole project many commits which focused on fixing issues, were about issues brought by the new re-write.
API Changes
- Input events now use IVector2 instead of Coordinate struct
- Many if not all classes are now written in lower camelCase
- Vector2 is now correctly named FVector2 for containing floating point coordinates
- GGUI::mouse is now an IVector2 type
- You can now give percentage floating point values for almost any value based styling, like width or color channel and so on...
- You can use these as follows:
element( width(100) | height(100) | // set the parent element as 100x100 node(new element( width(0.50f) | height(0.50f) // this child element is now 50x50 and updates as its parents dimensions changes )) )
- You can use these as follows:
- GGUI does no longer have RGBA, instead opacity is given as a single floating value per element node
- RGB lerp can use Gamma color correct compute for much higher cost or use cheap simple lerp formula
- You can configure this via the settings or via the cmd arg:
enableGammaCorrection
- GGUI accepts many of configurable settings at call time, via the args. GGUI removes hyphens so you can add single hyphen, double hyphen or no hyphens.
- You can configure this via the settings or via the cmd arg:
- Since most of the node structure is now given as an HTML/XML like, GGUI provides
on_init()and otheron()state change function handlers the user can customize- Since JS and other types of similar products use underscores for their
on_*state handlers GGUI uses this naming convention as well.
- Since JS and other types of similar products use underscores for their
GGUI::Mainis not accessible anymore, since it was moved underGGUI::INTERNAL::Main, and intended for user to access throughGGUI::getRoot()- Titles are now native to element class so window class was removed
- Pixel based canvas has been removed, since only terminal cell based canvas is needed
- For pixel perfect canvas look up GGDirect for GGUI with DRM as backend support.
- Button class has been removed, since normal textField with
on_click()brings out the same behavior - SwitchBoxes have now
singleSelect(true)like styling which disables all other marked switchBoxes in the same parent, giving user simple way to make single select choice lists - Shadow styling has been removed, to be replaced later on with full shaders like customizations
Fixes
- Fixed where transparency wasn't propagated properly to transparent layers of text, not obtaining color from layers below
Optimizations
- To prevent unnecessary string concatenations GGUI implements its own string_view and string concatenation, these are called:
- compactString: Holds as a std::variant either a char or a unicode letter
- superString: Holds a predetermined list of compactStrings, capable of concatenating smaller superStrings to itself
- The whole rendering pipeline is based on these two classes.
- Since GGUI has a varying and sometimes deeply nested functions of getters, many of them have been made constexpr to hopefully ease inlining and runtime
- To prevent weird std::vector behavior and total control in niche use case of it, GGUI now implements its own fastVector for more cache-like behavior between render passes
For Maintainers
- Added proper scripts for linux and windows side for init, build, export, test and benchmarking with various kinds of tools
- GGUI can take now -DGGUI_DEBUG, -DGGUI_RELEASE or -DGGUI_PROFILE, which are automatically managed via the meson build system, but could be manually set for fine control
- Enabling -DGGUI_DEBUG, makes GGUI behave like
--verbosein other programs.
- Enabling -DGGUI_DEBUG, makes GGUI behave like
Internal
- Added new multithread safety guard wrapper for:
- Memory events
- Distributed to multithreading these following tasks:
- Rendering pipeline
- Memory and timed events handling
- User input handling
- 0.1.8 introduces new internally used
reportStacktrace(), which utilizes symbol table lookup and stack to print out helpful stacktraces - GGUI utilizes some constexpr operator to default in all stylings, which is why GGUI currently only works on GCC v13 and higher and not in Clang!
- The GGUI lib now links statically with libc and libc++
Small additional notes
- GitHub Actions CI workflows
- New analytics & benchmarking scripts
./bin/test.sh./bin/analytics/benchmark.sh./bin/analytics/time.sh 5 10<- runs for 5 second and 10 seconds and displays the growth in opcode count.
- Examples in more structured sub folders
- small <- single feature focused examples
- medium <- feature combinatorial examples
- large <- applicative examples
- Developer and contribution tooling (.github, guidelines)
- When you use the new styling position with percentages, note that the percentage already takes into account the parent.width or height minus the current node elements own width or height
- For an example:
element( width(100) | height(100) | node(new element( width(10) | height(10) | position(STYLES::bottom + STYLES::left) // This will force this element to be on the bottom left corner of the parent offset by the 10x10, so that it does not go out of bounds. )) )
- For an example:
GGUI 0.1.7.5 Update
_____ _____ _____ _____
| __| __| | | |
| | | | | | |- -|
|_____|_____|_____|_____|
___ _ _____
/ _ \ / ||___ |
| | | || | / /
| |_| || |_ / /
\___(_)_(_)_/
Build and Configuration
-
Updated
Build_Body.cppto automatically compile as a single header file. -
Update
meson.buildto include AVX support for SIMD.
Command Line and Platform Support
New CMD Class for Command Line Operations:
Added CMD class to handle continuous command line operations.
Usage:
GGUI::CMD cmd;
cmd.Run("cd ./somewhere")
cmd.Run("python this_is_in_somewhere.py")Border Styling and Customization
Custom Border Styles:
Introduced support for custom border styles in UI elements.
Usage:
GGUI::Element tmp = new GGUI::Element(10, 10);
tmp->Show_Border(true);
tmp->Set_Custom_Border_Style(GGUI::STYLES::BORDER::Double);Terminal Canvas and Sprite Animation
Sprite Animations.
Added support for sprite animations on Terminal_Canvas, with customizable characters and colors. Colors are interpolated for smooth transitions.
Usage:
// Single frame Sprite:
GGUI::Sprite s("a");
// Single frame Sprite with colors:
GGUI::Sprite s(GGUI::UTF("a", {
GGUI::COLOR::RED /*text color*/,
GGUI::COLOR::BLUE /*background color*/
}));
// Multi frame Sprite:
GGUI::Sprite s(
{
{"a", {GGUI::COLOR::RED /*text color*/, GGUI::COLOR::BLUE /*background color*/}},
{"b", {GGUI::COLOR::BLUE, GGUI::COLOR::RED}},
},
0, // [Optional] Animation offset
1 // [Optional] Animation speed
);
// apply the sprite to the canvas at (x, y).
example_canvas->Set(x, y, s);Performance Improvements:
Implemented various optimizations to enhance performance and reduce memory usage.
-
Overhauled thread scheduler systems for improved task management.
-
Optimized hitbox updater, job scheduler, and buffer encoder.
-
Streamlined shadow and opacity processing.
-
Improved UTF symbol initialization, transitioning from strings to
Compact_String. -
Enhanced styling system by replacing
unordered_mapswith class member access. -
Changed RGBA alpha channel from float to unsigned char, optimizing to fit within a 32-bit register.
-
Secondary threads now avoid spin-locking when paused.
-
Dedicated a separate thread for the rendering pipeline, preventing conflicts with the main thread.
Refactoring and Cleanup
Significant refactoring to improve code structure and resolve issues.
-
Refactored sleep functions and fixed lambda capture issues.
-
Addressed missing default arguments.
-
Removed OUTBOX from development listings and refined styling merging.
-
Updated constructors to set element names from strings.
-
Rewrote the
Text_FieldandProgress_Barclasses. -
Enhanced
List_Viewto re-adjust contents upon resizing. -
Ensured GGUI compiles without warnings
Bug Fixes and Tweaks
Fixed various bugs and made minor improvements.
-
Resolved issues with Unix-side key inputs and mouse support.
-
Improved RGBA alpha channel handling and memory management.
-
Addressed bugs in key handling and system stability.
-
Corrected issues where certain element class flags were not cleared properly.
-
Fixed hover not displaying on buttons, since the content was filling the whole area and border are not affected by hover nor focus.
Known Issues
-
Shadows are not functioning correctly.
-
Adding multiple identical child elements to
List_Viewonly displays the last added.
Compact_String And Super_String
New String Handling Mechanism:
Implemented a new system for handling characters and string literals, optimizing the display of repeating ANSI Escape Sequence codes.
-
Compact_String: Contains a const char* and its size, representing a string efficiently.
-
Super_String: A collection of
Compact_Strings that is transformed into a normal string at the end of the rendering pipeline for display.
Side Notes
-
For large projects or serious usage, consider waiting for version 0.1.8, which will significantly overhaul element creation and styling management.
-
Inlining the GGUI namespace is not recommended in larger projects.
-
Make sure GGUI always exists through:
GGUI::Exit();. -
Batch changes inside:
GGUI::Pause_GGUI(Function/Lambda).// This will avoid re-rendering for all changes. Instead flush all the changes once exiting Pause_GGUI(); GGUI::Pause_GGUI([a, b, c](){ a->Set_Background_Color(GGUI::RGB(1, 2, 3)); b->Set_Position({10, 10}); c->Add_Child(a); c->Add_Child(b); });
-
Recommended to initialize GGUI with:
GGUI::GGUI(function/lambda). -
Before setting up meson, set environment variable:
CXX=g++.
Next Update (0.1.8) Preview
Upcoming Features:
-
Pipelining output from other processes into GGUI for enhanced display.
-
Reworking element construction and styling.
-
Adding Unicode support to
Text_Fields. -
Simple HTML support.
-
Drag & Drop functionality.
-
Dynamic stylization updates like percentage values and corner anchoring.
-
List_Viewcontent line-wrap. -
Font file rendering support.
-
Post-process shaders for applying sprite animations to other elements.
-
Replacing GGUI DOM with a vector-based system for better content management.
-
Optimize data types, for better memory footprint.
Beta 0.1.6
GGUI 0.1.6 Introduces the biggest update yet, with many new optimization techinigues and features.
Buig fixes:
- Stability Improvements: Elements causing instability have been removed.
- Terminal Canvas Fix: The Terminal Canvas now works as expected.
- Shadow Rendering: Shadows are now correctly rendered.
- Canvas Initialization: The Terminal Canvas initializes with the correct cells, addressing partial drawing instability.
- On_Click Duplication: Instances where On_Click would duplicate the same event have been resolved.
- Change Clock type: Changing from
std::chrono::system_clock::time_pointintostd::chrono::high_resolution_clock::time_point.
Features:
- Negative Positioning: Child elements can now be positioned negatively!
- Hidden Overflow: Handle overflow gracefully.
- Event Extension/Delay: Extend or delay events by specifying the event name.
- Scroll View: Enjoy scrolling functionality.
- Inspect Tool: Debugging made easier with the Inspect Tool, which displays logs and other useful information.
- Access the Inspect tool with:
ctrl + shift + i
- Access the Inspect tool with:
- Android Termux Support: Now compatible with Android Termux!
Optimizations:
- Rendering Pipeline: Excessive content checking has been removed, resulting in faster rendering.
- Transparency Cleaning: Improved efficiency in handling transparency.
- UTF Cluster Optimization: Enhancements for better performance.
- Removed: Unnecessary rendering pause and resuming.
Known bugs:
- Spawning over 2k elements quickly may cause instability if they are rendered.
- Issues with mouse input.
- If you want to add an new module and want to add its cababilities intot he HTML parser you may counter problems with:
GGUI_Add_Translator("tag_name", Your_translator_Func);
Since this is an macro which creates an global variable with name of the line number + instance counter, you may encounter problems where two different files which use this macro, may collide with eachother.
Where to next?
- Finishing the HTML parser for GGUI is one of the main focus points.
- Adding more options for mouse functionality like:
- Drag&Drop elements.
- Resize elements with mouse.
- Progressing the game made with GGUI: https://github.com/Gabidal/DomainOfGods
- By adding HTML parser we can then add source control into the Inspect Tool and modify the structure at runtime!
- Element anchoring with: Left, Right, Up and Down.
Beta 0.1.5.1
Added
- Multi keybind support
- Color correction on border colors
- Improved tabulator movement
- On event function handler
void On(criteria, action, GLOBAL); - STAIN_TYPE::STATE now is triggered when element is displayed or hidden
- Optimisations throughout code
Beta 0.1.5
GGUI now supports:
- mouse movement [windows only]
- element movement by tabulator and shift + tabulator
- Added progressbars
- Border meshing
- Post-Prosessing baby!
- Alpha channel for transparent elements!
- Added On Hover state that is in between focused and not focused states.
Optimizations to run GGUI even faster!
GGUI [no mouse] now supports Unix systems!
Beta 0.1.4
Give user the power to make custom mouse input handlers.
Enable_Mouse_Movement();
Disable_Mouse_Movement();
Add manual focusing for any element. Element::Focus()
Start the GGUI DOM with:
GGUI::GGUI([](){
Window* a = Window(
"Hello world!",
10, 10 // Width & Height
)
})You can still access the 'Main' window from GGUI::Main
Add hidden and shown event handler support, and they will start your code when the element is rendered or hidden.
On_State(State s, std::function<void()> job);
New states:
enum class State{
RENDERED,
HIDDEN
};Add special canvas for terminal to display chatacters inside the canvas. GGUI::Terminal_Canvas
Beta 0.1.3
Fix tree constructors not appending Tree content to it's holder.
Add borders to buttons
Set name of button by the text of button.
Add React like rendering start point: (NOTE: syntax is subject to change)
GGUI::Pause_Renderer([=](){
GGUI::Window* Main = GGUI::Init_Renderer();
you code...
})Add string deletion keystroke handler automatically when assigning GGUI::Text_Filed::Input([=](char input){}) to a text_field object.
GGUI v0.1.2
- Added Button
- Added Canvas
- Added Radio_Button and Check_Box from Switch
Bug fixes:
- fixed error log not showing.
GGUI v0.1.1
- Added GSS, (CSS for GGUI).
- Added CSS, like classes. To ease theme making.
- Made user experience better.
- Added Text input capability. Now you can write text into Text_fields. (Use
Allow_Dynamic_Sizing();orAllow_Overflow();if you want to write more
than the given dimensions.) - Added
Get_Element(string name);Now you can fetch elements if you know their name (Note, by default all element names are same as their memory address.) - Added
Get_Elements<template T>();Now you can fetch all specific elements that are the specific type.
Bug fixes:
- Text_field didnt listen to user, when given text and dimensions.
- Window Title used Border text colors instead of Text colors.
- Text_field input overflow now works.
- Smoll bug fixes.