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

#479: add math Shape2D destructure extensions and MapRenderer use extension #480

Merged
merged 4 commits into from
Mar 26, 2024

Conversation

Quillraven
Copy link
Contributor

PR for #479

Unfortunately, the beginRender() and endRender() methods of the OrthogonalTiledMapRenderer are protected, which means we cannot call them directly.
I never needed a custom renderer or had to override those methods. Also, they seem to never change in recent LibGDX versions. That's why I think "copy&pasting" their content is fine in this case. However, I still added a remark in the ReadMe.md that this can be a potential issue.

If you have a problem with it then feel free to remove those extensions :)

math/README.md Outdated Show resolved Hide resolved
tiled/src/main/kotlin/ktx/tiled/batchTiledMapRenderer.kt Outdated Show resolved Hide resolved
@czyzby
Copy link
Member

czyzby commented Mar 25, 2024

Unfortunately, the beginRender() and endRender() methods of the OrthogonalTiledMapRenderer are protected, which means we cannot call them directly.

There's a cheesy way to get around this. Create a separate Kotlin file, set the package to match OrthogonalTiledMapRenderer (with a warning suppression that is doesn't match the folder structure 😉), make utility functions or extension methods that call the beginRender() and endRender(), and finally use those in the use extension. This would call any overridden methods.

@Quillraven
Copy link
Contributor Author

Unfortunately, the beginRender() and endRender() methods of the OrthogonalTiledMapRenderer are protected, which means we cannot call them directly.

There's a cheesy way to get around this. Create a separate Kotlin file, set the package to match OrthogonalTiledMapRenderer (with a warning suppression that is doesn't match the folder structure 😉), make utility functions or extension methods that call the beginRender() and endRender(), and finally use those in the use extension. This would call any overridden methods.

I did that trick now. Did not know about it and feels weird that this is even possible :) But a nice solution imo for this scenario.

tiled/README.md Outdated Show resolved Hide resolved
@czyzby czyzby merged commit ddab0e7 into libktx:master Mar 26, 2024
3 checks passed
@czyzby
Copy link
Member

czyzby commented Mar 26, 2024

@Quillraven I missed that you've set the master as the target branch instead of develop. Can you set another PR to the develop branch? Sorry!

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