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

improvement: textures scale to size #551

Merged
merged 6 commits into from
Aug 25, 2020

Conversation

IsaacLic
Copy link
Contributor

@IsaacLic IsaacLic commented Aug 20, 2020

Description

This fixes the graphics scaling and aligns the sprite with the collision mesh. As of now, it is slightly inaccurate.

Testing

Start the game with a small ship and poke the edges gently to see if the asteroid's meshes are aligned with the sprite. Repeat at a few different sizes.

Outstanding Work

I'm not sure that the multi-sprite renderables work (e.g. a ship with a gun). That needs to be tested and possibly fixed. The collision mesh alignment is also inaccurate, so that needs to be fixed. See issue #552

Copy link
Member

@Cervator Cervator left a comment

Choose a reason for hiding this comment

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

Just some assorted comments here. I did test it and still sank in a bit on the right side of the asteroid, left side seemed fine. Which was about the same last time, but I did really get the latest code for sure, honest!

I seem to recall the exact asteroid picked varies? In which case maybe that explains the subtle differences at times without making changes. I don't want to be an asteroidist but they do kinda all look alike ...

public EventResult onRender(RenderEvent event, EntityRef entity) {

if (!entity.hasComponent(Invisible.class)) {
Renderable renderable = entity.getComponent(Renderable.class).get();
if (!renderable.isInvisible) {
Copy link
Member

Choose a reason for hiding this comment

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

More of a stray thought than important here, but we had talked about this on Discord recently, with the move from an Invisible component to a boolean inside Renderable - one thing I forgot to mention as a nice benefit to having more components is being able to filter on them in the @ReceiveEvent which is a nice way to avoid if statements and keep the handlers simple.

However, in this case being invisible would be the less likely case, it would seem, and we can't test for "Renderable, Position, and Size, but not Invisible" in the annotation anyway 🤔 Hmm, wonder if that would be useful to have. That then might make one think about whether there should be a a Visible component instead but ... then that's essentially Renderable. ECS: A different bicycle than OOP, but both still fall over at times ;-)

Copy link
Contributor Author

@IsaacLic IsaacLic Aug 23, 2020

Choose a reason for hiding this comment

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

I definitely hear the benefits of booleans in a component and of having separate components. Maybe you can talk about it with @immortius :)

@NicholasBatesNZ NicholasBatesNZ added this to the v2.1.0 milestone Aug 25, 2020
@NicholasBatesNZ NicholasBatesNZ changed the title fix: textures scale to size improvement: textures scale to size Aug 25, 2020
Copy link
Member

@NicholasBatesNZ NicholasBatesNZ left a comment

Choose a reason for hiding this comment

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

Approving with #552

@NicholasBatesNZ NicholasBatesNZ merged commit f43d4b1 into MovingBlocks:develop Aug 25, 2020
@IsaacLic IsaacLic deleted the renderingFix branch October 11, 2021 16:15
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