-
Notifications
You must be signed in to change notification settings - Fork 1
/
CLoadMedia.h
47 lines (39 loc) · 1.13 KB
/
CLoadMedia.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//
// Created by igoryan on 15.04.15.
//
#ifndef TANKI_CLOADMEDIA_H
#define TANKI_CLOADMEDIA_H
#include <SDL2/SDL_surface.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include "CInitResources.h"
#include <iostream>
class CLoadMedia {
public:
CLoadMedia() {}
static SDL_Surface *LoadJPG(std::string path) {
CInitResources::IMG(IMG_INIT_JPG);
SDL_Surface *loadedSurface = IMG_Load(path.c_str());
if (loadedSurface == nullptr) {
CMyErrorShow::show_error("IMG_Load");
}
return loadedSurface;
}
static SDL_Surface *LoadPNG(std::string path) {
CInitResources::IMG(IMG_INIT_PNG);
SDL_Surface *loadedSurface = IMG_Load(path.c_str());
if (loadedSurface == nullptr) {
CMyErrorShow::show_error("IMG_Load");
}
return loadedSurface;
}
static SDL_Surface *LoadBMP(std::string path) {
SDL_Surface *loadedSurface = SDL_LoadBMP(path.c_str());
if (loadedSurface == nullptr) {
CMyErrorShow::show_error("SDL_LoadBMP");
}
return loadedSurface;
}
private:
};
#endif //TANKS_CLOADMEDIA_H