Skip to content

Issue #59 - graphics texture#265

Open
bgordley wants to merge 2 commits into
mini2Dx:masterfrom
bgordley:59-graphics-texture
Open

Issue #59 - graphics texture#265
bgordley wants to merge 2 commits into
mini2Dx:masterfrom
bgordley:59-graphics-texture

Conversation

@bgordley

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

2 participants