00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef OSDL_SPRITE_H_
00028 #define OSDL_SPRITE_H_
00029
00030
00031
00032 #include "OSDLVideoRenderer.h"
00033 #include "OSDLVideoTypes.h"
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #include "Ceylan.h"
00048
00049
00050 #include <string>
00051
00052
00053
00054
00055 namespace OSDL
00056 {
00057
00058
00059
00060 namespace Engine
00061 {
00062
00063 class BoundingBox2D ;
00064
00065 }
00066
00067
00068
00069
00070 namespace Video
00071 {
00072
00073
00074 namespace OpenGL
00075 {
00076
00077
00078 class GLTexture ;
00079
00080 }
00081
00082
00083 }
00084
00085
00086
00087
00088 namespace Rendering
00089 {
00090
00091
00093 class OSDL_DLL SpriteException: public VideoRenderingException
00094 {
00095
00096 public:
00097 explicit SpriteException( const std::string & message ) ;
00098
00099 virtual ~SpriteException() throw() ;
00100
00101 } ;
00102
00103
00104
00105
00111 class OSDL_DLL Sprite: public Ceylan::View
00112 {
00113
00114
00115 public:
00116
00117
00118
00120 typedef Ceylan::Uint8 Shape ;
00121
00122
00123
00131 explicit Sprite( const std::string & frameFilename ) ;
00132
00133
00134
00139 virtual ~Sprite() throw() ;
00140
00141
00142
00154 virtual const std::string toString(
00155 Ceylan::VerbosityLevels level = Ceylan::high ) const ;
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00188 static const Shape EightTimesEight ;
00189
00190
00192 static const Shape SixteenTimesEight ;
00193
00194
00196 static const Shape ThirtyTwoTimesEight ;
00197
00198
00199
00200
00201
00202
00203
00205 static const Shape EightTimesSixteen ;
00206
00207
00209 static const Shape SixteenTimesSixteen ;
00210
00211
00213 static const Shape ThirtyTwoTimesSixteen ;
00214
00215
00216
00217
00218
00219
00220
00222 static const Shape EightTimesThirtyTwo ;
00223
00224
00226 static const Shape SixteenTimesThirtyTwo ;
00227
00228
00230 static const Shape ThirtyTwoTimesThirtyTwo ;
00231
00232
00234 static const Shape SixtyFourTimesThirtyTwo ;
00235
00236
00237
00238
00239
00240
00241
00243 static const Shape ThirtyTwoTimesSixtyFour ;
00244
00245
00247 static const Shape SixtyFourTimesSixtyFour ;
00248
00249
00255 static const Shape PowersOfTwo ;
00256
00257
00258
00265 static std::string DescribeShape( Shape shape ) ;
00266
00267
00268
00281 static Shape GetSmallestEnclosingShape(
00282 OSDL::Video::Length width,
00283 OSDL::Video::Length height ) ;
00284
00285
00286
00299 static OSDL::Video::Length GetShapeWidthFor( Shape shape ) ;
00300
00301
00302
00315 static OSDL::Video::Length GetShapeHeightFor( Shape shape ) ;
00316
00317
00318
00319
00320 protected:
00321
00322
00323
00338 bool _ownBoundingBox ;
00339
00340
00341
00350 Engine::BoundingBox2D * _box ;
00351
00352
00353
00358 Shape _shape ;
00359
00360
00361 #if defined(OSDL_ARCH_NINTENDO_DS) && OSDL_ARCH_NINTENDO_DS
00362
00363
00364
00365 #else // OSDL_ARCH_NINTENDO_DS
00366
00368 Video::OpenGL::GLTexture * _texture ;
00369
00370 #endif // OSDL_ARCH_NINTENDO_DS
00371
00372
00373
00374 private:
00375
00376
00377
00386 Sprite( const Sprite & source ) ;
00387
00388
00389
00398 Sprite & operator = ( const Sprite & source ) ;
00399
00400
00401 } ;
00402
00403
00404 }
00405
00406 }
00407
00408
00409
00410 #endif // OSDL_SPRITE_H_
00411