Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libmeteor/include/ameteor/graphics/object.hpp
2 views
1
// Meteor - A Nintendo Gameboy Advance emulator
2
// Copyright (C) 2009-2011 Philippe Daouadi
3
//
4
// This program is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17
#ifndef __GRAPHICS_OBJECT_H__
18
#define __GRAPHICS_OBJECT_H__
19
20
#include <stdint.h>
21
#include <vector>
22
#include <list>
23
24
namespace AMeteor
25
{
26
namespace Graphics
27
{
28
class Object
29
{
30
public :
31
static const uint8_t FLIP_HORIZONTAL = 1;
32
static const uint8_t FLIP_VERTICAL = 2;
33
34
Object (uint16_t* pPalette, uint8_t* pChar);
35
// Warning : this copy constructor must not be used on an used object
36
// use it only on just created objects
37
Object (const Object& obj);
38
39
inline uint8_t GetPriority () const;
40
inline int8_t GetRotationParam () const;
41
inline uint16_t GetTileNum () const;
42
inline bool IsWindow () const;
43
44
void DrawLine (uint8_t line, uint32_t* surface, bool oneDim,
45
uint8_t mosaic);
46
void DrawLineRot (uint8_t line, uint32_t* surface, bool oneDim,
47
int16_t a, int16_t b, int16_t c, int16_t d, uint8_t mosaic);
48
void DrawWindow (uint8_t line, uint8_t* surface, bool oneDim,
49
uint8_t mask);
50
void DrawWindowRot (uint8_t line, uint8_t* surface,
51
bool oneDim, int16_t a, int16_t b, int16_t c, int16_t d,
52
uint8_t mask);
53
54
void UpdateAttrs (uint16_t attr0, uint16_t attr1, uint16_t attr2);
55
void UpdateAttr0 (uint16_t attr);
56
void UpdateAttr1 (uint16_t attr);
57
void UpdateAttr2 (uint16_t attr);
58
59
private :
60
inline void SetSize ();
61
62
enum Shape
63
{
64
SHAPE_SQUARE = 0,
65
SHAPE_HORIZONTAL,
66
SHAPE_VERTICAL,
67
SHAPE_PROHIBITED
68
};
69
70
uint16_t m_attr0, m_attr1, m_attr2;
71
uint8_t m_width, m_height;
72
uint16_t* m_pPalette;
73
uint8_t* m_pChar;
74
uint32_t m_charBegin;
75
uint32_t m_charEnd;
76
};
77
78
inline int8_t Object::GetRotationParam () const
79
{
80
return (m_attr0 & (0x1 << 8)) ? (m_attr1 >> 9) & 0x1F : -1;
81
}
82
83
inline uint8_t Object::GetPriority () const
84
{
85
return (m_attr2 >> 10) & 0x3;
86
}
87
88
inline bool Object::IsWindow () const
89
{
90
return (m_attr0 & (0x3 << 10)) == (0x2 << 10);
91
}
92
93
inline uint16_t Object::GetTileNum () const
94
{
95
return (m_attr2 & 0x3FF);
96
}
97
}
98
}
99
100
#endif
101
102