Skip to content

Associate and use spawnable entity icons/traces #2495

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

Merged
merged 4 commits into from
Jul 11, 2025

Conversation

oznogon
Copy link
Contributor

@oznogon oznogon commented Jul 8, 2025

This PR builds on #2494.

Associate icons with ShipSpawnInfo and ObjectSpawnInfo, then use them in the GM entity creation screen lists:

image

Also use them as the cursor state for entity creation on the GM screen:

Screencast_20250708_101832.webm

In the process, this sets an on_gm_click_cursor string in gameGlobalInfo to define the cursor used on the GM screen when on_gm_click is defined. This is not yet exposed to scripting.

@oznogon oznogon force-pushed the associate-spawnables-icons branch from 43a3574 to 9ce8ef8 Compare July 9, 2025 15:37
lua_pop(L, 1);
result.push_back({callback, label ? label : "", category ? category : "", description ? description : ""});
result.push_back({callback, label ? label : "", category ? category : "", description ? description : "", icon ? icon : ""});
Copy link
Owner

Choose a reason for hiding this comment

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

what with the mouse cursor when this "" case is hit?
And how does it interact with the onGMClick lua function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added handling of an empty icon string to default to mouse_create.png, and added an icon parameter to onGMClick that defaults to mouse_create.png if not set.

- Handle potential empty on_gm_click_cursor state
- Add icon parameter to Lua onGMClick function
@daid daid merged commit 9f28f32 into daid:master Jul 11, 2025
5 checks passed
@aBlueShadow
Copy link
Contributor

While they are looking cool, the downside is that the placement is now less precise. Not sure how often that will be relevant

@daid
Copy link
Owner

daid commented Jul 14, 2025

While they are looking cool, the downside is that the placement is now less precise. Not sure how often that will be relevant

Don't think that's a huge issue. I was working on something yesterday, and I really liked that you have this clear indication that you are placing something. I think it's a huge UX improvement.

@aBlueShadow
Copy link
Contributor

aBlueShadow commented Jul 14, 2025

I was working on something yesterday, and I really liked that you have this clear indication that you are placing something. I think it's a huge UX improvement.

Well, you had that indication of placing something already with the crosshair in #2494. Granted, now there is also a hint of what to place. So compared to that crosshair you gain info/awareness at the cost of precise placement.

But I agree, compared to legacy, it is definitely a big improvement

@oznogon
Copy link
Contributor Author

oznogon commented Jul 14, 2025

Cursor precision is generally a challenge because of the 32px cursor size. The default delta-shaped cursor is effectively only 16x16 px because the center of the 32px cursor image is the click point. The modal selection cursors were legible enough at 16x16 to put them next to the delta, but the ship traces less so.

In practice I didn't feel limited in precision since the cursor places the ship where the cursor appears, though it would be even better if the ship's size and rotation could also be reflected in the cursor to effectively make it a stamp. That would require extending the cursor drawing code further.

I had also considered drawing the ship icon next to the crosshair cursor to retain the precision, but it would require either compositing the radar trace and crosshair into one 32px texture at a loss of radar trace legibility (it would have to be smaller than 16px to fit), or more changes to the cursor rendering code to draw a larger cursor texture or multiple images at once.

@oznogon oznogon deleted the associate-spawnables-icons branch July 14, 2025 17:21
@aBlueShadow
Copy link
Contributor

Cursor precision is generally a challenge because of the 32px cursor size. The default delta-shaped cursor is effectively only 16x16 px because the center of the 32px cursor image is the click point.

Speaking of size, I think the main reason it feels less precise is that the cursor is twice the size of the Icon. But maybe I just have to get used to it.

I had also considered drawing the ship icon next to the crosshair cursor to retain the precision, but it would require either compositing the radar trace and crosshair into one 32px texture at a loss of radar trace legibility (it would have to be smaller than 16px to fit), or more changes to the cursor rendering code to draw a larger cursor texture or multiple images at once.

I wonder if using just the crosshair cursor while showing the icon right next to the cancel button would work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants