Space Fighter
A "shmup" game for Computer Programming C++
Loading...
Searching...
No Matches
Texture.h
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#pragma once
16
17namespace KatanaEngine
18{
20 class Texture : public Resource
21 {
22
23 public:
24
25 Texture();
26 virtual ~Texture();
27
32 virtual bool Load(const std::string &path, ResourceManager *pManager);
33
36 int GetWidth() const { return m_width; }
37
40 int GetHeight() const { return m_height; }
41
44 Vector2 GetSize() const { return m_size; }
45
48 Vector2 GetCenter() const { return m_center; }
49
53 virtual bool IsCloneable() const { return false; }
54
57 virtual ALLEGRO_BITMAP *GetAllegroBitmap() const { return m_pBitmap; }
58
59
60 protected:
61
64 virtual void SetTexture(ALLEGRO_BITMAP *pBitmap);
65
66
67 private:
68
69 static bool s_alAddonInitialized;
70
71 ALLEGRO_BITMAP *m_pBitmap = nullptr;
72
73 int m_width = 0;
74 int m_height = 0;
75
76 Vector2 m_size;
77 Vector2 m_center;
78
79 };
80}
Base class for all resource types to be managed by the ResourceManager class.
Definition Resource.h:23
Loads and manages the lifespan of objects from external files.
Represents a 2D grid of texels.
Definition Texture.h:21
virtual bool IsCloneable() const
Used to determine if the texture is cloneable.
Definition Texture.h:53
virtual bool Load(const std::string &path, ResourceManager *pManager)
Load the desired font into memory.
Definition Texture.cpp:39
Vector2 GetCenter() const
Gets the center position of the texture.
Definition Texture.h:48
virtual void SetTexture(ALLEGRO_BITMAP *pBitmap)
Used to set the underlaying allegro bitmap.
Definition Texture.cpp:49
int GetHeight() const
Gets the height of the texture in pixels.
Definition Texture.h:40
int GetWidth() const
Gets the width of the texture in pixels.
Definition Texture.h:36
Vector2 GetSize() const
Gets the dimensions of the texture.
Definition Texture.h:44
virtual ALLEGRO_BITMAP * GetAllegroBitmap() const
Get the allegro bitmap representation of the texture.
Definition Texture.h:57
Defines a vector with 2 components (x and y).
Definition Vector2.h:21
Katana Engine is a library of classes, interfaces, and value types that provides a foundation for dev...
Definition Animation.cpp:18