You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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);
The text was updated successfully, but these errors were encountered:
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);
The text was updated successfully, but these errors were encountered: