vchelaru / Gum

Flexible layout tool for creating UI on any platform
http://gumui.net/
MIT License
134 stars 27 forks source link

Ability to Use Linear Sampling for Sprite Rendering #155

Closed timconner closed 4 months ago

timconner commented 4 months ago

I can't seem to find a way to use linear sampling for sprite rendering with Gum sprites. Setting the Filtering variable to true on the RenderStateVariable accomplishes this, but there is no method available to make this change: https://github.com/vchelaru/Gum/blob/468dc9457e58e7c39c23ed90de117b3062c5b010/RenderingLibrary/Graphics/Renderer.cs#L19

I changed a local copy to the following as a test and can confirm I get the output that I was looking for: public bool Filtering { get; } = true;

Did I overlook something or should this be a feature request?

vchelaru commented 4 months ago

Thanks for the question, let me investigate and I'll get back to you. If necessary I'll make changes to Gum to support it.

vchelaru commented 4 months ago

This has been fixed on this commit:

https://github.com/vchelaru/Gum/commit/b4bacc42278378905a4d12a808615904d9bb2ce3

You can see it by opening the MonoGameGumInCode sample and uncommenting these lines:

https://github.com/vchelaru/Gum/blob/b4bacc42278378905a4d12a808615904d9bb2ce3/Samples/MonoGameGumInCode/MonoGameGumInCode/Game1.cs#L32

https://github.com/vchelaru/Gum/blob/b4bacc42278378905a4d12a808615904d9bb2ce3/Samples/MonoGameGumInCode/MonoGameGumInCode/Game1.cs#L34

You should see something similar to this:

image

I've added a property for the different types of TextureFilters, but I hooked in to the existing logic to support linear. Let me know if this will work or if other modes are needed.