Commit Graph

12 Commits

Author SHA1 Message Date
gravestench 783993470e
Lint error cleanup1 (#779)
* fixed lint error in d2app/app.go

* go fmt entire project

* adding doc.go for d2records

* fixed lint issues in d2core/d2map

* fixed lint error in d2interface/palette.go

* fixed lint error in  d2core/d2hero/hero_state_factory.go

* adding dov.go to d2common/d2geom

* fixing lint errors in d2common/d2loader

* adding doc.go to d2common/d2cache

* adding doc files for d2datautils, d2util, d2path

* adding package doc strings for mapgen, in-geam help screen, and tcp client connection

* removed all cuddling lint errors

* changed stamina equality check to '<=' instead of '<'
2020-10-22 01:12:06 -04:00
Brendan Porter ca45be0948
Adds error handling everywhere (#743)
* adds error handling, returns early from funcs where it makes sense

* fixes build errors

* merge ballresin PR with upstream

* adds error handling, returns early from funcs where it makes sense

* fixes build errors

* merge ballresin PR with upstream

Co-authored-by: dknuth <dknuth0101@gmail.com>
2020-09-23 13:30:54 -04:00
Gürkan Kaymak ef0fbc0581
removed gui manager singleton in d2gui (#735) 2020-09-18 16:10:52 -04:00
lord 7e3aff557b
Decouple asset manager from renderer (#730)
* improve AssetManager implementation

Notable changes are:
 * removed the individual managers inside of d2asset, only one asset manager
 * AssetManager now has caches for the types of files it loads
 * created a type for TextDictionary (the txt file structs)
 * fixed a file path bug in d2loader Source
 * fixed a asset stream bug in d2loader Asset
 * d2loader.Loader now needs a d2config.Config on creation (for resolving locale files)
 * updated the mpq file in d2asset test data, added test case for "sub-directory"
 * added a Data method to d2asset.Asset. The data is cached on first full read.
 * renamed ArchiveDataStream to DataStream in d2interface
 * moved palette utility func out of d2asset and into d2util
 * bugfix for MacOS mpq loader issue

* lint fixes, added data caching to filesystem asset

* adding comment for mpq asset close

* Decouple d2asset from d2render

Notable changes in d2common:
 * d2dcc.Load now fully decodes the dcc and stores the directions/frames in the dcc struct
 * un-exported dcc.decodeDirection, it is only used in d2dcc
 * removed font interface from d2interface, we only have one font implementation
 * added `Renderer` method to d2interface.Surface, animations use this to bind to a renderer and create surfaces as they need
 * added `BindRenderer` method to animation interface

Notable changes in d2common/d2asset:
 * **d2asset.NewAssetManager only needs to be passed a d2config.Config**, it is decoupled from d2render
 * exported Animation
 * Animation implementation binds to the renderer to create surfaces only on the first time it is rendered
 * font, dcc, dc6 initialization logic moved out of asset_manager.go
 * for dc6 and dcc animations, the process of decoding and creating render surfaces has been broken into different methods
 * the d2asset.Font struct now stores font table data for initialization purposes

Notable changes in d2core/d2render:
 * Surfaces store a renderer reference, this allows animations to bind to the renderer and create a surface just-in-time

**These last changes should have been a separate PR, sorry.**
Notable changes in d2core/d2ui:
 * ui.NewSprite now handles creating an animation internally, only needs image and palette path as arguments

Notable Changes in d2game:
Because of the change in d2ui, all instances of this code pattern...
```golang
animation, err := screen.asset.LoadAnimation(imgPath, palettePath)
sprite, err := screen.ui.NewSprite(animation)
```
... becomes this ...
```golang
sprite, err := screen.ui.NewSprite(imgPath, palettePath)
```
2020-09-14 17:31:45 -04:00
lord dbc07e2ce8
removed most lint errors in d2gui (#604) 2020-07-18 18:06:36 -04:00
dk 60e6fcb7ac
moving enumerations out of d2interface (#552)
* moved filter constants back to d2enum

* moving key and mouse button enums into d2enum

* moving render type enum into d2enum

* moving input even priority enums into d2enum

* moving terminal enums into d2enum
2020-07-06 21:26:08 -04:00
dk 321a353461
Font manager abstraction (#545)
* abstracted palettes, colors, and palette manager

* make asset manager use the palette manager interface

* added BGRA setter/getter, fixed lint errors

* abstraction for animation and animation manager

* abstracted font and font manager
2020-07-05 15:56:48 -04:00
Tim Sarbin 5bfec3ccb0 Removed render singleton. Updated refs. 2020-07-03 14:00:56 -04:00
dk 55dc3e42ed
minor edits (#486)
* adding comments to d2interface for linter

* moved d2render renderer interfaces and types into d2interface
2020-06-29 00:41:58 -04:00
William 48a193579f
Enhanced escape menu with options - d2gui bug remaining (#459)
* First improvements

Signed-off-by: William Claude <w.claude@thebeat.co>

* Make the menu more generic

Signed-off-by: William Claude <w.claude@thebeat.co>

* Handle mouse events

Signed-off-by: William Claude <w.claude@thebeat.co>

* Remove debug statement

Signed-off-by: William Claude <w.claude@thebeat.co>

* Handle left clicks better

Signed-off-by: William Claude <w.claude@thebeat.co>

* Remove unused file

Signed-off-by: William Claude <w.claude@thebeat.co>

* Handle titles in screens

Signed-off-by: William Claude <w.claude@thebeat.co>

* Improve the menu using layouts

Signed-off-by: William Claude <w.claude@thebeat.co>

* Add support for onOff labels

Signed-off-by: William Claude <w.claude@thebeat.co>

* Mutualise title creation

Signed-off-by: William Claude <w.claude@thebeat.co>

* Add gutter and mutualise things

Signed-off-by: William Claude <w.claude@thebeat.co>

* Improve menu, mutualise a lot of things and support animated sprites

Signed-off-by: William Claude <w.claude@thebeat.co>

* Use a cfg struct instead of independent handlers

Signed-off-by: William Claude <w.claude@thebeat.co>

* Fix hardcoded value

Signed-off-by: William Claude <w.claude@thebeat.co>

* Clean things a bit

Signed-off-by: William Claude <w.claude@thebeat.co>

* Remove unused property

Signed-off-by: William Claude <w.claude@thebeat.co>

* First support for hoverable elements

Signed-off-by: William Claude <w.claude@thebeat.co>

* Add support for label selection feedback

Signed-off-by: William Claude <w.claude@thebeat.co>

* Add support options

Signed-off-by: William Claude <w.claude@thebeat.co>

* Update print statement

Signed-off-by: William Claude <w.claude@thebeat.co>

* Update rendering and clean code

Signed-off-by: William Claude <w.claude@thebeat.co>

* Remove debug things

Signed-off-by: William Claude <w.claude@thebeat.co>

* Handle hovering

Signed-off-by: William Claude <w.claude@thebeat.co>

* Support enter key for labels

Signed-off-by: William Claude <w.claude@thebeat.co>

* Attach methods to layout

Signed-off-by: William Claude <w.claude@thebeat.co>

* Move things under EscapeMenu

Signed-off-by: William Claude <w.claude@thebeat.co>

* Some renaming

Signed-off-by: William Claude <w.claude@thebeat.co>

* Clean

Signed-off-by: William Claude <w.claude@thebeat.co>

* Set hovered element ID when using the mouse

Signed-off-by: William Claude <w.claude@thebeat.co>

* Clean

Signed-off-by: William Claude <w.claude@thebeat.co>

* Delete unused file

Signed-off-by: William Claude <w.claude@thebeat.co>

* Wire save & exit with a nasty hack

Signed-off-by: William Claude <w.claude@thebeat.co>

* Remove unused file

Signed-off-by: William Claude <w.claude@thebeat.co>

* Remove dead code

Signed-off-by: William Claude <w.claude@thebeat.co>

* Reorder the code a bit

Signed-off-by: William Claude <w.claude@thebeat.co>

* Rename hoverableElement into actionableElement

Signed-off-by: William Claude <w.claude@thebeat.co>

* Prevent regenerating the label if the text didn't change

Signed-off-by: William Claude <w.claude@thebeat.co>
2020-06-25 16:27:16 -04:00
Alex Yatskov 6f2c212417
Continued work on GUI (#316)
* Configuration cleanup

* Cleanup

* Continued UI work
2020-02-24 22:35:21 -05:00
Alex Yatskov 810b168ebf
Work in progress on GUI (#304)
* Work in progress on GUI refactor

* Remove WIP file

* Remove WIP style
2020-02-17 22:11:52 -05:00