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

hud: Invert touch screen buttons when pressed #16

Merged
merged 2 commits into from
Dec 5, 2024
Merged

Conversation

wjt
Copy link
Member

@wjt wjt commented Dec 5, 2024

This uses the inverted assets that were added to the repo in commit d1a0522 to provide simple visual feedback when a button is pressed.

Screencast.from.2024-12-05.14-08-27.webm

This uses the inverted assets that were added to the repo in
commit d1a0522 to provide simple visual
feedback when a button is pressed.
@wjt wjt requested a review from jbourqueendless December 5, 2024 14:07
Previously, an enemy could creep up on you by being underneath one of
the buttons. This was more of a problem in multiplayer games, where the
camera zooms out only as far as necessary to fit both players on the
screen. Of course, there aren't touch controls for the second player,
but the learner could always add them.

Set the buttons to 75% opacity.
@wjt
Copy link
Member Author

wjt commented Dec 5, 2024

Pushed another patch to make the buttons semitransparent.

image

Copy link
Contributor

@manuq manuq 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 to me! The color invertion can also be done by a simple fragment shader:

shader_type canvas_item;

void fragment() {
	vec4 c = texture(TEXTURE, UV);
	COLOR = vec4(1.0 - c.rgb, c.a);
}

I just tried it and it works. However swapping assets gives more control on the graphic design side.

@wjt
Copy link
Member Author

wjt commented Dec 5, 2024

I think using the inverted asset (rater than a shader) might also be a bit more self-explanatory for a learner, too.

@manuq manuq merged commit 0562921 into main Dec 5, 2024
1 check passed
@manuq manuq deleted the push-vrmwwrlmkxrx branch December 5, 2024 19:40
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.

2 participants