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

Add repeat fit mode to image decorator #493

Merged
merged 5 commits into from
Aug 7, 2023

Conversation

viseztrance
Copy link
Contributor

@viseztrance viseztrance commented Aug 6, 2023

I needed the ability to repeat a texture, and stumbled onto this issue.

We could also add an image-fit: repeat property value to the image decorator, I'd happily take a PR for that.

The caveat is that this won't work using spritesheets, though I imagine you can still use atlases for repeating on a single axis, provided there are no gaps at the edges for that specific direction.

I haven't seen any regression anywhere by switching to GL_REPEAT but please double check.

image

Copy link
Owner

@mikke89 mikke89 left a comment

Choose a reason for hiding this comment

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

Very good! Thanks for the PR.

I think it would be helpful to add a warning and stop it from making the decorator when using a sprite together with the repeat modes. Could you implement that?

Perhaps we could name the new image something a bit more descriptive, e.g. alien_small.tga?

@mikke89 mikke89 added the enhancement New feature or request label Aug 6, 2023
@viseztrance
Copy link
Contributor Author

I made the changes. I don't know if there's a better way of checking if we're within a spritesheet or not, but it works.

As long as the it fills the entire texture, you can still use these in a spritesheet with a single element and no warning will appear. So you can still have control over the size of the texture by using the resolution (magnification) field.

@mikke89 mikke89 merged commit 14a393a into mikke89:master Aug 7, 2023
13 checks passed
@mikke89
Copy link
Owner

mikke89 commented Aug 7, 2023

Looks great! Thanks again for the pull request :)

If you want to, it would be helpful if you could add this feature to the documentation: https://mikke89.github.io/RmlUiDoc/pages/rcss/decorators/image.html

@viseztrance viseztrance deleted the implement-image-repeat branch August 7, 2023 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants