Space Fighter
A "shmup" game for Computer Programming C++
Loading...
Searching...
No Matches
Texture.cpp
Go to the documentation of this file.
1
2
/*
3
██╗ ██╗ █████╗ ████████╗ █████╗ ███╗ ██╗ █████╗
4
██║ ██╔╝ ██╔══██╗ ╚══██╔══╝ ██╔══██╗ ████╗ ██║ ██╔══██╗
5
█████╔╝ ███████║ ██║ ███████║ ██╔██╗ ██║ ███████║
6
██╔═██╗ ██╔══██║ ██║ ██╔══██║ ██║╚██╗██║ ██╔══██║
7
██║ ██╗ ██║ ██║ ██║ ██║ ██║ ██║ ╚████║ ██║ ██║
8
╚═╝ ╚═╝ ╚═╝ ╚═╝/\ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝
9
/vvvvvvvvvvvvvvvvvvv \=========================================,
10
`^^^^^^^^^^^^^^^^^^^ /---------------------------------------"
11
Katana Engine \/ © 2012 - Shuriken Studios LLC
12
http://www.shurikenstudios.com
13
*/
14
15
#include "
KatanaEngine.h
"
16
17
namespace
KatanaEngine
18
{
19
bool
Texture::s_alAddonInitialized =
false
;
20
21
Texture::Texture
()
22
{
23
if
(!s_alAddonInitialized)
24
{
25
al_init_image_addon();
26
s_alAddonInitialized =
true
;
27
}
28
29
m_pBitmap =
nullptr
;
30
}
31
32
Texture::~Texture
()
33
{
34
al_destroy_bitmap(m_pBitmap);
35
m_pBitmap =
nullptr
;
36
}
37
38
39
bool
Texture::Load
(
const
std::string &path,
ResourceManager
*pManager)
40
{
41
ALLEGRO_BITMAP *pTemp = al_load_bitmap(path.c_str());
42
43
SetTexture
(pTemp);
44
45
return
m_pBitmap;
46
}
47
48
49
void
Texture::SetTexture
(ALLEGRO_BITMAP *pBitmap)
50
{
51
if
(pBitmap)
52
{
53
m_pBitmap = pBitmap;
54
m_width = al_get_bitmap_width(m_pBitmap);
55
m_height = al_get_bitmap_height(m_pBitmap);
56
m_size =
Vector2
(m_width, m_height);
57
m_center = m_size / 2;
58
}
59
}
60
}
KatanaEngine.h
KatanaEngine::ResourceManager
Loads and manages the lifespan of objects from external files.
Definition
ResourceManager.h:21
KatanaEngine::Texture::~Texture
virtual ~Texture()
Definition
Texture.cpp:32
KatanaEngine::Texture::Load
virtual bool Load(const std::string &path, ResourceManager *pManager)
Load the desired font into memory.
Definition
Texture.cpp:39
KatanaEngine::Texture::SetTexture
virtual void SetTexture(ALLEGRO_BITMAP *pBitmap)
Used to set the underlaying allegro bitmap.
Definition
Texture.cpp:49
KatanaEngine::Texture::Texture
Texture()
Definition
Texture.cpp:21
KatanaEngine::Vector2
Defines a vector with 2 components (x and y).
Definition
Vector2.h:21
KatanaEngine
Katana Engine is a library of classes, interfaces, and value types that provides a foundation for dev...
Definition
Animation.cpp:18
doxy_src
KatanaEngine
Texture.cpp
Generated by
1.11.0