Skip to content

Commit 81dab12

Browse files
authored
Merge pull request #277 from cortex-command-community/fix-posteffect-rotation
Fix post effect rotation
2 parents 41e6b70 + 114e3b5 commit 81dab12

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

Source/Managers/PostProcessMan.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include "tracy/Tracy.hpp"
2121
#include "tracy/TracyOpenGL.hpp"
22+
#include "raylib/raylib.h"
2223

2324
#include <array>
2425

@@ -408,9 +409,8 @@ void PostProcessMan::DrawDotGlowEffects() {
408409
}
409410

410411
void PostProcessMan::DrawPostScreenEffects() {
411-
BITMAP* effectBitmap = nullptr;
412-
float effectPosX = 0;
413-
float effectPosY = 0;
412+
int effectPosX = 0;
413+
int effectPosY = 0;
414414
unsigned char effectStrength = 0;
415415

416416
GL_CHECK(glActiveTexture(GL_TEXTURE0));
@@ -421,11 +421,16 @@ void PostProcessMan::DrawPostScreenEffects() {
421421

422422
for (const PostEffect& postEffect: m_PostScreenEffects) {
423423
if (postEffect.m_Bitmap) {
424-
effectBitmap = postEffect.m_Bitmap;
425424
effectStrength = postEffect.m_Strength;
426-
effectPosX = postEffect.m_Pos.m_X - postEffect.m_Bitmap->w / 2;
427-
effectPosY = postEffect.m_Pos.m_Y - postEffect.m_Bitmap->h / 2;
428-
DrawTexture(g_GLResourceMan.GetStaticTextureFromBitmap(postEffect.m_Bitmap), effectPosX, effectPosY, {.r=effectStrength, .g=effectStrength, .b=effectStrength, .a=255});
425+
effectPosX = postEffect.m_Pos.GetFloorIntX();
426+
effectPosY = postEffect.m_Pos.GetFloorIntY();
427+
DrawTexturePro(
428+
g_GLResourceMan.GetStaticTextureFromBitmap(postEffect.m_Bitmap),
429+
Rectangle(0, 0, postEffect.m_Bitmap->w, postEffect.m_Bitmap->h),
430+
Rectangle(effectPosX, effectPosY, postEffect.m_Bitmap->w, postEffect.m_Bitmap->h),
431+
Vector2(postEffect.m_Bitmap->w / 2, postEffect.m_Bitmap->h / 2),
432+
postEffect.m_Angle,
433+
{.r=effectStrength, .g=effectStrength, .b=effectStrength, .a=255});
429434
}
430435
}
431436
}

0 commit comments

Comments
 (0)