summaryrefslogtreecommitdiff
path: root/intensemarcus.cpp
blob: c866a1a986090a0d7e321598ae1788b3abea6cd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "intensemarcus.h"

/* SDL_Surface loads an image from a file, and
   converts it into the same format as the
   display, for faster blitting. */
SDL_Surface *loadImage(std::string filename) {
    // Image as it is loaded
    SDL_Surface* raw = NULL;

    // Image converted into same format as display
    SDL_Surface* image = NULL;

    raw = IMG_Load(filename.c_str());

    if(raw != NULL) {
        // Convert the image, using the PNG's alpha channel
        image = SDL_DisplayFormatAlpha(raw);

        // Free raw image
        SDL_FreeSurface(raw);
    }

    return image;
}