diff --git a/RetroFE/Source/Graphics/Component/Component.cpp b/RetroFE/Source/Graphics/Component/Component.cpp index 86fa3af..cd9e418 100644 --- a/RetroFE/Source/Graphics/Component/Component.cpp +++ b/RetroFE/Source/Graphics/Component/Component.cpp @@ -175,7 +175,7 @@ void Component::draw() static_cast(baseViewInfo.BackgroundGreen*255), static_cast(baseViewInfo.BackgroundBlue*255)); - SDL::renderCopy(backgroundTexture_, static_cast(baseViewInfo.BackgroundAlpha*255), NULL, &rect, baseViewInfo.Angle, baseViewInfo.Reflection, baseViewInfo.ReflectionDistance, baseViewInfo.ReflectionScale, static_cast(baseViewInfo.ReflectionAlpha*255)); + SDL::renderCopy(backgroundTexture_, baseViewInfo.BackgroundAlpha, NULL, &rect, baseViewInfo.Angle, baseViewInfo.Reflection, baseViewInfo.ReflectionDistance, baseViewInfo.ReflectionScale, baseViewInfo.ReflectionAlpha); } } diff --git a/RetroFE/Source/Graphics/Component/Image.cpp b/RetroFE/Source/Graphics/Component/Image.cpp index b24a480..21c32d0 100644 --- a/RetroFE/Source/Graphics/Component/Image.cpp +++ b/RetroFE/Source/Graphics/Component/Image.cpp @@ -89,6 +89,6 @@ void Image::draw() rect.h = static_cast(baseViewInfo.ScaledHeight()); rect.w = static_cast(baseViewInfo.ScaledWidth()); - SDL::renderCopy(texture_, static_cast((baseViewInfo.Alpha * 255)), NULL, &rect, baseViewInfo.Angle, baseViewInfo.Reflection, baseViewInfo.ReflectionDistance, baseViewInfo.ReflectionScale, static_cast(baseViewInfo.ReflectionAlpha*255)); + SDL::renderCopy(texture_, baseViewInfo.Alpha, NULL, &rect, baseViewInfo.Angle, baseViewInfo.Reflection, baseViewInfo.ReflectionDistance, baseViewInfo.ReflectionScale, baseViewInfo.ReflectionAlpha); } } diff --git a/RetroFE/Source/Graphics/Component/Text.cpp b/RetroFE/Source/Graphics/Component/Text.cpp index 90805eb..7613204 100644 --- a/RetroFE/Source/Graphics/Component/Text.cpp +++ b/RetroFE/Source/Graphics/Component/Text.cpp @@ -133,7 +133,7 @@ void Text::draw() } - SDL::renderCopy(t, static_cast(baseViewInfo.Alpha * 255), &charRect, &rect, baseViewInfo.Angle, baseViewInfo.Reflection, baseViewInfo.ReflectionDistance, baseViewInfo.ReflectionScale, static_cast(baseViewInfo.ReflectionAlpha*255)); + SDL::renderCopy(t, baseViewInfo.Alpha, &charRect, &rect, baseViewInfo.Angle, baseViewInfo.Reflection, baseViewInfo.ReflectionDistance, baseViewInfo.ReflectionScale, baseViewInfo.ReflectionAlpha); rect.x += static_cast(glyph.advance * scale); diff --git a/RetroFE/Source/Graphics/Component/VideoComponent.cpp b/RetroFE/Source/Graphics/Component/VideoComponent.cpp index d5bc960..0a1644a 100644 --- a/RetroFE/Source/Graphics/Component/VideoComponent.cpp +++ b/RetroFE/Source/Graphics/Component/VideoComponent.cpp @@ -100,6 +100,6 @@ void VideoComponent::draw() if(texture) { - SDL::renderCopy(texture, static_cast(baseViewInfo.Alpha * 255), NULL, &rect, static_cast(baseViewInfo.Angle), baseViewInfo.Reflection, baseViewInfo.ReflectionDistance, baseViewInfo.ReflectionScale, static_cast(baseViewInfo.ReflectionAlpha*255)); + SDL::renderCopy(texture, baseViewInfo.Alpha, NULL, &rect, static_cast(baseViewInfo.Angle), baseViewInfo.Reflection, baseViewInfo.ReflectionDistance, baseViewInfo.ReflectionScale, baseViewInfo.ReflectionAlpha); } } diff --git a/RetroFE/Source/SDL.cpp b/RetroFE/Source/SDL.cpp index 9fbd663..d056992 100644 --- a/RetroFE/Source/SDL.cpp +++ b/RetroFE/Source/SDL.cpp @@ -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(alpha * 255)); SDL_RenderCopyEx(getRenderer(), texture, src, &rotateRect, angle, NULL, SDL_FLIP_NONE); if (reflection == "top") { rotateRect.h = static_cast(static_cast(rotateRect.h) * reflectionScale); rotateRect.y = rotateRect.y - rotateRect.h - reflectionDistance; - SDL_SetTextureAlphaMod(texture, reflectionAlpha * alpha); + SDL_SetTextureAlphaMod(texture, static_cast(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(static_cast(rotateRect.h) * reflectionScale); - SDL_SetTextureAlphaMod(texture, reflectionAlpha * alpha); + SDL_SetTextureAlphaMod(texture, static_cast(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(static_cast(rotateRect.w) * reflectionScale); rotateRect.x = rotateRect.x - rotateRect.w - reflectionDistance; - SDL_SetTextureAlphaMod(texture, reflectionAlpha * alpha); + SDL_SetTextureAlphaMod(texture, static_cast(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(static_cast(rotateRect.w) * reflectionScale); - SDL_SetTextureAlphaMod(texture, reflectionAlpha * alpha); + SDL_SetTextureAlphaMod(texture, static_cast(reflectionAlpha * alpha * 255)); SDL_RenderCopyEx(getRenderer(), texture, src, &rotateRect, angle, NULL, SDL_FLIP_HORIZONTAL); } diff --git a/RetroFE/Source/SDL.h b/RetroFE/Source/SDL.h index 6bf4645..92449cc 100644 --- a/RetroFE/Source/SDL.h +++ b/RetroFE/Source/SDL.h @@ -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_;