mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-12 17:58:53 +01:00
Fixed reflectionAlpha support.
This commit is contained in:
parent
dc74226a37
commit
62e9f7eaa3
@ -175,7 +175,7 @@ void Component::draw()
|
||||
static_cast<char>(baseViewInfo.BackgroundGreen*255),
|
||||
static_cast<char>(baseViewInfo.BackgroundBlue*255));
|
||||
|
||||
SDL::renderCopy(backgroundTexture_, static_cast<char>(baseViewInfo.BackgroundAlpha*255), NULL, &rect, baseViewInfo.Angle, baseViewInfo.Reflection, baseViewInfo.ReflectionDistance, baseViewInfo.ReflectionScale, static_cast<char>(baseViewInfo.ReflectionAlpha*255));
|
||||
SDL::renderCopy(backgroundTexture_, baseViewInfo.BackgroundAlpha, NULL, &rect, baseViewInfo.Angle, baseViewInfo.Reflection, baseViewInfo.ReflectionDistance, baseViewInfo.ReflectionScale, baseViewInfo.ReflectionAlpha);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -89,6 +89,6 @@ void Image::draw()
|
||||
rect.h = static_cast<int>(baseViewInfo.ScaledHeight());
|
||||
rect.w = static_cast<int>(baseViewInfo.ScaledWidth());
|
||||
|
||||
SDL::renderCopy(texture_, static_cast<char>((baseViewInfo.Alpha * 255)), NULL, &rect, baseViewInfo.Angle, baseViewInfo.Reflection, baseViewInfo.ReflectionDistance, baseViewInfo.ReflectionScale, static_cast<char>(baseViewInfo.ReflectionAlpha*255));
|
||||
SDL::renderCopy(texture_, baseViewInfo.Alpha, NULL, &rect, baseViewInfo.Angle, baseViewInfo.Reflection, baseViewInfo.ReflectionDistance, baseViewInfo.ReflectionScale, baseViewInfo.ReflectionAlpha);
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ void Text::draw()
|
||||
}
|
||||
|
||||
|
||||
SDL::renderCopy(t, static_cast<char>(baseViewInfo.Alpha * 255), &charRect, &rect, baseViewInfo.Angle, baseViewInfo.Reflection, baseViewInfo.ReflectionDistance, baseViewInfo.ReflectionScale, static_cast<char>(baseViewInfo.ReflectionAlpha*255));
|
||||
SDL::renderCopy(t, baseViewInfo.Alpha, &charRect, &rect, baseViewInfo.Angle, baseViewInfo.Reflection, baseViewInfo.ReflectionDistance, baseViewInfo.ReflectionScale, baseViewInfo.ReflectionAlpha);
|
||||
|
||||
rect.x += static_cast<int>(glyph.advance * scale);
|
||||
|
||||
|
||||
@ -100,6 +100,6 @@ void VideoComponent::draw()
|
||||
|
||||
if(texture)
|
||||
{
|
||||
SDL::renderCopy(texture, static_cast<int>(baseViewInfo.Alpha * 255), NULL, &rect, static_cast<int>(baseViewInfo.Angle), baseViewInfo.Reflection, baseViewInfo.ReflectionDistance, baseViewInfo.ReflectionScale, static_cast<char>(baseViewInfo.ReflectionAlpha*255));
|
||||
SDL::renderCopy(texture, baseViewInfo.Alpha, NULL, &rect, static_cast<int>(baseViewInfo.Angle), baseViewInfo.Reflection, baseViewInfo.ReflectionDistance, baseViewInfo.ReflectionScale, baseViewInfo.ReflectionAlpha);
|
||||
}
|
||||
}
|
||||
|
||||
@ -255,7 +255,7 @@ SDL_Window* SDL::getWindow()
|
||||
return window_;
|
||||
}
|
||||
|
||||
bool SDL::renderCopy(SDL_Texture *texture, unsigned char alpha, SDL_Rect *src, SDL_Rect *dest, double angle, std::string reflection, unsigned int reflectionDistance, double reflectionScale, unsigned char reflectionAlpha)
|
||||
bool SDL::renderCopy(SDL_Texture *texture, float alpha, SDL_Rect *src, SDL_Rect *dest, double angle, std::string reflection, unsigned int reflectionDistance, double reflectionScale, float reflectionAlpha)
|
||||
{
|
||||
SDL_Rect rotateRect;
|
||||
rotateRect.w = dest->w;
|
||||
@ -272,14 +272,14 @@ bool SDL::renderCopy(SDL_Texture *texture, unsigned char alpha, SDL_Rect *src, S
|
||||
rotateRect.y = dest->y;
|
||||
}
|
||||
|
||||
SDL_SetTextureAlphaMod(texture, alpha);
|
||||
SDL_SetTextureAlphaMod(texture, static_cast<char>(alpha * 255));
|
||||
SDL_RenderCopyEx(getRenderer(), texture, src, &rotateRect, angle, NULL, SDL_FLIP_NONE);
|
||||
|
||||
if (reflection == "top")
|
||||
{
|
||||
rotateRect.h = static_cast<unsigned int>(static_cast<float>(rotateRect.h) * reflectionScale);
|
||||
rotateRect.y = rotateRect.y - rotateRect.h - reflectionDistance;
|
||||
SDL_SetTextureAlphaMod(texture, reflectionAlpha * alpha);
|
||||
SDL_SetTextureAlphaMod(texture, static_cast<char>(reflectionAlpha * alpha * 255));
|
||||
SDL_RenderCopyEx(getRenderer(), texture, src, &rotateRect, angle, NULL, SDL_FLIP_VERTICAL);
|
||||
}
|
||||
|
||||
@ -287,7 +287,7 @@ bool SDL::renderCopy(SDL_Texture *texture, unsigned char alpha, SDL_Rect *src, S
|
||||
{
|
||||
rotateRect.y = rotateRect.y + rotateRect.h + reflectionDistance;
|
||||
rotateRect.h = static_cast<unsigned int>(static_cast<float>(rotateRect.h) * reflectionScale);
|
||||
SDL_SetTextureAlphaMod(texture, reflectionAlpha * alpha);
|
||||
SDL_SetTextureAlphaMod(texture, static_cast<char>(reflectionAlpha * alpha * 255));
|
||||
SDL_RenderCopyEx(getRenderer(), texture, src, &rotateRect, angle, NULL, SDL_FLIP_VERTICAL);
|
||||
}
|
||||
|
||||
@ -295,7 +295,7 @@ bool SDL::renderCopy(SDL_Texture *texture, unsigned char alpha, SDL_Rect *src, S
|
||||
{
|
||||
rotateRect.w = static_cast<unsigned int>(static_cast<float>(rotateRect.w) * reflectionScale);
|
||||
rotateRect.x = rotateRect.x - rotateRect.w - reflectionDistance;
|
||||
SDL_SetTextureAlphaMod(texture, reflectionAlpha * alpha);
|
||||
SDL_SetTextureAlphaMod(texture, static_cast<char>(reflectionAlpha * alpha * 255));
|
||||
SDL_RenderCopyEx(getRenderer(), texture, src, &rotateRect, angle, NULL, SDL_FLIP_HORIZONTAL);
|
||||
}
|
||||
|
||||
@ -303,7 +303,7 @@ bool SDL::renderCopy(SDL_Texture *texture, unsigned char alpha, SDL_Rect *src, S
|
||||
{
|
||||
rotateRect.x = rotateRect.x + rotateRect.w + reflectionDistance;
|
||||
rotateRect.w = static_cast<unsigned int>(static_cast<float>(rotateRect.w) * reflectionScale);
|
||||
SDL_SetTextureAlphaMod(texture, reflectionAlpha * alpha);
|
||||
SDL_SetTextureAlphaMod(texture, static_cast<char>(reflectionAlpha * alpha * 255));
|
||||
SDL_RenderCopyEx(getRenderer(), texture, src, &rotateRect, angle, NULL, SDL_FLIP_HORIZONTAL);
|
||||
}
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ public:
|
||||
static SDL_Renderer *getRenderer();
|
||||
static SDL_mutex *getMutex();
|
||||
static SDL_Window *getWindow();
|
||||
static bool renderCopy(SDL_Texture *texture, unsigned char alpha, SDL_Rect *src, SDL_Rect *dest, double angle, std::string reflection = "", unsigned int reflectionDistance = 0, double reflectionScale = 0.25, unsigned char reflectionAlpha = '0');
|
||||
static bool renderCopy(SDL_Texture *texture, float alpha, SDL_Rect *src, SDL_Rect *dest, double angle, std::string reflection = "", unsigned int reflectionDistance = 0, double reflectionScale = 0.25, float reflectionAlpha = 0.0f);
|
||||
static int getWindowWidth()
|
||||
{
|
||||
return windowWidth_;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user