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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #59 - graphics texture #265

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Issue #59 - graphics texture #265

wants to merge 2 commits into from

Conversation

bgordley
Copy link

Noticed that issue #59 was tagged with help wanted so I jumped in to help. Here is a brief description of what I changed and some additional questions that I have.

What Changed

  • Added another overloaded Graphics.drawTexture method that applies the x, y, width, and height values of a provided shape to the texture being drawn.
  • Updated the CHANGES file with details regarding this additional functionality

Questions

  • Code-related
    • Should the shape's rotation also be applied to the texture somehow?
    • How should I go about writing unit tests for this?
  • General
    • Which branch should I point this PR to?
    • Does this change require cutting a maven central release?

Thanks for your time, hopefully this is helpful. 馃槃

@tomcashman
Copy link
Contributor

Thanks for contributing! :)

This change would only cover rectangular shapes and not Circles, Polygons, etc. The goal of this issue is to replicate Slick2D's similar function found here.

In regards to your questions:

  • Yeah the shape's rotation would need to be applied
  • We don't usually add unit tests for the Graphics class, instead add some code to the GraphicsUat class and run ./gradlew launchDesktop3 to test it in the UAT app. This allows us to verify the behavior is correct across the different runtimes.
  • PR should be sent to master
  • Yep I'll make another tag once a few more fixes go in to the current snapshot

@bgordley
Copy link
Author

Awesome! I'll dig into the Slick2D functionality and come up with a solution that passes UAT behavior. Thanks for the feedback!

@bgordley
Copy link
Author

Spent some time reviewing the Slick2D implementation of textures applied to shapes. Here is my understanding of the desired behavior.

  • Texture will be stretched to fill the shape by default
  • Any parts of the texture that are outside of the shape bounds will be clipped
  • Texture may optionally be tiled inside the shape if smaller than the shape
  • Texture will respect the location and rotation of the shape

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.

None yet

2 participants