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 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (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, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef GRAPHICS_SPRITE_3DS_H 24 #define GRAPHICS_SPRITE_3DS_H 25 26 #define FORBIDDEN_SYMBOL_EXCEPTION_time_h 27 28 #include "graphics/surface.h" 29 #include <3ds.h> 30 #include <citro3d.h> 31 32 #define TEXTURE_TRANSFER_FLAGS \ 33 (GX_TRANSFER_FLIP_VERT(1) | GX_TRANSFER_OUT_TILED(1) | GX_TRANSFER_RAW_COPY(0) | \ 34 GX_TRANSFER_IN_FORMAT(GX_TRANSFER_FMT_RGBA8) | GX_TRANSFER_OUT_FORMAT(GX_TRANSFER_FMT_RGBA8) | \ 35 GX_TRANSFER_SCALING(GX_TRANSFER_SCALE_NO)) 36 37 typedef struct { 38 float position[3]; 39 float texcoord[2]; 40 } vertex; 41 42 class Sprite : public Graphics::Surface { 43 public: 44 Sprite(); 45 ~Sprite(); 46 void create(uint16 width, uint16 height, const Graphics::PixelFormat &format); 47 void free(); 48 void convertToInPlace(const Graphics::PixelFormat &dstFormat, const byte *palette = 0); 49 void transfer(); 50 void render(); 51 void clear(uint32 color = 0); markDirty()52 void markDirty(){ dirtyPixels = true; } 53 54 void setPosition(int x, int y); 55 void setOffset(uint16 x, uint16 y); 56 void setScale(float x, float y); getScaleX()57 float getScaleX() const { return scaleX; } getScaleY()58 float getScaleY() const { return scaleY; } getPosX()59 int getPosX() const { return posX; } getPosY()60 int getPosY() const { return posY; } 61 C3D_Mtx* getMatrix(); 62 63 uint16 actualWidth; 64 uint16 actualHeight; 65 66 private: 67 bool dirtyPixels; 68 bool dirtyMatrix; 69 C3D_Mtx modelview; 70 C3D_Tex texture; 71 vertex* vertices; 72 int posX; 73 int posY; 74 uint16 offsetX; 75 uint16 offsetY; 76 float scaleX; 77 float scaleY; 78 }; 79 80 #endif 81