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
|
|
|
|
|
2012-09-28 20:36:02 +00:00
|
|
|
|
#include "BlendState.h"
|
|
|
|
|
#include "DepthStencilState.h"
|
|
|
|
|
#include "Effect.h"
|
2010-12-04 16:14:34 +00:00
|
|
|
|
#include "Enums.h"
|
2011-01-16 00:47:37 +00:00
|
|
|
|
#include <Matrix.h>
|
2012-09-28 20:36:02 +00:00
|
|
|
|
#include "RasterizerState.h"
|
|
|
|
|
#include "SamplerState.h"
|
2011-01-16 00:47:37 +00:00
|
|
|
|
#include "Sprite.h"
|
|
|
|
|
#include "StateBlock.h"
|
|
|
|
|
#include <System/Collections/Generic/List.h>
|
2012-09-28 20:36:02 +00:00
|
|
|
|
#include <System/String.h>
|
2011-01-16 00:47:37 +00:00
|
|
|
|
#include <System/Types.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;
|
2012-09-28 20:36:02 +00:00
|
|
|
|
struct Vector2;
|
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.
|
2012-09-28 20:36:02 +00:00
|
|
|
|
class SpriteBatch : public IDisposable, public 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;
|
2012-09-28 20:36:02 +00:00
|
|
|
|
//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-09-28 20:36:02 +00:00
|
|
|
|
//SpriteBlendMode_t spriteBlendMode;
|
2011-01-16 00:47:37 +00:00
|
|
|
|
int spriteQueueCount;
|
2012-09-28 20:36:02 +00:00
|
|
|
|
BlendState oldBlendState;
|
|
|
|
|
BlendState blendState;
|
2011-01-16 00:47:37 +00:00
|
|
|
|
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;
|
|
|
|
|
|
2012-09-28 20:36:02 +00:00
|
|
|
|
SpriteBatch(GraphicsDevice * const graphicsDevice);
|
2011-01-16 00:47:37 +00:00
|
|
|
|
virtual ~SpriteBatch();
|
2010-12-27 01:01:25 +00:00
|
|
|
|
|
|
|
|
|
void Begin();
|
2012-09-28 20:36:02 +00:00
|
|
|
|
void Begin(SpriteSortMode_t sortMode, const BlendState& blendState);
|
|
|
|
|
void Begin(SpriteSortMode_t sortMode, const BlendState& blendState, const SamplerState& samplerState, const DepthStencilState& depthStencilState, const RasterizerState& rasterizerState);
|
|
|
|
|
void Begin(SpriteSortMode_t sortMode, const BlendState& blendState, const SamplerState& samplerState, const DepthStencilState& depthStencilState, const RasterizerState& rasterizerState, Effect* effect);
|
|
|
|
|
void Begin(SpriteSortMode_t sortMode, const BlendState& blendState, const SamplerState& samplerState, const DepthStencilState& depthStencilState, const RasterizerState& rasterizerState, Effect* effect, Matrix transformMatrix);
|
2010-12-27 01:01:25 +00:00
|
|
|
|
void Dispose();
|
2012-09-28 20:36:02 +00:00
|
|
|
|
void Draw(Texture2D * const texture, const Rectangle destinationRectangle, Color color);
|
|
|
|
|
void Draw(Texture2D * const texture, const Rectangle destinationRectangle, const Rectangle sourceRectangle, Color color);
|
|
|
|
|
void Draw(Texture2D * const texture, const Vector2 position, const Color color);
|
|
|
|
|
void Draw(Texture2D * const texture, const Vector2 position, const Rectangle sourceRectangle, const Color color);
|
|
|
|
|
void Draw(Texture2D * const 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 * const 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 * const 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 * const spriteFont, String& text, const Vector2 position, const Color color);
|
|
|
|
|
void DrawString(SpriteFont * const spriteFont, String& 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 * const spriteFont, String& 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();
|
2012-09-28 20:36:02 +00:00
|
|
|
|
int GetType() const;
|
2010-12-04 16:14:34 +00:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-16 00:47:37 +00:00
|
|
|
|
#endif //_XFX_GRAPHICS_SPRITEBATCH_
|