Skip to content

Commit

Permalink
Move LightFX into its own namespace (OpenRCT2#23506)
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronVanGeffen authored Dec 30, 2024
1 parent 9ba4beb commit 23d4032
Show file tree
Hide file tree
Showing 28 changed files with 968 additions and 952 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class HardwareDisplayDrawingEngine final : public X8DrawingEngine

if (Config::Get().general.EnableLightFx)
{
auto& lightPalette = LightFXGetPalette();
auto& lightPalette = LightFx::GetPalette();
for (int32_t i = 0; i < 256; i++)
{
const auto& src = lightPalette[i];
Expand Down Expand Up @@ -238,7 +238,7 @@ class HardwareDisplayDrawingEngine final : public X8DrawingEngine
int32_t pitch;
if (SDL_LockTexture(_screenTexture, nullptr, &pixels, &pitch) == 0)
{
LightFXRenderToTexture(pixels, pitch, _bits, _width, _height, _paletteHWMapped, _lightPaletteHWMapped);
LightFx::RenderToTexture(pixels, pitch, _bits, _width, _height, _paletteHWMapped, _lightPaletteHWMapped);
SDL_UnlockTexture(_screenTexture);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class OpenGLDrawingEngine final : public IDrawingEngine
{
_window = static_cast<SDL_Window*>(_uiContext->GetWindow());
_bitsDPI.DrawingEngine = this;
LightFXSetAvailable(false);
LightFx::SetAvailable(false);
}

~OpenGLDrawingEngine() override
Expand Down
2 changes: 1 addition & 1 deletion src/openrct2/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ namespace OpenRCT2
{
return false;
}
LightFXInit();
Drawing::LightFx::Init();
}

ViewportInitAll();
Expand Down
5 changes: 3 additions & 2 deletions src/openrct2/drawing/Drawing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <numeric>

using namespace OpenRCT2;
using namespace OpenRCT2::Drawing;

static auto _defaultPaletteMapping = []() {
std::array<uint8_t, 256> res;
Expand Down Expand Up @@ -898,9 +899,9 @@ void UpdatePalette(std::span<const OpenRCT2::Drawing::PaletteBGRA> palette, int3
uint8_t g = colour.Green;
uint8_t r = colour.Red;

if (LightFXIsAvailable())
if (LightFx::IsAvailable())
{
LightFXApplyPaletteFilter(i, &r, &g, &b);
LightFx::ApplyPaletteFilter(i, &r, &g, &b);
}
else
{
Expand Down
Loading

0 comments on commit 23d4032

Please sign in to comment.