-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtexture.hpp
More file actions
45 lines (33 loc) · 1 KB
/
texture.hpp
File metadata and controls
45 lines (33 loc) · 1 KB
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
// Simion
// Cristian
// Grupa 135
#include <SDL.h>
#include <SDL_image.h>
#include <SDL_ttf.h>
#include <string>
#pragma once
class Texture {
// The plain texture
SDL_Texture *mTexture;
// Texture dimension
int mWidth;
int mHeight;
public:
Texture();
~Texture();
// Loads texture from file
bool loadFromFile(std::string path, SDL_Renderer *rend);
// Loads texture from a string and a TrueType font
bool loadFromRenderedText(std::string textureText, SDL_Color textColor, TTF_Font *gFont, SDL_Renderer *rend);
// Frees the texture from the memory
void free();
// Sets the blend mode of the texture
void setBlendMode(SDL_BlendMode blending);
// Sets the transparency of the texture
void setAlpha(unsigned char alpha);
// Renders the texture at given coordinates
void render(int x, int y, SDL_Renderer *rend);
// Returns the texture dimensions
int getWidth() { return mWidth; };
int getHeight() { return mHeight; };
};