2010-12-04 16:14:34 +00:00
|
|
|
|
/********************************************************
|
|
|
|
|
* SpriteBatch.h *
|
|
|
|
|
* *
|
|
|
|
|
* XFX SpriteBatch definition file *
|
|
|
|
|
* Copyright <EFBFBD> XFX Team. All Rights Reserved *
|
|
|
|
|
********************************************************/
|
2011-01-16 00:47:37 +00:00
|
|
|
|
#ifndef _XFX_GRAPHICS_SPRITEBATCH_
|
|
|
|
|
#define _XFX_GRAPHICS_SPRITEBATCH_
|
2010-12-04 16:14:34 +00:00
|
|
|
|
|
|
|
|
|
#include "Enums.h"
|
2011-01-16 00:47:37 +00:00
|
|
|
|
#include <Matrix.h>
|
|
|
|
|
#include "Sprite.h"
|
|
|
|
|
#include "StateBlock.h"
|
|
|
|
|
#include <System/Collections/Generic/List.h>
|
|
|
|
|
#include <System/Types.h>
|
|
|
|
|
#include <Vector2.h>
|
|
|
|
|
#include <Vector4.h>
|
2010-12-04 16:14:34 +00:00
|
|
|
|
|
|
|
|
|
using namespace System;
|
2011-01-16 00:47:37 +00:00
|
|
|
|
using namespace System::Collections::Generic;
|
2010-12-04 16:14:34 +00:00
|
|
|
|
|
|
|
|
|
namespace XFX
|
|
|
|
|
{
|
2010-12-27 01:01:25 +00:00
|
|
|
|
struct Rectangle;
|
2010-12-04 16:14:34 +00:00
|
|
|
|
|
|
|
|
|
namespace Graphics
|
|
|
|
|
{
|
2010-12-27 01:01:25 +00:00
|
|
|
|
struct Color;
|
2011-11-07 01:29:50 +00:00
|
|
|
|
class GraphicsDevice;
|
2010-12-04 16:14:34 +00:00
|
|
|
|
class SpriteFont;
|
|
|
|
|
|
2011-11-07 01:29:50 +00:00
|
|
|
|
// Enables a group of sprites to be drawn using the same settings.
|
2011-01-16 00:47:37 +00:00
|
|
|
|
class SpriteBatch : public IDisposable, virtual Object
|
2010-12-04 16:14:34 +00:00
|
|
|
|
{
|
2010-12-27 01:01:25 +00:00
|
|
|
|
private:
|
2011-05-02 17:33:24 +00:00
|
|
|
|
GraphicsDevice* device;
|
2011-01-16 00:47:37 +00:00
|
|
|
|
bool isDisposed;
|
|
|
|
|
bool inBeginEndPair;
|
|
|
|
|
SaveStateMode_t saveStateMode;
|
2012-03-29 22:02:43 +00:00
|
|
|
|
StateBlock* saveState;
|
2011-01-16 00:47:37 +00:00
|
|
|
|
SpriteSortMode_t spriteSortMode;
|
2012-03-29 22:02:43 +00:00
|
|
|
|
SpriteBlendMode_t spriteBlendMode;
|
2011-01-16 00:47:37 +00:00
|
|
|
|
int spriteQueueCount;
|
|
|
|
|
List<Sprite> SpriteList;
|
|
|
|
|
|
2010-12-27 01:01:25 +00:00
|
|
|
|
void applyGraphicsDeviceSettings();
|
2011-01-16 00:47:37 +00:00
|
|
|
|
void Flush();
|
2010-12-27 01:01:25 +00:00
|
|
|
|
void restoreRenderState();
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual void Dispose(bool disposing);
|
|
|
|
|
|
|
|
|
|
public:
|
2012-03-29 22:02:43 +00:00
|
|
|
|
GraphicsDevice* getGraphicsDevice() const;
|
|
|
|
|
bool IsDisposed() const;
|
2010-12-27 01:01:25 +00:00
|
|
|
|
|
|
|
|
|
EventHandler Disposing;
|
|
|
|
|
|
2011-01-16 00:47:37 +00:00
|
|
|
|
virtual ~SpriteBatch();
|
2011-05-02 17:33:24 +00:00
|
|
|
|
SpriteBatch(GraphicsDevice* graphicsDevice);
|
2010-12-27 01:01:25 +00:00
|
|
|
|
|
|
|
|
|
void Begin();
|
2012-03-29 22:02:43 +00:00
|
|
|
|
void Begin(const SpriteBlendMode_t blendMode);
|
|
|
|
|
void Begin(const SpriteBlendMode_t blendMode, const SpriteSortMode_t sortMode, const SaveStateMode_t stateMode);
|
|
|
|
|
void Begin(const SpriteBlendMode_t blendMode, const SpriteSortMode_t sortMode, const SaveStateMode_t stateMode, const Matrix transformMatrix);
|
2010-12-27 01:01:25 +00:00
|
|
|
|
void Dispose();
|
2012-03-29 22:02:43 +00:00
|
|
|
|
void Draw(Texture2D* texture, const Rectangle destinationRectangle, Color color);
|
|
|
|
|
void Draw(Texture2D* texture, const Rectangle destinationRectangle, Rectangle sourceRectangle, Color color);
|
|
|
|
|
void Draw(Texture2D* texture, const Vector2 position, const Color color);
|
|
|
|
|
void Draw(Texture2D* texture, const Vector2 position, const Rectangle sourceRectangle, const Color color);
|
|
|
|
|
void Draw(Texture2D* texture, const Vector2 position, const Rectangle sourceRectangle, const Color color, const float rotation, const Vector2 origin, const float scale, const SpriteEffects_t effects, const float layerDepth);
|
|
|
|
|
void Draw(Texture2D* texture, const Vector2 position, const Rectangle sourceRectangle, const Color color, const float rotation, const Vector2 origin, const Vector2 scale, const SpriteEffects_t effects, const float layerDepth);
|
|
|
|
|
void Draw(Texture2D* texture, const Rectangle destinationRectangle, const Rectangle sourceRectangle, const Color color, const float rotation, const Vector2 origin, const SpriteEffects_t effects, const float layerDepth);
|
|
|
|
|
void DrawString(SpriteFont* spriteFont, const char* text, const Vector2 position, const Color color);
|
|
|
|
|
void DrawString(SpriteFont* spriteFont, const char* text, const Vector2 position, const Color color, const float rotation, const Vector2 origin, const Vector2 scale, const SpriteEffects_t effects, const float layerDepth);
|
|
|
|
|
void DrawString(SpriteFont* spriteFont, const char* text, const Vector2 position, const Color color, const float rotation, const Vector2 origin, const float scale, const SpriteEffects_t effects, const float layerDepth);
|
2010-12-27 01:01:25 +00:00
|
|
|
|
void End();
|
2010-12-04 16:14:34 +00:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-16 00:47:37 +00:00
|
|
|
|
#endif //_XFX_GRAPHICS_SPRITEBATCH_
|