ScummVM API documentation
sprite.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef GRAPHICS_SPRITE_3DS_H
23 #define GRAPHICS_SPRITE_3DS_H
24 
25 #define FORBIDDEN_SYMBOL_EXCEPTION_time_h
26 
27 #include "graphics/surface.h"
28 #include <3ds.h>
29 #include <citro3d.h>
30 
31 namespace N3DS {
32 
33 typedef struct {
34  float position[3];
35  float texcoord[2];
36 } vertex;
37 
38 struct GfxMode3DS;
39 
40 class Sprite : public Graphics::Surface {
41 public:
42  Sprite();
43  ~Sprite();
44  void create(uint16 width, uint16 height, const GfxMode3DS *mode);
45  void free();
46  void convertToInPlace(const Graphics::PixelFormat &dstFormat, const byte *palette = 0);
47  void transfer();
48  void render();
49  void clear(uint32 color = 0);
50  void markDirty(){ dirtyPixels = true; }
51 
52  void setPosition(int x, int y);
53  void setOffset(uint16 x, uint16 y);
54  void setScale(float x, float y);
55  float getScaleX() const { return scaleX; }
56  float getScaleY() const { return scaleY; }
57  int getPosX() const { return posX; }
58  int getPosY() const { return posY; }
59  C3D_Mtx* getMatrix();
60 
61  void setFilteringMode(bool enableLinearFiltering);
62 
63  uint16 actualWidth;
64  uint16 actualHeight;
65 
66 private:
67  uint32 textureTransferFlags;
68  bool dirtyPixels;
69  bool dirtyMatrix;
70  C3D_Mtx modelview;
71  C3D_Tex texture;
72  vertex* vertices;
73  int posX;
74  int posY;
75  uint16 offsetX;
76  uint16 offsetY;
77  float scaleX;
78  float scaleY;
79 };
80 
81 } // namespace N3DS
82 
83 #endif
Definition: osystem.h:41
Definition: osystem.h:83
Definition: surface.h:67
Definition: sprite.h:33
Definition: pixelformat.h:138
Definition: sprite.h:40