Commit Graph

106 Commits

Author SHA1 Message Date
gravestench 1fc787023d fixed lint errors 2021-01-11 01:31:57 -08:00
gucio321 5cd404e4a5
d2ui.Frame refactor (#994)
* d2ui.Frame refactor

* removed unneccessery d2asset.AssetManager argument from d2ui.NewUIFrame

* d2ui.Frame refactor

* removed unneccessery d2asset.AssetManager argument from d2ui.NewUIFrame

Co-authored-by: M. Sz <mszeptuch@protonmail.com>
Co-authored-by: Tim Sarbin <tim.sarbin@gmail.com>
Co-authored-by: gravestench <dknuth0101@gmail.com>
2021-01-06 21:53:01 -08:00
gucio321 6addf7a243
removed links to closed issues from code (#1005)
Co-authored-by: M. Sz <mszeptuch@protonmail.com>
Co-authored-by: gravestench <dknuth0101@gmail.com>
2021-01-06 21:48:12 -08:00
gucio321 b77d793698
added label-button widget (#989)
Co-authored-by: M. Sz <mszeptuch@protonmail.com>
2021-01-06 21:45:05 -08:00
M. Sz 40c2fac4f8 Revert "fixed onHover bug in d2ui.Sprite"
This reverts commit 8b557062fb.
2020-12-20 13:51:29 +01:00
gucio321 5409dc4ef2
fixed onHover bug in d2ui.Label (#991)
Co-authored-by: M. Sz <mszeptuch@protonmail.com>
2020-12-19 12:28:40 -08:00
gucio321 fbfea917cb
added static checks to d2ui (#990)
Co-authored-by: M. Sz <mszeptuch@protonmail.com>
2020-12-19 12:28:07 -08:00
gucio321 540f285468
fixed onHover bug in d2ui.Sprite (#992)
Co-authored-by: M. Sz <mszeptuch@protonmail.com>
2020-12-19 12:05:41 -08:00
M. Sz 178703f280 level-up buttons tooltips 2020-12-17 18:58:12 +01:00
M. Sz be8b3e3157 stats changing: hero stats panel 2020-12-16 16:49:50 +01:00
M. Sz 3220cc93f4 add-buttons actions 2020-12-16 16:49:50 +01:00
M. Sz 7e346bd039 add-buttons init 2020-12-16 16:49:50 +01:00
Tim Sarbin ea3a66c17d
Merge pull request #972 from gucio321/help-overlay
HelpOverlay's text
2020-12-14 19:57:39 -05:00
M. Sz 8186ecd55a help overlay text 2020-12-14 18:29:54 +01:00
M. Sz 25f405838a terminal printing 2020-12-14 13:45:06 +01:00
M. Sz c6ab79c388 quest log disabled icon 2020-12-14 11:25:37 +01:00
gucio321 2e31f3d1ec
Move Gold Panel (#962)
* move gold panel
2020-12-12 01:39:26 -08:00
Tim Sarbin cf069de879
Merge pull request #960 from gucio321/quest-log-part2
Quest log part2
2020-12-07 14:35:23 -05:00
M. Sz e9878fae0c removed unused button types 2020-12-07 19:57:04 +01:00
Tim Sarbin e6d5c8b9fd
Merge pull request #957 from gucio321/hotfix
Hotfix: minor bugs in quest log
2020-12-02 08:12:13 -05:00
juander 0d2a40a093 d2core/ui_manager: Properly reset widgetsGroups/tooltips 2020-12-02 12:30:45 +01:00
M. Sz c7a841fe5a Merge branch 'hotfix' of https://github.com/gucio321/OpenDiablo2 into hotfix 2020-12-02 09:41:52 +01:00
M. Sz f02ccd86c4 hotfix: fixed errors in quest log & code cleanup 2020-12-02 09:24:14 +01:00
M. Sz 104177279e hotfix: fixed errors in quest log & code cleanup 2020-12-02 09:23:25 +01:00
gucio321 96916863ff
Quest log initial (#956)
* Adding character quest panel
2020-12-01 23:19:15 -08:00
M. Sz a3b82f036b added squelch button description 2020-11-23 18:28:11 +01:00
M. Sz c9ad3741ae Fixed name error 2020-11-23 17:43:24 +01:00
M. Sz b5fa294e07 Added button type cancel description 2020-11-23 17:41:32 +01:00
M. Sz 3a0895bfd1 Added button type cancel description 2020-11-23 17:41:01 +01:00
M. Sz cf6761a50c Square button names 2020-11-23 15:35:10 +01:00
gucio321 7919b742bd
gold (#943)
* Init for gold button and label

* gold button and label in inventory menu

* gold value saved/loaded from player save file

Co-authored-by: M. Sz <mszeptuch@protonmail.com>
2020-11-22 14:53:33 -08:00
gucio321 36c92dc433
resolved build errors (#939)
Co-authored-by: M. Sz <mszeptuch@protonmail.com>
2020-11-21 03:19:13 -08:00
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
gucio321 9ffbf1320c
D2core logger (#934)
* logger for d2audio & d2map

* logger for d2ui e.t.c

* d2inventory now passes on error messages

* no more importing log in d2core

* implemented #925

* added logger to part of d2networking & fixed "need to be changed" comments

* fixed lints

* fixed errors

Co-authored-by: M. Sz <mszeptuch@protonmail.com>
2020-11-21 02:33:22 -08:00
Michał Mrówka 2a36c956a4
Label fix (#931) 2020-11-17 23:50:31 -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
Julien Ganichot 0d691dbffa
Key binding menu (#918)
* Feat(KeyBindingMenu): Adds dynamic box system with scrollbar

* Feat(Hotkeys): WIP Adds a lot of things

* Feat(KeyBindingMenu): WIP Adds logic to binding

* Feat(KeyBindingMenu): Fixes assignment logic

* Feat(KeyBindingMenu): Adds buttons logic

* Feat(KeyBindingMenu): Fixes sprites positions+add padding to Box

* Feat(KeyBindingMenu): Adds label blinking cap

* Feat(KeyBindingMenu): Removes commented func

* Feat(KeyBindingMenu): Fixes lint errors and refactors a bit

* Feat(KeyBindingMenu): Corrects few minor things from Grave

* Feat(KeyBindingMenu): removes forgotten key to string mapping
2020-11-13 12:03:30 -08:00
juander 976431c8e5 Revert "d2ui/sprite: Refactor Render() to RenderNoError()"
This reverts commit 77cd538c2f.

Since we removed the return of errors from the Render() method, we no
longer require the RenderNoError() method.
2020-11-11 15:05:04 +01:00
juander 606fc028ac Revert "d2ui/label: Refactor Render() to RenderNoError()"
This reverts commit f2a55312e4.

Since we removed the return of errors from the Render() method, we no
longer require the RenderNoError() method.
2020-11-11 15:01:36 +01: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 622bc832d3 d2player/skilltree: Move every element to widgets
the uiManager now handles every element of the ui, so we don't need to
render elements manually in game_controls. Now we can also use
widget_groups to simplify handling the opening/closing of the panel.
2020-11-09 18:26:34 +01:00
juander 77cd538c2f d2ui/sprite: Refactor Render() to RenderNoError()
this allows us to create a Render() method that implements the Widget
interface without killing us with linter warnings.
2020-11-09 18:26:32 +01:00
juander f2a55312e4 d2ui/label: Refactor Render() to RenderNoError()
this allows us to create a Render() method that implements the Widget
interface without killing us with linter warnings.
2020-11-09 18:26:28 +01:00
juander 01927d0f3b d2core/d2ui: Add checks to all widgets if they implement Widget
this also adds missing methods to elements not implementing widget. Note
here that we do not enable sprite and label, as this would produce a
crazy amount of linter warnings due to render() requiering error
handling then, which non of the callers handle. Since we remove the
render calls later anyways, we can postpone this static check for now.
2020-11-09 18:13:17 +01:00
juander bad07defe8 d2ui: Add a custom widget
this allows us to encapsulate any custom render functionality into this
custom widget. It further helps us to remove the renderer from
game_controls.
2020-11-09 18:13:17 +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
juander 881d5f1f71 d2ui: Create default base widget
this encapsulates all the repeating functions defined for all widgets in
the same way, like Set/GetPosition().
2020-11-09 18:13:17 +01:00
juander aa1fca84d5 d2core/ui: Introduce clickable widgets
not all widgets need to be clickable, so let's make it it's own
interface.
2020-11-09 18:13:17 +01:00
juander-ux 9e89d5b891
game_control: HUD refactor (#904)
* d2player/game_controls: Refactor HUD into it's own class

game_controls slowly becomes a superclass that does too many things.
So move HUD into it's own class. This is the first step of getting the
renderer out of game_controls (#798)

* d2ui/tooltip: Allow background box to be disabled

* d2ui/tooltip: Make GetSize() a public function

* d2player: Move const from game_controls to hud

* d2player: Fix missing entity hover tooltip
2020-11-05 11:55:09 -08:00