Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tiletypes GUI #1130

Merged
merged 25 commits into from
Jun 1, 2024
Merged

Tiletypes GUI #1130

merged 25 commits into from
Jun 1, 2024

Conversation

tatoyoda600
Copy link
Contributor

@tatoyoda600 tatoyoda600 commented May 25, 2024

Adds a GUI for the tiletypes command.
Requires the tiletypes interface from DFHack/dfhack#4645 to function

image

Additionally, I made some self-contained widget stuff for this, which could be cleaned up a bit and extracted to widgets.lua or some other file, if they seem useful:

  • makeInlineButtonLabelText: Able to take in 2 widgets.ButtonLabelSpec, align them, and convert them into a single widgets.ButtonLabelSpec (Used in this GUI for the buttons in the "More Options" window)
  • BoxSelection: Allows for selecting a box of tiles, has support for both cursor and mouse, lets you change what tiles the selection draws onto the screen, and supports the new DimensionsTooltip
  • SelectDialog: Like the gui.materials popup but without the restriction to materials, allowing you to specify whatever list of items/categories you want (ALlows nesting categories as deep as you want)

@tatoyoda600
Copy link
Contributor Author

Taken out of WIP, as the changes from DFHack/dfhack#4645 allow this to function as intended

@tatoyoda600 tatoyoda600 changed the title WIP - Tiletypes GUI Tiletypes GUI May 27, 2024
gui/tiletypes.lua Outdated Show resolved Hide resolved
gui/tiletypes.lua Outdated Show resolved Hide resolved
center_pen = type(center_pen) == "table" and center_pen or {fg=center_pen}
center_pen.tile_color=true
return {
border_pen,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this works? I never tested this particular format

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I used tile_color=true to have the tile_overrides ascii characters still be colored like in the ascii view. Otherwise they would always be the standard black and white.
Of course ideally I would be using actual sprites instead of colored characters, but it's what I was able to put together.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, I meant having a combination single- and double- index array. I've tested just the color (no array) and a double-indexed array. I never tried non-table elements in the array.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yeah, it didn't used to be possible until I added in the support for different combinations of tables and non-tables in DFHack/dfhack#4622 / DFHack/dfhack#4624, I specifically made sure that that combination was possible cause I knew it would be useful to me :p

gui/tiletypes.lua Outdated Show resolved Hide resolved
Copy link
Member

@myk002 myk002 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also needs docs in docs/gui/tiletypes.rst

gui/tiletypes.lua Outdated Show resolved Hide resolved
gui/tiletypes.lua Outdated Show resolved Hide resolved
@tatoyoda600
Copy link
Contributor Author

Here's the spritesheet the script now tries to access, since it can't be included as part of this PR due to submodules
tiletypes

Copy link
Member

@myk002 myk002 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran out of time at SelectDialog; will finish review later, but I wanted to submit what I had so far for feedback/discussion

docs/gui/tiletypes.rst Outdated Show resolved Hide resolved
docs/gui/tiletypes.rst Outdated Show resolved Hide resolved
docs/gui/tiletypes.rst Outdated Show resolved Hide resolved
docs/gui/tiletypes.rst Show resolved Hide resolved
gui/tiletypes.lua Outdated Show resolved Hide resolved
gui/tiletypes.lua Outdated Show resolved Hide resolved
gui/tiletypes.lua Outdated Show resolved Hide resolved
gui/tiletypes.lua Outdated Show resolved Hide resolved
gui/tiletypes.lua Outdated Show resolved Hide resolved
gui/tiletypes.lua Outdated Show resolved Hide resolved
@tatoyoda600
Copy link
Contributor Author

Had to go back to clamping the keyboard cursor in bounds because I realized that guidm.getCursorPos() doesn't give consistent results on all out of bounds situations.
Since guidm.getCursorPos() only ever checks if .x >= 0, the keyboard cursor leaving the map to the left causes different results than leaving up, right, or down, which looks quite janky.
image

Copy link
Member

@myk002 myk002 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I'm ok with merging this now if you are. We can start getting feedback and update as necessary.

@myk002 myk002 merged commit 40881a2 into DFHack:master Jun 1, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants