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

StandardUIDrawable::Draw #19

Open
KamiGrave opened this issue Jun 21, 2017 · 0 comments
Open

StandardUIDrawable::Draw #19

KamiGrave opened this issue Jun 21, 2017 · 0 comments

Comments

@KamiGrave
Copy link

I believe there's an assumption made when creating UI that the drawable object should be the original size of the image it came from. My assets are all from a 64x64 square and I'm using the packing process to trim the alpha to size. The reasoning for this is because I have all of my UI assets in one paintdotnet file and have a tool to export them as individual layers, which I then run through the sprite sheet tool.

What this means though is that all of my widgets need to be 64x64, despite the different sizes of the actual final image. This makes positioning difficult as everything has to take the sprite frame's offset into account and can't just be the size of the widget.
My expectation would be that the StandardUIDrawable would be the size of the parent widget. I understand this is not everyone's expectation as it's clearly implemented this way for a reason, so I would perhaps suggest a flag to turn on rendering with the alpha offset, or simply sizing the drawable to the widget size. For the moment I've replaced the render line in StandardUIDrawable::Draw with the following which gives me what I expect:
renderer->DrawBox(drawMode, transform, absSize, CS::Vector2::k_zero, m_texture, m_atlasFrame.m_uvs, absColour * m_colour, AlignmentAnchor::k_middleCentre);
changed from:
renderer->DrawBox(drawMode, transform, CalculateAlphaRestoreSize(m_atlasFrame, absSize), CalculateAlphaRestoreOffset(m_atlasFrame, absSize), m_texture, m_atlasFrame.m_uvs, absColour * m_colour, AlignmentAnchor::k_middleCentre);

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

No branches or pull requests

1 participant