Arch Game Engine  0.2
image.h
1 #ifndef IMAGE_H
2 #define IMAGE_H
3 
4 #include "sdl_check.h"
5 #include <SDL2/SDL.h>
6 #include <SDL2/SDL_image.h>
7 using namespace std;
8 #include <iostream>
9 
11 class Image {
12 private:
13  SDL_Texture* tex;
14  string filename;
15 public:
16  Image();
17  ~Image();
19  void loadImage(string file, SDL_Renderer* ren);
21  void loadPNG(string file, SDL_Renderer* ren);
23  void loadBMP(string file, SDL_Renderer* ren);
25  SDL_Texture* getTexture();
27  void setImage(SDL_Texture* t) {tex=t;}
29  string getFile() const {return filename;}
31  void setFile(string f) {filename=f;}
33  void setTexture(SDL_Texture* t) {tex=t;}
34  void setSurface(SDL_Surface* s, SDL_Renderer* ren) {tex=SDL_CreateTextureFromSurface(ren, s); SDL_FreeSurface(s);}
35 };
36 
37 #endif //IMAGE_H
void setTexture(SDL_Texture *t)
Set texture.
Definition: image.h:33
void setFile(string f)
Set path file to the image.
Definition: image.h:31
string getFile() const
Get path file of the image.
Definition: image.h:29
Class for loading in SDL Textures.
Definition: image.h:11
void setImage(SDL_Texture *t)
Set new, preloaded texture, to Image.
Definition: image.h:27