1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-06-02 22:11:10 +00:00
Commit Graph

5 Commits

Author SHA1 Message Date
juander-ux
1f49df62d1
Ui hud polishing (#938)
* d2ui/tooltip: Make it invisible by default

* d2ui/button: Add GetToggled() method

* d2player/HUD: Add tooltip for minipanel button

* d2ui/button: Add disabled frame to minipanel buttons

* d2ui/widget_group: Add SetEnable method for clickable widgets

* d2player/mini_panel: move menu button here from HUD

* d2ui/button: toggled buttons take preference over disabled buttons

* d2player/help_overlay: Make panel only use widgets

* d2player/hud: Group most widgets into widget group

* d2ui/custom_widget: Allow tooltip to be attached

* d2player/hud: Attach staminaBar tooltip to staminaBar

* d2player/hud: Attach experienceBar tooltip to experienceBar widget

* d2ui/ui_manager: Always draw tooltips last

* d2player/help_overlay: It should be drawn over the HUD

* d2player/globeWidget: Move tooltip here from HUD

* d2core/tooltip: Automatically add tooltips to the uiManager

* d2core/ui_manager: Remove special handling of widgetGroups for rendering

* d2player/help_overlay: Add button to widget group

* d2player/hud: Attack runwalk tooltip to button

* d2player/mini_panel: Add panelButton to its own widget group

* d2core/widget_group: When a clickable is added, it's also added to uiManager

* d2player/globeWidget: make tooltip un/lock on click

* d2player/hud: Add runbutton to widget group

* d2player/mini_panel: Add group for tooltips

this allows us to move the tooltip with the panelbuttons. They can't be
in the general panelGroup as they would all become visible when the
panel is opened.

* d2core/button: Remove debug log when a button with tooltip is hovered
2020-11-21 02:35:32 -08:00
juander-ux
ba5ea334cc
Ui minipanel refactor (#926)
* d2player/hud: Make minipanel button a real ui/button

* d2ui/button: Add implicit tooltips

for now it is only for close buttons.

* d2ui/frame: Add size caluclation

now frame.GetSize() returns meaningful values.

* d2ui/button: Add minipanel button types

* d2ui/hero_stats_panel: Fix cached image being way to big

* d2ui/widget_group: Fix widget groups size calculation

* d2ui/widget_group: Add debug rendering

* d2ui/widget_group: SetVisible() now sets the visibility of the group object

* d2player: Refactor mini_panel

we converted all elements to widgets. Thus rendering from game_controls
is no longer neccessary.

* d2ui/button: Add disabled color to layouts

* d2player/gamecontrols: temp hide minipanel when in esc menu

* d2ui/widget_group: Add OffsetPosition() method

* d2player/mini_panel: Implement moving of minipanel

this only occours when other panels are opened.

* d2player/minipanel: Fix inv/skilltree/char closebuttons

these would screw up the moving of the mini panel.

* Fix linter

* d2player/minipanel: Add tooltips to buttons

* d2player/skilltree: Fix icon rendering
2020-11-16 01:41:01 -08:00
juander-ux
12821147ce
Ui panel refactor part 2 (#921)
* d2ui/skilltree: Don't render availSPLabel

this is handled by the ui_manager now.

* d2ui/custom_widget: Allow them to be cached into static images

* d2player/hero_stats_panel: Remove render() function from game_controls

all ui elements are now grouped into a WidgetGroup, thus rendering is
done by the ui manager.

* d2player/hero_stats_panel: Remove unnecessary widgets from struct

we don't need to store them in the HeroStatsPanel struct anymore as they
are completly handled by the uiManager.

* d2ui/widget_group: Remove priority member

this is already defined by the BaseWidget.

* d2ui/widget: Move uiManager.contains() to the baseWidgets

this method makes more sense on a widget anyways.

* d2ui/widget: Add methods to handle widget hovering

* d2ui/custom_widget: Require define width/height

since the custom render() method can do whatever, we need the user to specify
the width/height such that GetSize() calls are meaningful.

* d2ui/widget: Allow widgets to return the uiManager

* d2player/HUD: Refactor health/mana globe into its own widget

* d2player/hud: Refactor load()

seperate each type of loading into its own method.

* d2player/HUD: Move stamina/exp bar into widgets

* d2player/HUD: Refactor left/right skills into widget

* d2ui/custom_widget: cached custom widgets should use widget.x/y

since we render to an image, we use widget.x/y to position the cached
image.

* d2player/HUD: User cached custom widget for all static images
2020-11-13 12:08:43 -08:00
juander
c148941194 d2ui/drawable: Refactor render() method to not return error
this simplifies error handling statements all over the ui code. Before
we had to write:

if err := foo.Render(target); err != nil {
    return err
}

which simplifies now to foo.Render(target)
2020-11-11 14:55:59 +01:00
juander
627bc8ec65 d2ui: Add WidgetGroup
this allows us to groups screens together, such that they can be
de-/activated by de-/activating the group instead of every ui element by
hand.

Before we were deactivating buttons and stopped rendering to deactivate ui
elements. This tied the renderer to these elements.
2020-11-09 18:13:17 +01:00