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

Trees GUI improvements #8234

Merged
merged 3 commits into from Dec 27, 2020
Merged

Trees GUI improvements #8234

merged 3 commits into from Dec 27, 2020

Conversation

@nielsmh
Copy link
Contributor

@nielsmh nielsmh commented Jun 22, 2020

Mostly a code change, but has the neat side effect of not drawing more buttons than are tree types in the current climate. Also fixes some scaling margin issues on 2x and 4x GUI scale.
Future proofing for maybe making NewGRF trees one day.

Later goal: Better tree painting modes for scenario editor.

image
image

src/tree_gui.cpp Outdated Show resolved Hide resolved
@nielsmh
Copy link
Contributor Author

@nielsmh nielsmh commented Jun 23, 2020

Well, I scrapped the NWID_MATRIX based code again, turns out it's really hard to get that to size well, individual buttons actually is easier. Now just generating the buttons instead of having a fixed layout.

@nielsmh
Copy link
Contributor Author

@nielsmh nielsmh commented Jun 26, 2020

Now it looks like this:
image

Planting a "grove" results in something like this:
image

Planting a "forest" results in something like this:
image

src/tree_cmd.cpp Show resolved Hide resolved
@TrueBrain
Copy link
Member

@TrueBrain TrueBrain commented Dec 14, 2020

22:49:18 <TrueBrain> nielsm: I really really really like your Trees GUI improvements
22:49:20 <TrueBrain> it looks so cute!
...
22:51:16 *** nielsm has quit IRC (Ping timeout: 480 seconds)

:D

@TrueBrain
Copy link
Member

@TrueBrain TrueBrain commented Dec 15, 2020

Rebased your work and fixed a variable that was unused. Going to test it out now :D

@DorpsGek DorpsGek temporarily deployed to preview-pr-8234 Dec 15, 2020 Inactive
Copy link
Member

@TrueBrain TrueBrain left a comment

This is really an upgrade :)

The only thing that is now slightly more apparent, the "Random trees" button. You don't expect it to work like that with all the other buttons around.

Not something that needs fixing in this PR, tbh, as it was already weird. It is just now only highlighted more :D

Awesome work!

src/tree_gui.cpp Show resolved Hide resolved
Copy link
Member

@TrueBrain TrueBrain left a comment

Awh, testing found a bug .. tooltip say you can drag small and large forest, but you cannot :( I will see if I can discover why not myself too, but if you are interested in solving it, feel welcome :)

@2TallTyler
Copy link
Member

@2TallTyler 2TallTyler commented Dec 15, 2020

This is very nice. Is there a reason it's restricted to Scenario Editor and we can't have it in-game?

@TrueBrain
Copy link
Member

@TrueBrain TrueBrain commented Dec 26, 2020

2020-12-26.15-15-53.mp4

Rate how awesome this is on a scale from 1 to 10 plz :D

@DorpsGek DorpsGek temporarily deployed to preview-pr-8234 Dec 26, 2020 Inactive
@TrueBrain
Copy link
Member

@TrueBrain TrueBrain commented Dec 26, 2020

I hope @nielsm doesn't mind, but I hijacked his PR and implemented real dragging of trees; it was easier than trying to figure out how to do selections thingy :D

Let me know what you guys think of this, if it is usable etc :)

@TrueBrain
Copy link
Member

@TrueBrain TrueBrain commented Dec 26, 2020

@2TallTyler

This is very nice. Is there a reason it's restricted to Scenario Editor and we can't have it in-game?

In this implementation it is only possible to do this in the SE, as it would otherwise fire so many DoCommands in MultiPlayer it will effectively DDoS the server :P That is what you get for pretty things :D

@LordAro
Copy link
Member

@LordAro LordAro commented Dec 26, 2020

If I open up the tree window in the scenario editor and click once (place trees in a single spot), the cursor changes from a dot to a square.

@TrueBrain
Copy link
Member

@TrueBrain TrueBrain commented Dec 26, 2020

@LordAro

If I open up the tree window in the scenario editor and click once (place trees in a single spot), the cursor changes from a dot to a square.

I cannot reproduce this issue. Do you have a screenshot for me?

Nevermind, found it: build a road first, after that, build trees. Fixed now :)

Copy link
Member

@LordAro LordAro left a comment

:o

@TrueBrain TrueBrain merged commit 2d9fa81 into OpenTTD:master Dec 27, 2020
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants