1
0
mirror of https://github.com/Halofreak1990/XFXFramework synced 2024-12-26 13:49:34 +01:00
XFXFramework/include/Graphics/SpriteBatch.h
Halofreak1990 e7a47c8ed9 Revamped the List class so that it can (properly) handle pointers as well
Added 'ValueTypes' Single and Double
Added some components in the new System::Net namespace
Added the Console class, which can be used to output text to the screen
Updated a bunch of structs to include the IComparable and IEquatable interfaces, and inheritance from Object to allow better interoperability between container classes and other types
Replaced all exception handling code with a report to stdout.txt - this will, I hope, eventually be reversed, but as of yet, there is no support for exceptions.

BEWARE! Even though all libraries correctly compile, you cannot use any class/structure that inherits from a template class, because stupid G++ wants to include exception handling for each template.
2011-11-07 01:29:50 +00:00

86 lines
3.2 KiB
C++

/********************************************************
* SpriteBatch.h *
* *
* XFX SpriteBatch definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_GRAPHICS_SPRITEBATCH_
#define _XFX_GRAPHICS_SPRITEBATCH_
#include "Enums.h"
#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>
using namespace System;
using namespace System::Collections::Generic;
namespace XFX
{
struct Rectangle;
namespace Graphics
{
struct Color;
class GraphicsDevice;
class SpriteFont;
// Enables a group of sprites to be drawn using the same settings.
class SpriteBatch : public IDisposable, virtual Object
{
private:
Texture2D currentTexture;
GraphicsDevice* device;
bool isDisposed;
bool inBeginEndPair;
SaveStateMode_t saveStateMode;
StateBlock saveState;
SpriteSortMode_t spriteSortMode;
static SpriteBlendMode_t spriteBlendMode;
int spriteQueueCount;
List<Sprite> SpriteList;
void applyGraphicsDeviceSettings();
void Flush();
void restoreRenderState();
protected:
virtual void Dispose(bool disposing);
public:
GraphicsDevice* getGraphicsDevice();
bool IsDisposed();
EventHandler Disposing;
virtual ~SpriteBatch();
SpriteBatch(GraphicsDevice* graphicsDevice);
SpriteBatch();
void Begin();
void Begin(SpriteBlendMode_t blendMode);
void Begin(SpriteBlendMode_t blendMode, SpriteSortMode_t sortMode, SaveStateMode_t stateMode);
void Begin(SpriteBlendMode_t blendMode, SpriteSortMode_t sortMode, SaveStateMode_t stateMode, Matrix transformMatrix);
void Dispose();
void Draw(Texture2D texture, Rectangle destinationRectangle, Color color);
void Draw(Texture2D texture, Rectangle destinationRectangle, Rectangle sourceRectangle, Color color);
void Draw(Texture2D texture, Vector2 position, Color color);
void Draw(Texture2D texture, Vector2 position, Rectangle sourceRectangle, Color color);
void Draw(Texture2D texture, Vector2 position, Rectangle sourceRectangle, Color color, float rotation, Vector2 origin, float scale, SpriteEffects_t effects, float layerDepth);
void Draw(Texture2D texture, Vector2 position, Rectangle sourceRectangle, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects_t effects, float layerDepth);
void Draw(Texture2D texture, Rectangle destinationRectangle, Rectangle sourceRectangle, Color color, float rotation, Vector2 origin, SpriteEffects_t effects, float layerDepth);
void DrawString(SpriteFont spriteFont, char* text, Vector2 position, Color color);
void DrawString(SpriteFont spriteFont, char* text, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects_t effects, float layerDepth);
void DrawString(SpriteFont spriteFont, char* text, Vector2 position, Color color, float rotation, Vector2 origin, float scale, SpriteEffects_t effects, float layerDepth);
void End();
};
}
}
#endif //_XFX_GRAPHICS_SPRITEBATCH_