mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 14:15:38 +00:00
Moved Opacity logic to GuiComponent
Moved Opacity logic from ImageComponent to GuiComponent so any extender of GuiComponent che implement its opacity logic. Implemented Opacity logic for TextComponent (now text can have fade animation)
This commit is contained in:
parent
e785a2dfe0
commit
b4e554153a
|
@ -156,3 +156,14 @@ GuiComponent* GuiComponent::getParent()
|
|||
{
|
||||
return mParent;
|
||||
}
|
||||
|
||||
|
||||
unsigned char GuiComponent::getOpacity()
|
||||
{
|
||||
return mOpacity;
|
||||
}
|
||||
|
||||
void GuiComponent::setOpacity(unsigned char opacity)
|
||||
{
|
||||
mOpacity = opacity;
|
||||
}
|
|
@ -45,11 +45,14 @@ public:
|
|||
void clearChildren();
|
||||
unsigned int getChildCount();
|
||||
GuiComponent* getChild(unsigned int i);
|
||||
unsigned char getOpacity();
|
||||
void setOpacity(unsigned char opacity);
|
||||
|
||||
protected:
|
||||
//Default implementation just renders children - you should probably always call GuiComponent::onRender at some point in your custom onRender.
|
||||
virtual void onRender();
|
||||
|
||||
unsigned char mOpacity;
|
||||
Window* mWindow;
|
||||
GuiComponent* mParent;
|
||||
Vector2i mOffset;
|
||||
|
|
|
@ -352,8 +352,6 @@ bool ImageComponent::hasImage()
|
|||
return !mPath.empty();
|
||||
}
|
||||
|
||||
unsigned char ImageComponent::getOpacity() { return mOpacity; }
|
||||
void ImageComponent::setOpacity(unsigned char opacity) { mOpacity = opacity; }
|
||||
|
||||
void ImageComponent::copyScreen()
|
||||
{
|
||||
|
|
|
@ -38,9 +38,6 @@ public:
|
|||
void init();
|
||||
void deinit();
|
||||
|
||||
unsigned char getOpacity();
|
||||
void setOpacity(unsigned char opacity);
|
||||
|
||||
protected:
|
||||
void onRender();
|
||||
|
||||
|
@ -51,8 +48,6 @@ private:
|
|||
|
||||
bool mAllowUpscale, mTiled, mFlipX, mFlipY;
|
||||
|
||||
unsigned char mOpacity;
|
||||
|
||||
void loadImage(std::string path);
|
||||
void resize();
|
||||
void buildImageArray(int x, int y, GLfloat* points, GLfloat* texs, float percentageX = 1, float percentageY = 1); //writes 12 GLfloat points and 12 GLfloat texture coordinates to a given array at a given position
|
||||
|
|
|
@ -74,7 +74,7 @@ void TextComponent::onRender()
|
|||
|
||||
Renderer::pushClipRect(getGlobalOffset(), getSize());
|
||||
|
||||
Renderer::drawWrappedText(mText, (int)-mScrollPos.x, (int)-mScrollPos.y, mSize.x, mColor, font);
|
||||
Renderer::drawWrappedText(mText, (int)-mScrollPos.x, (int)-mScrollPos.y, mSize.x, mColor >> 8 << 8 | getOpacity(), font);
|
||||
|
||||
Renderer::popClipRect();
|
||||
|
||||
|
|
Loading…
Reference in a new issue