mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-30 18:04:09 +03:00
Use SDL_Color for colors instead of colourTransform
colourTransform is a struct with only one member, a Uint32. The issue with `Uint32`s is that it requires a bunch of bit shifting logic to edit the colors. The issue with bit shifting logic is that people have a tendency to hardcode the shift amounts instead of using the shift amount variables of the SDL_PixelFormat, which makes it annoying to change the color masks of surfaces. This commit fixes both issues by unhardcoding the bit shift amounts in DrawPixel and ReadPixel, and by axing the `Uint32`s in favor of using SDL_Color. According to the SDL_PixelFormat documentation ( https://wiki.libsdl.org/SDL2/SDL_PixelFormat ), the logic to read and draw to pixels from colors below 32-bit was just wrong. Specifically, for 8-bit, there's a color palette used instead of some intrinsic color information stored in the pixel itself. But we shouldn't need that logic anyways because we don't use colors below 32-bit. So I axed that too.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include "Enums.h"
|
||||
#include "Game.h"
|
||||
#include "Graphics.h"
|
||||
#include "GraphicsUtil.h"
|
||||
#include "Localization.h"
|
||||
#include "KeyPoll.h"
|
||||
#include "UtilityClass.h"
|
||||
@@ -9,7 +10,9 @@
|
||||
|
||||
static int pre_fakepercent=0, pre_transition=30;
|
||||
static bool pre_startgame=false;
|
||||
static int pre_darkcol=0, pre_lightcol=0, pre_curcol=0, pre_coltimer=0, pre_offset=0;
|
||||
static SDL_Color pre_darkcol = {0, 0, 0, 0};
|
||||
static SDL_Color pre_lightcol = {0, 0, 0, 0};
|
||||
static int pre_curcol = 0, pre_coltimer = 0, pre_offset = 0;
|
||||
|
||||
static int pre_frontrectx=30, pre_frontrecty=20, pre_frontrectw=260, pre_frontrecth=200;
|
||||
static int pre_temprectx=0, pre_temprecty=0, pre_temprectw=320, pre_temprecth=240;
|
||||
|
||||
Reference in New Issue
Block a user