-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAssets.hpp
46 lines (34 loc) · 1.08 KB
/
Assets.hpp
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
/**
* @file Assets.hpp
* @brief Loads and stores game assets such as textures, sounds, and music.
* @author Josh Kennedy
*
* Kablam!
* Copyright (C) 2023 Josh Kennedy.
*/
#pragma once
struct SDL_Renderer;
struct SDL_Texture;
struct _TTF_Font;
typedef _TTF_Font TTF_Font;
#include <string>
#include <map>
#include "Animation.hpp"
class Assets final
{
friend class Game;
private:
static TTF_Font* defaultFont;
static TTF_Font* menuFont;
static std::map<std::string, SDL_Texture*> textures;
static bool loadAssets(SDL_Renderer* renderer);
static void unloadAssets();
static bool loadTexture(SDL_Renderer* renderer, const std::string& name, const std::string& path);
static std::map<std::string, Animation*> animations;
public:
inline static TTF_Font* getDefaultFont() noexcept { return defaultFont; }
inline static TTF_Font* getMenuFont() noexcept { return menuFont; }
static TTF_Font* getMenuFontCopy(); // this is for renderTextWithOutline functions to use lol
static SDL_Texture* getTexture(const std::string& name);
static Animation getAnimation(const std::string& name);
};