-
Notifications
You must be signed in to change notification settings - Fork 0
/
WTexture.h
53 lines (41 loc) · 1.23 KB
/
WTexture.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
48
49
50
51
52
53
//Using SDL, SDL_image, standard IO, and strings
#include "SDL2/SDL.h"
#include "SDL2/SDL_image.h"
#include "SDL2/SDL_ttf.h"
#include "stdio.h"
#include "string"
#pragma once
// SDL_Texture wrapper class
class WTexture{
public:
//Initializes variables
WTexture();
//Deallocates memory
~WTexture();
//Loads image at specified path
bool loadFromFile( SDL_Renderer* renderer, std::string path );
/*#if defined(SDL_TTF_MAJOR_VERSION)
//Creates image from font string
bool loadFromRenderedText( SDL_Renderer* renderer, std::string textureText, SDL_Color textColor );
#endif*/
//Deallocates texture
void free();
//Set color modulation
void setColor( Uint8 red, Uint8 green, Uint8 blue );
//Set blending
void setBlendMode( SDL_BlendMode blending );
//Set alpha modulation
void setAlpha( Uint8 alpha );
//Renders texture at given point
void render( SDL_Renderer* renderer, int x, int y, int l, int b);
static void renderText( SDL_Renderer* renderer, TTF_Font* font, const char *text, int x, int y, int l, int b );
//Gets image dimensions
int getWidth();
int getHeight();
private:
//The actual hardware texture
SDL_Texture* mTexture;
//Image dimensions
int mWidth;
int mHeight;
};