Skip to content

Releases: mupen64/ugui

3.1.2

27 Mar 18:13
Immutable release. Only release title and notes can be modified.
75be83a

Choose a tag to compare

Summary

This release fixes a bug that causes an error when tooltips appear.

Thanks to @hugou74130 for the quick fix!

🐞 Bugfixes

  • Styler Pass font params to compute_rich_text in draw_tooltip (#70)

3.1.1

21 Mar 12:55
Immutable release. Only release title and notes can be modified.
ea73f23

Choose a tag to compare

Summary

This release fixes a critical bug with the TabControl, as well as missing type annotations for STATIC_ENV.

🐞 Bugfixes

  • TabControl Error when placed (#67)
  • STATIC_ENV missing type annotation (#66)

3.1.0

18 Mar 17:47
Immutable release. Only release title and notes can be modified.
11037c0

Choose a tag to compare

Summary

This release adds the label control, clipboard support, better keyboard input handling, and click-drag support for the scrollbar, along with fixing some bugs.

Adoption

Clipboard support

Clipboard support requires providing a clipboard API surface.

If you're using the Mupen64 Lua API, you can do that as follows:

 ---@module "ugui-amalgamated"
 ugui = dofile('ugui-amalgamated.lua')

+ugui.STATIC_ENV = {
+    clipboard = {
+        get = function()
+            return clipboard.get('text')
+        end,
+        set = function(text)
+            clipboard.set('text', text)
+        end,
+    },
+}

Breaking Changes

Removed Environment::held_keys

The mechanism for passing keyboard info to ugui via held_keys has been
removed.

Provide a list of key events instead.

If you're using the Mupen64 Lua API, this is how your code would change:

-emu.atdrawd2d(function()
-    local keys = input.get()
-    ugui.begin_frame({
-        held_keys = keys,
-        ...
-    })
-    ugui.end_frame()
-end)

+local key_events = {}
+
+emu.atdrawd2d(function()
+    ugui.begin_frame({
+        key_events = key_events,
+        ...
+    })
+    ugui.end_frame()
+    key_events = {}
+end)
+
+emu.atkey(function(args)
+    key_events[#key_events + 1] = args
+end)

✨ Features

  • Label Add label control (#60)
  • Clipboard support (#61)
  • ScrollBar Click-drag support (#54)
  • [breaking] Event queue-based keyboard input handling (#51)

🐞 Bugfixes

  • NumberBox Broken primary return value (#47)
  • TabControl Broken selected_index diffing (#46)
  • CarrouselButton Broken meta return value (#45)

3.0.3

22 Feb 19:37
Immutable release. Only release title and notes can be modified.

Choose a tag to compare

Summary

This release improves styler mixin performance and fixes a bug in BreitbandGraphics.invert_color.

⚡ Performance

  • Faster styler mixins (#43)

🐞 Bugfixes

  • BreitbandGraphics Incorrect values returned by BreitbandGraphics.invert_color

3.0.2

11 Nov 20:19
Immutable release. Only release title and notes can be modified.

Choose a tag to compare

Summary

This release fixes a bug related to focus not resetting when clicking on dead space.

🐞 Bugfixes

  • core focus not resetting when clicking dead space

3.0.1

10 Nov 16:00
Immutable release. Only release title and notes can be modified.

Choose a tag to compare

Summary

This release fixes bugs related to the numberbox.

🐞 Bugfixes

  • numberbox Keyboard-based digit set behaviour not working
  • Missing math shims for lua 5.4

3.0.0

28 Oct 20:27
Immutable release. Only release title and notes can be modified.

Choose a tag to compare

Summary

ugui 3.0.0 brings with it buffered scene processing and various flexibility
improvements.

Control logic is still executed immediately, but input processing and rendering are now done at the end of the frame. This has implications for certain use-cases, so make sure to read the "Breaking Changes" section.

Scenes with overlapping controls are now handled correctly and control focus behaviour should be more consistent.

New Stuff

💡 Control metadata

Controls now return a second value, the meta table (not to be confused with
metatable).

local pressed, meta = ugui.button({
    uid = 10,
    rectangle = {x = 120, y = 10, width = 100, height = 23},
    text = 'Hello, world!',
})

print(meta) -- prints: { signal_change = 0 }

The meta table contains miscellaneous information about a control's state.

The signal_change field makes it easier to detect changes in the return value
of a control without relying solely on state diffing.

For more information, consult the Meta type docs and ./demos/interaction_state.lua.

⚛️ ugui.control()

You can now spawn controls of arbitrary types at runtime using ugui.control()

Usage example:

local result = ugui.control({
    uid = 1,
    ...
}, 'button')

local pressed = result.primary
if pressed then
    print("Hello World!")
end

For more information, consult the ugui.control() docs.

📋 Control Registry

Control-specific code (with the exception of composite controls, such as
spinner) is now located in the "ugui registry" instead of scattered across
individual functions.

Given that this is an implementation detail, it's irrelevant to library
consumers.

If you are writing a ugui extension, consult the ControlRegistry type
definition for more information on how to integrate your own control with the
registry.

Breaking Changes

⌛ One Frame of Delay

Return values of controls are now delayed by one frame.

For instance, this manifests as a button returning true one frame after it
was clicked, and not immediately.

If you are experiencing state diffing issues (e.g. change detection based on
control return values failing because of the delay) due to this change, consult
the "Meta" section of the changelog.

✏️ Styler Overrides

Overriding a specific control's rendering by overwriting a method in the
standard_styler is no longer possible.

To achieve this, utilize styler mixins instead. For more info, see the
documentation for Control.styler_mixin.

- local prev_font_name = ugui.standard_styler.params.font_name
- ugui.standard_styler.params.font_name = "Comic Sans"
- ugui.button(...)
- ugui.standard_styler.params.font_name =  prev_font_name

+ugui.button({
+  ...
+  styler_mixin = {
+      font_name = "Comic Sans"
+  }
+)

📦 Control UID Sharing

Controls of different types may not share UIDs anymore.

Placing a button with uid 5 means you are no longer allowed to place any
non-button control with uid 5. This scenario will cause an error, so check the
error message to find out what went wrong.

⬆️ Control UID Requirements Changing

The spinner control now requires 4 UID slots instead of 3.

👁️ Stricter Control Validation

Controls are now validated more strictly, meaning that your script might error
out when placing a control.

The errors are pretty descriptive, so check that the data you pass into the
controls matches what they want - you can check the respective control type for
that.

❌ Layout System Removal

The layout system has been removed - ugui.push, ugui.pop, ugui.stackpanel
are no longer available.

There is currently no alternative to the layout system, but it might be added
back in future releases.

2.0.0

16 Mar 14:59

Choose a tag to compare

Summary

The 2.0.0 release of ugui is here, with major structural changes and new features.

Breaking Changes

Standard Package

BreitbandGraphcis, ugui, and ugui-ext are now a standard Lua packages. They don't automatically insert themselves into the global scope when executed.

To import the full ugui suite:

-    dofile("mupen-lua-ugui.lua")
-    dofile("mupen-lua-ugui-ext.lua")
+    BreitbandGraphics = dofile("BreitbandGraphics.lua")
+    ugui = dofile("mupen-lua-ugui.lua")
+    ugui_ext = dofile("mupen-lua-ugui-ext.lua")

Features

  • BreitbandGraphics: Add RawColor
  • BreitbandGraphics: Add default values for source_rectangle and color to draw_image
  • BreitbandGraphics: Implement draw_text2
  • BreitbandGraphics: Implicit color conversion
  • CombBox: Window overflow avoidance for dropdown
  • Core: Add unbalanced begin/end_frame detection
  • Demo: Add ColorSource demo
  • Josytick: Snap parameters
  • Layout: Initial implementation of layout sections
  • RichText: Allow specifying icon colors manually
  • RichText: Implement rich text rendering
  • Styler: Structured styler parameters
  • Tests: Add test summary
  • Tests: Add various BreitbandGraphics tests
  • Textbox|Numberbox: Allow changing selection color
  • Tooltip: Implement tooltips
  • ugui-ext: Icon draw override

Changes

  • BreitbandGraphics: (BREAKING) Refactor to standard module
  • BreitbandGraphics: Remove 1.1.5-1.1.6 shim
  • ComboBox: Allow providing nil selected_index
  • Nineslice: Improve draw_icon error resilience
  • RichText: Provide visual_state to draw_rich_text and pass it on to draw_icon
  • ToggleButton: Allow providing nil is_checked, fix tooltip flickering when clicking
  • ugui-ext: (BREAKING) Refactor to standard module, move controls to ugui
  • ugui-ext: Remove 1.1.5-1.1.6 shim
  • ugui: (BREAKING) Refactor to standard module
  • ugui: (BREAKING) Require BreitbandGraphics to be present in global scope
  • ugui: Ignore hittest outside of window bounds

Bugfixes

  • BreitbandGraphics: Define API surface for get_image_info
  • BreitbandGraphics: Incorrect empty table handling
  • ComboBox: nil_params_no_error test
  • Demo: Scripts failing to run when paths are too long
  • ListBox: Incorrect layout
  • ListBox: Use proper parameter name for control
  • Listbox: Error when pressing up/down while hovering over listbox with no selection
  • Listbox: Item height not being respected
  • Menu: Broken icon drawing
  • Menu: Invalid overlap size being read from styler
  • Menu: align_x = start not being specified in draw_menu_item
  • Nineslice: Incorrect draw_list_item implementation
  • NumberBox: Uninitialized control data being consumed
  • Numberbox: Text measuring accuracy issues
  • RichText: Handle nil text in compute_rich_text
  • RichText: draw_text2 being called for text segments with too low of a height, causing clipping
  • RichText: draw_text2 being called with too high y coordinate
  • TabControl: Incorrect text measurement when items contain rich text
  • ugui-ext: Broken custom icon rendering
  • ugui-ext: Cached rendering params still being applied
  • ugui-ext: Placeholder icon being drawn instead of falling back to default implementation
  • ugui-ext: control_data initialization crashes
  • ugui-ext: draw_list_item nineslice implementation using wrong text alignment
  • ugui: control_data initialization crashes

Dev

  • BreitbandGraphics: Document internals
  • BreitbandGraphics: Improve BreitbandGraphics docs
  • Chore: Bump version to 2.0.0
  • Core: Better docs for environments
  • Core: Remove nil check for clamp( )
  • Doc: Improve documentation of extended controls
  • Docs: Improve documentation
  • Layout: Limit layout stack depth to 1
  • ListBox: Add FIXME about listbox parameter
  • ListBox: Fix click_sets_correct_selected_index tests
  • Listbox: Add regression test for d426568
  • Menu: Fix incorrect field being read for color
  • Numberbox: Add tests
  • StackPanel: Fix StackPanel tests
  • Styler: Add monospace_font_name param
  • ugui-ext: Add Spinner and TabControl tests
  • ugui-ext: Add more documentation, improve a warning message
  • ugui-ext: Add ugui-ext demo
  • ugui-ext: Bump version to 2.0.0
  • ugui-ext: Fix demos and tests
  • ugui-ext: Fix various bugs, port controls to new styler structure, remove treeview control
  • ugui: Add back commented out tests
  • ugui: Fix module inclusion typing in demos and tests
  • ugui: Make standard styler use draw_text2

Full Changelog: 1.0.4...2.0.0

1.0.4

14 Aug 09:55
b5599c8

Choose a tag to compare

ℹ️ Compatibility with 1.1.4

Full Changelog: 1.0.2...1.0.4

1.0.2

01 Jul 10:02

Choose a tag to compare

Fix textbox drawing