updated to latest SDL2 (f9244b2a151)

This commit is contained in:
fysx
2014-10-21 12:20:26 +02:00
parent 8df94d2a8a
commit 4ec2e26985
340 changed files with 20705 additions and 20917 deletions
+7 -48
View File
@@ -28,51 +28,6 @@
#define SCREEN_HEIGHT 317
#endif
static const char *
ControllerAxisName(const SDL_GameControllerAxis axis)
{
switch (axis)
{
#define AXIS_CASE(ax) case SDL_CONTROLLER_AXIS_##ax: return #ax
AXIS_CASE(INVALID);
AXIS_CASE(LEFTX);
AXIS_CASE(LEFTY);
AXIS_CASE(RIGHTX);
AXIS_CASE(RIGHTY);
AXIS_CASE(TRIGGERLEFT);
AXIS_CASE(TRIGGERRIGHT);
#undef AXIS_CASE
default: return "???";
}
}
static const char *
ControllerButtonName(const SDL_GameControllerButton button)
{
switch (button)
{
#define BUTTON_CASE(btn) case SDL_CONTROLLER_BUTTON_##btn: return #btn
BUTTON_CASE(INVALID);
BUTTON_CASE(A);
BUTTON_CASE(B);
BUTTON_CASE(X);
BUTTON_CASE(Y);
BUTTON_CASE(BACK);
BUTTON_CASE(GUIDE);
BUTTON_CASE(START);
BUTTON_CASE(LEFTSTICK);
BUTTON_CASE(RIGHTSTICK);
BUTTON_CASE(LEFTSHOULDER);
BUTTON_CASE(RIGHTSHOULDER);
BUTTON_CASE(DPAD_UP);
BUTTON_CASE(DPAD_DOWN);
BUTTON_CASE(DPAD_LEFT);
BUTTON_CASE(DPAD_RIGHT);
#undef BUTTON_CASE
default: return "???";
}
}
static SDL_Texture *
LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent)
{
@@ -85,9 +40,13 @@ LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent)
} else {
/* Set transparent pixel as the pixel at (0,0) */
if (transparent) {
SDL_assert(!temp->format->palette);
SDL_assert(temp->format->BitsPerPixel == 24);
SDL_SetColorKey(temp, SDL_TRUE, (*(Uint32 *) temp->pixels) & 0x00FFFFFF);
if (temp->format->BytesPerPixel == 1) {
SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *)temp->pixels);
} else {
SDL_assert(!temp->format->palette);
SDL_assert(temp->format->BitsPerPixel == 24);
SDL_SetColorKey(temp, SDL_TRUE, (*(Uint32 *)temp->pixels) & 0x00FFFFFF);
}
}
texture = SDL_CreateTextureFromSurface(renderer, temp);