Forgot to move images and delete old files
6
.gitignore
vendored
@ -2,9 +2,9 @@
|
|||||||
##################
|
##################
|
||||||
*.exe
|
*.exe
|
||||||
|
|
||||||
# Binary #
|
# Linux Binary #
|
||||||
##########
|
################
|
||||||
/bin
|
Trololo
|
||||||
|
|
||||||
# Windows scripts #
|
# Windows scripts #
|
||||||
###################
|
###################
|
||||||
|
Before Width: | Height: | Size: 203 KiB After Width: | Height: | Size: 203 KiB |
Before Width: | Height: | Size: 2.3 MiB After Width: | Height: | Size: 2.3 MiB |
104
commonSDL.h
@ -1,104 +0,0 @@
|
|||||||
// SDL + Extensions
|
|
||||||
#include "SDL/SDL.h"
|
|
||||||
#include "SDL/SDL_image.h"
|
|
||||||
#include "SDL/SDL_ttf.h"
|
|
||||||
|
|
||||||
// Standard
|
|
||||||
#include <cstdio>
|
|
||||||
|
|
||||||
SDL_Surface *StartUp(const char *title, int x, int y)
|
|
||||||
{
|
|
||||||
SDL_Surface *screen;
|
|
||||||
SDL_Surface *vid_init;
|
|
||||||
int init;
|
|
||||||
|
|
||||||
init = SDL_Init(SDL_INIT_VIDEO);
|
|
||||||
|
|
||||||
// SDL failed to initiate
|
|
||||||
if(init < 0)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Unable to initiate SDL: %s\n", SDL_GetError());
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
vid_init = SDL_SetVideoMode(x, y, 32, SDL_SWSURFACE);
|
|
||||||
|
|
||||||
// Video failed to be set
|
|
||||||
if(vid_init == NULL)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Video initialization failed: %s", SDL_GetError());
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
screen = SDL_GetVideoSurface();
|
|
||||||
|
|
||||||
if(screen == NULL)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Failed to get video surface: %s", SDL_GetError());
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_WM_SetCaption(title, NULL);
|
|
||||||
|
|
||||||
//Initialize SDL_ttf
|
|
||||||
if(TTF_Init() == -1)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "True Type Font initialization failed: %s", SDL_GetError());
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Success: return video surface
|
|
||||||
return screen;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Optimize image on load to reduce processing.
|
|
||||||
SDL_Surface *load_image(const char *file)
|
|
||||||
{
|
|
||||||
SDL_Surface *image_format;
|
|
||||||
SDL_Surface *screen_format;
|
|
||||||
|
|
||||||
// Load image
|
|
||||||
image_format = IMG_Load(file);
|
|
||||||
|
|
||||||
/*
|
|
||||||
DOES THE FILE EVEN EXIST?
|
|
||||||
*/
|
|
||||||
|
|
||||||
if(image_format != NULL)
|
|
||||||
{
|
|
||||||
// Optimize
|
|
||||||
screen_format = SDL_DisplayFormat(image_format);
|
|
||||||
|
|
||||||
// Release old image
|
|
||||||
SDL_FreeSurface(image_format);
|
|
||||||
}
|
|
||||||
|
|
||||||
return screen_format;
|
|
||||||
}
|
|
||||||
|
|
||||||
void apply_image(int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* clip = NULL)
|
|
||||||
{
|
|
||||||
SDL_Rect pos;
|
|
||||||
|
|
||||||
pos.x = x;
|
|
||||||
pos.y = y;
|
|
||||||
|
|
||||||
SDL_BlitSurface(source, clip, destination, &pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Removes color from an image.
|
|
||||||
bool RemoveColor(SDL_Surface* image, Uint8 R, Uint8 G, Uint8 B)
|
|
||||||
{
|
|
||||||
int result;
|
|
||||||
|
|
||||||
// Map color on the image
|
|
||||||
Uint32 color = SDL_MapRGB(image->format, R, G, B);
|
|
||||||
|
|
||||||
// Remove color from the image.
|
|
||||||
result = SDL_SetColorKey(image, SDL_SRCCOLORKEY, color);
|
|
||||||
|
|
||||||
if(!result)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
Before Width: | Height: | Size: 188 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 125 KiB |
@ -1,3 +0,0 @@
|
|||||||
http://www.freestockphotos.biz/stockphoto/10674
|
|
||||||
http://upload.wikimedia.org/wikipedia/en/thumb/7/78/Trollface.svg/200px-Trollface.svg.png
|
|
||||||
http://www.publicdomainpictures.net/view-image.php?image=5182&picture=pool-tiles-underwater
|
|