-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraphics.h
More file actions
40 lines (31 loc) · 1.02 KB
/
Copy pathgraphics.h
File metadata and controls
40 lines (31 loc) · 1.02 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
#ifndef GRAPHICS_H
#define GRAPHICS_H
#include <SDL2/SDL.h>
#include "animated_sprite.h"
#include "location.h"
#include "sprite.h"
class Graphics {
public:
Graphics();
~Graphics();
// Attempts to create the game window.
void CreateWindow();
// Draw the next frame and clear the renderer.
void DrawNextFrame();
// Add this sprite to the renderer for the next frame, scaled to fit the
// provided destination rectangle.
void AddSprite(const Sprite& sprite, const SDL_Rect& destination);
// Add a sprite to the renderer at the specified location, scaled by the
// sprite scale value.
void AddSprite(const Sprite& sprite, Location location);
// This returns a pointer to the renderer struct.
// Exposing this is unfortunate but the Sprite needs access to it to create
// textures.
// This method should be used with caution.
// The graphics class still owns the renderer.
SDL_Renderer* GetRenderer() { return renderer_; }
private:
SDL_Window* window_;
SDL_Renderer* renderer_;
};
#endif // GRAPHICS_H