early-access version 2835

This commit is contained in:
pineappleEA
2022-07-15 04:00:50 +02:00
parent 5c0ee5eba6
commit 0e7aef7e36
1173 changed files with 55320 additions and 18881 deletions

View File

@@ -1,5 +1,5 @@
/*
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -16,6 +16,7 @@
#include <time.h> /* for time() */
#include "testnative.h"
#include "testutils.h"
#define WINDOW_W 640
#define WINDOW_H 480
@@ -52,37 +53,6 @@ quit(int rc)
exit(rc);
}
SDL_Texture *
LoadSprite(SDL_Renderer *renderer, const char *file)
{
SDL_Surface *temp;
SDL_Texture *sprite;
/* Load the sprite image */
temp = SDL_LoadBMP(file);
if (temp == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError());
return 0;
}
/* Set transparent pixel as the pixel at (0,0) */
if (temp->format->palette) {
SDL_SetColorKey(temp, 1, *(Uint8 *) temp->pixels);
}
/* Create textures from the image */
sprite = SDL_CreateTextureFromSurface(renderer, temp);
if (!sprite) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError());
SDL_FreeSurface(temp);
return 0;
}
SDL_FreeSurface(temp);
/* We're ready to roll. :) */
return sprite;
}
void
MoveSprites(SDL_Renderer * renderer, SDL_Texture * sprite)
{
@@ -180,7 +150,7 @@ main(int argc, char *argv[])
SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF);
SDL_RenderClear(renderer);
sprite = LoadSprite(renderer, "icon.bmp");
sprite = LoadTexture(renderer, "icon.bmp", SDL_TRUE, NULL, NULL);
if (!sprite) {
quit(6);
}