mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 07:35:38 +00:00
Made the window corners slightly more rounded.
This commit is contained in:
parent
7e8d1f6434
commit
4227a609a2
|
@ -31,6 +31,7 @@ ButtonComponent::ButtonComponent(Window* window,
|
|||
, mFlatColorUnfocused{0x60606025}
|
||||
|
||||
{
|
||||
mBox.setSharpCorners(true);
|
||||
setPressedFunc(func);
|
||||
setText(text, helpText, upperCase);
|
||||
|
||||
|
|
|
@ -17,12 +17,13 @@ NinePatchComponent::NinePatchComponent(Window* window,
|
|||
const std::string& path,
|
||||
unsigned int edgeColor,
|
||||
unsigned int centerColor)
|
||||
: GuiComponent(window)
|
||||
, mVertices(nullptr)
|
||||
, mPath(path)
|
||||
, mCornerSize(16.0f, 16.0f)
|
||||
, mEdgeColor(edgeColor)
|
||||
, mCenterColor(centerColor)
|
||||
: GuiComponent{window}
|
||||
, mVertices{nullptr}
|
||||
, mPath{path}
|
||||
, mCornerSize{16.0f, 16.0f}
|
||||
, mSharpCorners{false}
|
||||
, mEdgeColor{edgeColor}
|
||||
, mCenterColor{centerColor}
|
||||
{
|
||||
if (!mPath.empty())
|
||||
buildVertices();
|
||||
|
@ -63,8 +64,9 @@ void NinePatchComponent::buildVertices()
|
|||
else {
|
||||
// Scale the corner size relative to the screen resolution (using the medium sized
|
||||
// default font as size reference).
|
||||
relCornerSize = glm::round(
|
||||
mCornerSize * (Font::get(FONT_SIZE_MEDIUM)->getLetterHeight() * 0.0568f / 2.0f));
|
||||
relCornerSize =
|
||||
glm::round(mCornerSize * (Font::get(FONT_SIZE_MEDIUM)->getLetterHeight() *
|
||||
(mSharpCorners == true ? 0.0568f : 0.09f) / 2.0f));
|
||||
}
|
||||
|
||||
mTexture = TextureResource::get(mPath, false, false, false);
|
||||
|
|
|
@ -57,6 +57,7 @@ public:
|
|||
mCornerSize = size;
|
||||
buildVertices();
|
||||
}
|
||||
void setSharpCorners(bool state) { mSharpCorners = state; }
|
||||
|
||||
private:
|
||||
void buildVertices();
|
||||
|
@ -66,6 +67,7 @@ private:
|
|||
|
||||
std::string mPath;
|
||||
glm::vec2 mCornerSize;
|
||||
bool mSharpCorners;
|
||||
unsigned int mEdgeColor;
|
||||
unsigned int mCenterColor;
|
||||
std::shared_ptr<TextureResource> mTexture;
|
||||
|
|
|
@ -29,6 +29,7 @@ TextEditComponent::TextEditComponent(Window* window)
|
|||
, mBox{window, ":/graphics/textinput.svg"}
|
||||
, mFont{Font::get(FONT_SIZE_MEDIUM, FONT_PATH_LIGHT)}
|
||||
{
|
||||
mBox.setSharpCorners(true);
|
||||
addChild(&mBox);
|
||||
onFocusLost();
|
||||
setSize(4096, mFont->getHeight() + (TEXT_PADDING_VERT * Renderer::getScreenHeightModifier()));
|
||||
|
|
Loading…
Reference in a new issue