Commit Graph

1130 Commits

Author SHA1 Message Date
M. Sz 196627a283 fixed some errors 2020-11-18 09:13:16 +01:00
M. Sz a2bfa92692 updated build script 2020-11-18 09:07:00 +01:00
Michał Mrówka 2a36c956a4
Label fix (#931) 2020-11-17 23:50:31 -08:00
gravestench 28a16a36e0
updating lint workflow (#930)
lint workflow had begun to throw errors because something was deprecated in the github action. this fixes that issue.
2020-11-17 00:30:04 -08:00
Tim Sarbin cefea41810
Merge pull request #929 from PushUpek/charset_support
Added support for charset
2020-11-16 17:07:51 -05:00
Michał Mrówka bbba67487d
Added support for charset 2020-11-16 21:39:48 +01:00
Tim Sarbin 9ab89a59d4
Merge pull request #927 from PushUpek/remove_lang_option
Remove language option from config file
2020-11-16 08:38:26 -05:00
Michał Mrówka 5d5e10f229
Remove language option from config file 2020-11-16 12:47:11 +01: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
gravestench 7a75dbc284
updating git workflow to use golangci-lint version 1.32 (#922) 2020-11-13 10:59:38 -08:00
Tim Sarbin ef6f90c01c
Merge pull request #920 from juander-ux/fix-singleplayer-button-crash
d2gamescreen/char_select: Fix crash on double clicking singleplayer
2020-11-13 09:43:25 -05:00
Tim Sarbin 5b167df66d
Merge pull request #919 from gucio321/readme-update
readme screenshots update
2020-11-13 09:42:12 -05:00
juander dbbfdd6acf d2gamescreen/char_select: Fix crash on double clicking singleplayer
if we clicked twice on the single player button of the main menu, then
the first click would set the current screen to the
character_select. The second click directly after that will be
handled by the character_select screen. It's OnLoad() method was not
called yet, which initialized all widgets. The click handler of
character_select screen referenced the nil scrollbar and crashes.
2020-11-13 13:46:40 +01:00
M. Sz ab7705e835 readme screenshots update 2020-11-13 11:37:47 +01:00
gucio321 40dcd18487
added user IP in TCPIP menu (#916)
* added user IP in TCPIP menu
2020-11-12 02:43:05 -08:00
Tim Sarbin 2035a62ec6
Merge pull request #914 from juander-ux/drawable-refactor
d2ui/drawable refactor
2020-11-11 09:19:48 -05: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
Tim Sarbin 437e65564f
Merge pull request #912 from gucio321/cinematics
Cinematics menu
2020-11-10 10:31:19 -05:00
M. Sz 60566b3b0d fixed lint errors 2020-11-10 15:09:25 +01:00
M. Sz 3e6ec4c1cc removed some unused lines 2020-11-10 15:00:40 +01:00
M. Sz a19d83ca7b fixed black screen in IPServer menu 2020-11-10 15:00:40 +01:00
M. Sz 15b2e7613f cinematics menu final commit 2020-11-10 15:00:40 +01:00
M. Sz 03ab084b42 fixed some lint errors 2020-11-10 15:00:40 +01:00
M. Sz 9ab694b6f6 Music in cinematics menu 2020-11-10 15:00:40 +01:00
M. Sz c1ad9025f9 Label in cinematics menu 2020-11-10 15:00:40 +01:00
M. Sz 2eda3827ce cinematics select background 2020-11-10 15:00:40 +01:00
M. Sz e20d544a8c Buttons in cinematics menu 2020-11-10 15:00:40 +01:00
M. Sz bd4cf1a334 cinematics menu init 2020-11-10 15:00:40 +01:00
Tim Sarbin 5e5d8415ba
Merge pull request #911 from juander-ux/ui_refactor
d2ui refactor
I *almost* squashed it!
2020-11-10 00:04:08 -05: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 83acaefea2 d2player/game_controls: learnskills cmd not always creating new skill objects
when we ran the command before we would always throw away old skill
objects and create a new one. This is nasty if we have a pointer to the
old object. By throwing it away we have to update all these pointers.

Now we rather increase the skillpoint, if the hero already has this
skill.
2020-11-09 18:26:32 +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
Gürkan Kaymak e99fbf5c4b
showed an error message if the client cannot connect to a host (#910) 2020-11-08 14:03:51 -05:00
gravestench be9c29e9d2
Unfuck asset manager init (#906)
* moved loader bootstrap logic into d2app
2020-11-08 01:24:35 -08:00
gravestench f2ab13afae
moved asset manager initialization logic to d2app (#905)
* move asset manager initialization logic to d2app

* updating to loogger printf statements
2020-11-07 23:08:25 -05:00
gucio321 d5a26fd495
Hotkeys in Main Menu (#903)
* Escape in MainMenu cause game exit

* Escape in MainMenu cause game exit

* Shortcuts in d2 main menu

* Shortcuts in Main Menu

* Shortcuts in Main Menu

* hotfix for "Shortcuts in Main Menu"

* hotfix for "Shortcuts in Main Menu" - removet some lint error

* fix lint errors

Co-authored-by: M. Sz <mszeptuch@protonmail.com>
Co-authored-by: gravestench <dknuth0101@gmail.com>
2020-11-06 11:44:40 -05: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
gravestench f7fb35a4ec
removed debug printer singleton from d2util (#901)
resolves #504
2020-11-03 11:19:59 -08:00
gravestench af1f0a0eda
removed string table singleton from d2common/d2fileformats/d2tbl/ (#900) 2020-11-03 11:10:11 -08:00
gravestench 5ac03d6f49
refactored game bootstrap, removed `d2config.Config` singleton (#899)
* Remove d2config.Config singleton

* refactored config file bootstrap
* `d2loader.Loader` adds the config directories during init
* `d2asset.AssetManager` loads the config file during init
* mpq verification logic removed from d2config; this is done by d2loader
* added `errorMessage` to `d2app.App` for setting the error message for the error screen.

* fixed loader test
2020-11-03 07:54:15 -05:00