mirror of
https://github.com/Halofreak1990/XFXFramework
synced 2024-12-26 13:49:34 +01:00
Updated project setup
Tidied-up SpriteBatch header- and source file
This commit is contained in:
parent
04743ed9c5
commit
742b77c545
@ -11,6 +11,7 @@
|
|||||||
#include "DepthStencilState.h"
|
#include "DepthStencilState.h"
|
||||||
#include "Effect.h"
|
#include "Effect.h"
|
||||||
#include "Enums.h"
|
#include "Enums.h"
|
||||||
|
#include "GraphicsResource.h"
|
||||||
#include <Matrix.h>
|
#include <Matrix.h>
|
||||||
#include "RasterizerState.h"
|
#include "RasterizerState.h"
|
||||||
#include "SamplerState.h"
|
#include "SamplerState.h"
|
||||||
@ -38,11 +39,9 @@ namespace XFX
|
|||||||
/**
|
/**
|
||||||
* Enables a group of sprites to be drawn using the same settings.
|
* Enables a group of sprites to be drawn using the same settings.
|
||||||
*/
|
*/
|
||||||
class SpriteBatch : public IDisposable, public Object
|
class SpriteBatch : public GraphicsResource, public Object
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
GraphicsDevice* device;
|
|
||||||
bool isDisposed;
|
|
||||||
bool inBeginEndPair;
|
bool inBeginEndPair;
|
||||||
//SaveStateMode_t saveStateMode;
|
//SaveStateMode_t saveStateMode;
|
||||||
StateBlock* saveState;
|
StateBlock* saveState;
|
||||||
@ -58,23 +57,17 @@ namespace XFX
|
|||||||
void restoreRenderState();
|
void restoreRenderState();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void Dispose(bool disposing);
|
void Dispose(bool disposing);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GraphicsDevice* getGraphicsDevice() const;
|
|
||||||
bool IsDisposed() const;
|
|
||||||
|
|
||||||
EventHandler Disposing;
|
|
||||||
|
|
||||||
SpriteBatch(GraphicsDevice * const graphicsDevice);
|
SpriteBatch(GraphicsDevice * const graphicsDevice);
|
||||||
virtual ~SpriteBatch();
|
virtual ~SpriteBatch();
|
||||||
|
|
||||||
void Begin();
|
void Begin();
|
||||||
void Begin(SpriteSortMode_t sortMode, const BlendState& blendState);
|
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);
|
||||||
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 * const effect);
|
||||||
void Begin(SpriteSortMode_t sortMode, const BlendState& blendState, const SamplerState& samplerState, const DepthStencilState& depthStencilState, const RasterizerState& rasterizerState, Effect* effect, Matrix transformMatrix);
|
void Begin(SpriteSortMode_t sortMode, const BlendState& blendState, const SamplerState& samplerState, const DepthStencilState& depthStencilState, const RasterizerState& rasterizerState, Effect * const effect, const Matrix transformMatrix);
|
||||||
void Dispose();
|
|
||||||
void Draw(Texture2D * const texture, const Rectangle destinationRectangle, Color color);
|
void Draw(Texture2D * const texture, const Rectangle destinationRectangle, Color color);
|
||||||
void Draw(Texture2D * const texture, const Rectangle destinationRectangle, const Nullable<Rectangle> sourceRectangle, Color color);
|
void Draw(Texture2D * const texture, const Rectangle destinationRectangle, const Nullable<Rectangle> sourceRectangle, Color color);
|
||||||
void Draw(Texture2D * const texture, const Vector2 position, const Color color);
|
void Draw(Texture2D * const texture, const Vector2 position, const Color color);
|
||||||
|
@ -21,6 +21,11 @@ namespace System
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Nullable(T const * const newData)
|
||||||
|
: data(const_cast<T*>(newData))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Nullable(const Nullable<T> &obj)
|
Nullable(const Nullable<T> &obj)
|
||||||
: data(obj.data)
|
: data(obj.data)
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,8 @@ namespace System
|
|||||||
HANDLE system_thread_handle;
|
HANDLE system_thread_handle;
|
||||||
PKSTART_ROUTINE callback;
|
PKSTART_ROUTINE callback;
|
||||||
int stack_size;
|
int stack_size;
|
||||||
static ULONG Id;
|
static ULONG GlobalId;
|
||||||
|
ULONG Id;
|
||||||
PULONG suspendCount;
|
PULONG suspendCount;
|
||||||
|
|
||||||
ThreadState_t state;
|
ThreadState_t state;
|
||||||
@ -34,25 +35,25 @@ namespace System
|
|||||||
void Thread_init();
|
void Thread_init();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//Creates a new instance of the Thread class with the specified callback function, but doesn't start yet.
|
// Initializes a new instance of the Thread class with the specified callback function, but doesn't start yet.
|
||||||
Thread(PKSTART_ROUTINE callBack);
|
Thread(PKSTART_ROUTINE callBack);
|
||||||
//Creates a new instance of the Thread class with the specified callback function and stack size, but doesn't start yet.
|
// Initializes a new instance of the Thread class with the specified callback function and stack size, but doesn't start yet.
|
||||||
Thread(PKSTART_ROUTINE callBack, int stackSize);
|
Thread(PKSTART_ROUTINE callBack, int stackSize);
|
||||||
~Thread();
|
~Thread();
|
||||||
|
|
||||||
void Abort();
|
void Abort();
|
||||||
void Interrupt();
|
void Interrupt();
|
||||||
//Returns a value indicating whether the thread is running
|
// Returns a value indicating whether the thread is running
|
||||||
bool IsAlive();
|
bool IsAlive();
|
||||||
//Resumes a previously suspended thread.
|
// Resumes a previously suspended thread.
|
||||||
void Resume();
|
void Resume();
|
||||||
//Set the thread priority, valid values are 0 (Low), 16 (Low_RealTime), 31 (High), 32 (Maximum)
|
// Set the thread priority, valid values are 0 (Low), 16 (Low_RealTime), 31 (High), 32 (Maximum)
|
||||||
void SetPriority(int priority);
|
void SetPriority(int priority);
|
||||||
static void Sleep(int millisecondsTimeout);
|
static void Sleep(int millisecondsTimeout);
|
||||||
static void Sleep(TimeSpan timeout);
|
static void Sleep(TimeSpan timeout);
|
||||||
//Start executing the thread.
|
// Start executing the thread.
|
||||||
void Start();
|
void Start();
|
||||||
//Suspend the thread execution, call Thread::Resume() to resume the thread.
|
// Suspend the thread execution, call Thread::Resume() to resume the thread.
|
||||||
void Suspend();
|
void Suspend();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ namespace System
|
|||||||
void SetValue(DependencyProperty<T *> p, T * const value)
|
void SetValue(DependencyProperty<T *> p, T * const value)
|
||||||
{
|
{
|
||||||
if (!dependencyProperties.ContainsKey(p.Name))
|
if (!dependencyProperties.ContainsKey(p.Name))
|
||||||
dependencyProperties.Add(p.Name, value)
|
dependencyProperties.Add(p.Name, value);
|
||||||
else
|
else
|
||||||
dependencyProperties[p.Name] = value;
|
dependencyProperties[p.Name] = value;
|
||||||
}
|
}
|
||||||
|
1119
include/intrin.h
Normal file
1119
include/intrin.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -2,13 +2,13 @@
|
|||||||
# update this variable to wherever you installed the OpenXDK libraries
|
# update this variable to wherever you installed the OpenXDK libraries
|
||||||
#
|
#
|
||||||
#########################################################################
|
#########################################################################
|
||||||
PREFIX = /openxdk
|
PREFIX = /usr/local/openxdk
|
||||||
|
|
||||||
CC = xbox-gcc
|
CC = gcc
|
||||||
CCAS = xbox-gcc
|
CCAS = gcc
|
||||||
CPP = xbox-g++
|
CPP = g++
|
||||||
AR = xbox-ar rcu
|
AR = ar rcu
|
||||||
RANLIB = xbox-ranlib
|
RANLIB = ranlib
|
||||||
CXBE = $(PREFIX)/bin/cxbe
|
CXBE = $(PREFIX)/bin/cxbe
|
||||||
|
|
||||||
SDLFLAGS = -DENABLE_XBOX -DDEBUG
|
SDLFLAGS = -DENABLE_XBOX -DDEBUG
|
||||||
|
@ -39,10 +39,10 @@
|
|||||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
|
||||||
<NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\cygwin\bin\make -f makefile all 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeBuildCommandLine>
|
<NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make -f makefile all 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeBuildCommandLine>
|
||||||
<NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\cygwin\bin\make -f makefile rebuild 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeReBuildCommandLine>
|
<NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make -f makefile rebuild 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeReBuildCommandLine>
|
||||||
<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\cygwin\bin\make -f makefile clean 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeCleanCommandLine>
|
<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make -f makefile clean 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeCleanCommandLine>
|
||||||
<NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
<NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">libSystem.xml.a</NMakeOutput>
|
||||||
<NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ENABLE_XBOX; DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
<NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ENABLE_XBOX; DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
||||||
<NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\cygwin\usr\local\openxdk\include;C:\cygwin\usr\local\openxdk\i386-pc-xbox\include;C:\cygwin\usr\local\openxdk\include\SDL;..\..\include;$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
|
<NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\cygwin\usr\local\openxdk\include;C:\cygwin\usr\local\openxdk\i386-pc-xbox\include;C:\cygwin\usr\local\openxdk\include\SDL;..\..\include;$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
|
||||||
<NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
|
<NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
|
||||||
|
@ -38,10 +38,10 @@
|
|||||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
|
||||||
<NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\cygwin\bin\make -f makefile all 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeBuildCommandLine>
|
<NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make -f makefile all 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeBuildCommandLine>
|
||||||
<NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\cygwin\bin\make -f makefile rebuild 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeReBuildCommandLine>
|
<NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make -f makefile rebuild 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeReBuildCommandLine>
|
||||||
<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\cygwin\bin\make -f makefile clean 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeCleanCommandLine>
|
<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make -f makefile clean 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeCleanCommandLine>
|
||||||
<NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
<NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">libSystem.a</NMakeOutput>
|
||||||
<NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ENABLE_XBOX; DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
<NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ENABLE_XBOX; DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
||||||
<NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\cygwin\usr\local\openxdk\include;C:\cygwin\usr\local\openxdk\i386-pc-xbox\include;C:\cygwin\usr\local\openxdk\include\SDL;..\..\include;$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
|
<NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\cygwin\usr\local\openxdk\include;C:\cygwin\usr\local\openxdk\i386-pc-xbox\include;C:\cygwin\usr\local\openxdk\include\SDL;..\..\include;$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
|
||||||
<NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
|
<NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
|
||||||
|
@ -215,10 +215,12 @@ namespace XFX
|
|||||||
{
|
{
|
||||||
// clear the depth buffer
|
// clear the depth buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((options & ClearOptions::Stencil) != 0)
|
if ((options & ClearOptions::Stencil) != 0)
|
||||||
{
|
{
|
||||||
// clear the stencil buffer
|
// clear the stencil buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((options & ClearOptions::Target) != 0)
|
if ((options & ClearOptions::Target) != 0)
|
||||||
{
|
{
|
||||||
// clear the current render target
|
// clear the current render target
|
||||||
|
@ -62,7 +62,9 @@ namespace XFX
|
|||||||
void GraphicsResource::Dispose(bool disposing)
|
void GraphicsResource::Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if(isDisposed)
|
if(isDisposed)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
isDisposed = true;
|
isDisposed = true;
|
||||||
|
|
||||||
|
@ -53,8 +53,8 @@ namespace XFX
|
|||||||
const Type SpriteBatchTypeInfo("SpriteBatch", "XFX::Graphics::SpriteBatch", TypeCode::Object);
|
const Type SpriteBatchTypeInfo("SpriteBatch", "XFX::Graphics::SpriteBatch", TypeCode::Object);
|
||||||
|
|
||||||
SpriteBatch::SpriteBatch(GraphicsDevice * const graphicsDevice)
|
SpriteBatch::SpriteBatch(GraphicsDevice * const graphicsDevice)
|
||||||
: device(graphicsDevice)
|
|
||||||
{
|
{
|
||||||
|
this->graphicsDevice = graphicsDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
SpriteBatch::~SpriteBatch()
|
SpriteBatch::~SpriteBatch()
|
||||||
@ -62,16 +62,6 @@ namespace XFX
|
|||||||
Dispose(false);
|
Dispose(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
GraphicsDevice* SpriteBatch::getGraphicsDevice() const
|
|
||||||
{
|
|
||||||
return device;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SpriteBatch::IsDisposed() const
|
|
||||||
{
|
|
||||||
return isDisposed;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpriteBatch::Begin()
|
void SpriteBatch::Begin()
|
||||||
{
|
{
|
||||||
Begin(SpriteSortMode::Deferred, BlendState::AlphaBlend);
|
Begin(SpriteSortMode::Deferred, BlendState::AlphaBlend);
|
||||||
@ -97,43 +87,41 @@ namespace XFX
|
|||||||
sassert(!inBeginEndPair, "Begin cannot be called again until End has been successfully called.");
|
sassert(!inBeginEndPair, "Begin cannot be called again until End has been successfully called.");
|
||||||
|
|
||||||
spriteSortMode = sortMode;
|
spriteSortMode = sortMode;
|
||||||
|
|
||||||
if (sortMode == SpriteSortMode::Immediate)
|
if (sortMode == SpriteSortMode::Immediate)
|
||||||
{
|
{
|
||||||
applyGraphicsDeviceSettings();
|
applyGraphicsDeviceSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
inBeginEndPair = true;
|
inBeginEndPair = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteBatch::Dispose(bool disposing)
|
void SpriteBatch::Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (disposing && !isDisposed)
|
if (disposing && !IsDisposed())
|
||||||
{
|
{
|
||||||
Disposing(this, EventArgs::Empty);
|
// TODO: dispose of resources
|
||||||
}
|
}
|
||||||
isDisposed = true;
|
|
||||||
|
GraphicsResource::Dispose(disposing);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteBatch::Dispose()
|
|
||||||
{
|
|
||||||
Dispose(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpriteBatch::Draw(Texture2D * const texture, const Rectangle destinationRectangle, const Color color)
|
void SpriteBatch::Draw(Texture2D * const texture, const Rectangle destinationRectangle, const Color color)
|
||||||
{
|
{
|
||||||
Draw(texture, destinationRectangle, Rectangle::Empty, color, 0.0f, Vector2::Zero, SpriteEffects::None, 0.0f);
|
Draw(texture, destinationRectangle, NULL, color, 0.0f, Vector2::Zero, SpriteEffects::None, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteBatch::Draw(Texture2D * const texture, const Vector2 position, const Color color)
|
void SpriteBatch::Draw(Texture2D * const texture, const Vector2 position, const Color color)
|
||||||
{
|
{
|
||||||
Rectangle destination = Rectangle((int)position.X, (int)position.Y, texture->Width, texture->Height);
|
Rectangle destination = Rectangle((int)position.X, (int)position.Y, texture->Width, texture->Height);
|
||||||
Draw(texture, destination, Rectangle::Empty, color, 0.0f, Vector2::Zero, SpriteEffects::None, 0.0f);
|
Draw(texture, destination, NULL, color, 0.0f, Vector2::Zero, SpriteEffects::None, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteBatch::Draw(Texture2D * const texture, const Rectangle destinationRectangle, const Nullable<Rectangle> sourceRectangle, const Color color)
|
void SpriteBatch::Draw(Texture2D * const texture, const Rectangle destinationRectangle, const Nullable<Rectangle> sourceRectangle, const Color color)
|
||||||
{
|
{
|
||||||
Draw(texture, destinationRectangle, sourceRectangle, color, 0.0f, Vector2::Zero, SpriteEffects::None, 0.0f);
|
Draw(texture, destinationRectangle, sourceRectangle, color, 0.0f, Vector2::Zero, SpriteEffects::None, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteBatch::Draw(Texture2D * const texture, const Vector2 position, const Nullable<Rectangle> sourceRectangle, const Color color)
|
void SpriteBatch::Draw(Texture2D * const texture, const Vector2 position, const Nullable<Rectangle> sourceRectangle, const Color color)
|
||||||
{
|
{
|
||||||
Rectangle destination = Rectangle((int)position.X, (int)position.Y, texture->Width, texture->Height);
|
Rectangle destination = Rectangle((int)position.X, (int)position.Y, texture->Width, texture->Height);
|
||||||
@ -154,13 +142,16 @@ namespace XFX
|
|||||||
SpriteList.Add(sprite);
|
SpriteList.Add(sprite);
|
||||||
|
|
||||||
if (spriteSortMode == SpriteSortMode::Immediate)
|
if (spriteSortMode == SpriteSortMode::Immediate)
|
||||||
|
{
|
||||||
Flush();
|
Flush();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteBatch::Draw(Texture2D * const texture, const Vector2 position, const Nullable<Rectangle> sourceRectangle, const Color color, const float rotation, const Vector2 origin, const Vector2 scale, const SpriteEffects_t effects, const float layerDepth)
|
void SpriteBatch::Draw(Texture2D * const texture, const Vector2 position, const Nullable<Rectangle> sourceRectangle, const Color color, const float rotation, const Vector2 origin, const Vector2 scale, const SpriteEffects_t effects, const float layerDepth)
|
||||||
{
|
{
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
|
|
||||||
if (sourceRectangle.HasValue())
|
if (sourceRectangle.HasValue())
|
||||||
{
|
{
|
||||||
width = (int)(sourceRectangle.getValue().Width * scale.X);
|
width = (int)(sourceRectangle.getValue().Width * scale.X);
|
||||||
@ -171,14 +162,16 @@ namespace XFX
|
|||||||
width = (int)(texture->Width * scale.X);
|
width = (int)(texture->Width * scale.X);
|
||||||
height = (int)(texture->Height * scale.Y);
|
height = (int)(texture->Height * scale.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle destination = Rectangle((int)position.X, (int)position.Y, width, height);
|
Rectangle destination = Rectangle((int)position.X, (int)position.Y, width, height);
|
||||||
Draw(texture, destination, sourceRectangle, color, rotation, origin, effects, layerDepth);
|
Draw(texture, destination, sourceRectangle, color, rotation, origin, effects, layerDepth);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteBatch::Draw(Texture2D * const texture, const Vector2 position, const Nullable<Rectangle> sourceRectangle, const Color color, const float rotation, const Vector2 origin, const float scale, const SpriteEffects_t effects, const float layerDepth)
|
void SpriteBatch::Draw(Texture2D * const texture, const Vector2 position, const Nullable<Rectangle> sourceRectangle, const Color color, const float rotation, const Vector2 origin, const float scale, const SpriteEffects_t effects, const float layerDepth)
|
||||||
{
|
{
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
|
|
||||||
if (sourceRectangle.HasValue())
|
if (sourceRectangle.HasValue())
|
||||||
{
|
{
|
||||||
width = (int)(sourceRectangle.getValue().Width * scale);
|
width = (int)(sourceRectangle.getValue().Width * scale);
|
||||||
@ -189,12 +182,13 @@ namespace XFX
|
|||||||
width = (int)(texture->Width * scale);
|
width = (int)(texture->Width * scale);
|
||||||
height = (int)(texture->Height * scale);
|
height = (int)(texture->Height * scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle destination = Rectangle((int)position.X, (int)position.Y, width, height);
|
Rectangle destination = Rectangle((int)position.X, (int)position.Y, width, height);
|
||||||
Draw(texture, destination, sourceRectangle, color, rotation, origin, effects, layerDepth);
|
Draw(texture, destination, sourceRectangle, color, rotation, origin, effects, layerDepth);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteBatch::DrawString(SpriteFont * const spriteFont, String& text, const Vector2 position, const Color color)
|
void SpriteBatch::DrawString(SpriteFont * const spriteFont, String& text, const Vector2 position, const Color color)
|
||||||
{
|
{
|
||||||
spriteFont->Draw(text, this, position, color, 0.0f, Vector2::Zero, Vector2::One, SpriteEffects::None, 0.0f);
|
spriteFont->Draw(text, this, position, color, 0.0f, Vector2::Zero, Vector2::One, SpriteEffects::None, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,7 +196,7 @@ namespace XFX
|
|||||||
{
|
{
|
||||||
spriteFont->Draw(text, this, position, color, rotation, origin, scale, effects, layerDepth);
|
spriteFont->Draw(text, this, position, color, rotation, origin, scale, effects, layerDepth);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteBatch::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)
|
void SpriteBatch::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)
|
||||||
{
|
{
|
||||||
Vector2 vector = Vector2::Zero;
|
Vector2 vector = Vector2::Zero;
|
||||||
@ -210,9 +204,9 @@ namespace XFX
|
|||||||
vector.Y = scale;
|
vector.Y = scale;
|
||||||
spriteFont->Draw(text, this, position, color, rotation, origin, vector, effects, layerDepth);
|
spriteFont->Draw(text, this, position, color, rotation, origin, vector, effects, layerDepth);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteBatch::End()
|
void SpriteBatch::End()
|
||||||
{
|
{
|
||||||
sassert(inBeginEndPair, "Begin must be called successfully before End can be called.");
|
sassert(inBeginEndPair, "Begin must be called successfully before End can be called.");
|
||||||
|
|
||||||
if (spriteSortMode != SpriteSortMode::Immediate)
|
if (spriteSortMode != SpriteSortMode::Immediate)
|
||||||
@ -226,7 +220,7 @@ namespace XFX
|
|||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glPopMatrix();*/
|
glPopMatrix();*/
|
||||||
|
|
||||||
restoreRenderState();
|
restoreRenderState();
|
||||||
|
|
||||||
inBeginEndPair = false;
|
inBeginEndPair = false;
|
||||||
|
@ -71,6 +71,7 @@ namespace System
|
|||||||
#if ENABLE_XBOX
|
#if ENABLE_XBOX
|
||||||
const char* Environment::NewLine = "\r\n";
|
const char* Environment::NewLine = "\r\n";
|
||||||
#else
|
#else
|
||||||
|
const char* Environment::NewLine = "\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
OperatingSystem Environment::OSVersion()
|
OperatingSystem Environment::OSVersion()
|
||||||
|
@ -31,21 +31,21 @@ namespace System
|
|||||||
{
|
{
|
||||||
namespace Threading
|
namespace Threading
|
||||||
{
|
{
|
||||||
ULONG Thread::Id = 0;
|
ULONG Thread::GlobalId = 0;
|
||||||
|
|
||||||
void Thread::Thread_init()
|
void Thread::Thread_init()
|
||||||
{
|
{
|
||||||
PsCreateSystemThreadEx(&system_thread_handle, //Thread Handle
|
PsCreateSystemThreadEx(&system_thread_handle, // Thread Handle
|
||||||
0, //KernelStackSize
|
0, // KernelStackSize
|
||||||
stack_size, //Stack Size
|
stack_size, // Stack Size
|
||||||
0, //TlsDataSize
|
0, // TlsDataSize
|
||||||
&Id, //Thread ID
|
&Id, // Thread ID
|
||||||
NULL, //StartContext1
|
NULL, // StartContext1
|
||||||
NULL, //StartContext2
|
NULL, // StartContext2
|
||||||
TRUE, //CreateSuspended
|
TRUE, // CreateSuspended
|
||||||
FALSE, //DebugStack
|
FALSE, // DebugStack
|
||||||
(PKSTART_ROUTINE)&callback); //StartRoutine
|
(PKSTART_ROUTINE)&callback); // StartRoutine
|
||||||
|
|
||||||
ObReferenceObjectByHandle(system_thread_handle, (POBJECT_TYPE)PsThreadObjectType, &system_thread_handle);
|
ObReferenceObjectByHandle(system_thread_handle, (POBJECT_TYPE)PsThreadObjectType, &system_thread_handle);
|
||||||
|
|
||||||
//#define LOW_PRIORITY 0
|
//#define LOW_PRIORITY 0
|
||||||
@ -54,10 +54,10 @@ namespace System
|
|||||||
//#define MAXIMUM_PRIORITY 32
|
//#define MAXIMUM_PRIORITY 32
|
||||||
|
|
||||||
KeSetBasePriorityThread((PKTHREAD)system_thread_handle, (PVOID)0); //Default the thread to low priority
|
KeSetBasePriorityThread((PKTHREAD)system_thread_handle, (PVOID)0); //Default the thread to low priority
|
||||||
|
|
||||||
state = ThreadState::Unstarted;
|
state = ThreadState::Unstarted;
|
||||||
|
|
||||||
Id++; //increment Id so every thread Id is unique
|
Id = GlobalId++; //increment Id so every thread Id is unique
|
||||||
}
|
}
|
||||||
|
|
||||||
void Thread::Abort()
|
void Thread::Abort()
|
||||||
@ -76,8 +76,10 @@ namespace System
|
|||||||
Thread::Thread(PKSTART_ROUTINE callBack, int stackSize)
|
Thread::Thread(PKSTART_ROUTINE callBack, int stackSize)
|
||||||
{
|
{
|
||||||
if(stackSize < 131072)
|
if(stackSize < 131072)
|
||||||
|
{
|
||||||
stack_size = 65536; //Default stack size is 65536, which should be enough, unless there is need for a > 128k stack.
|
stack_size = 65536; //Default stack size is 65536, which should be enough, unless there is need for a > 128k stack.
|
||||||
|
}
|
||||||
|
|
||||||
stack_size = stackSize;
|
stack_size = stackSize;
|
||||||
callback = callBack;
|
callback = callBack;
|
||||||
Thread_init();
|
Thread_init();
|
||||||
@ -91,17 +93,21 @@ namespace System
|
|||||||
|
|
||||||
void Thread::SetPriority(int priority)
|
void Thread::SetPriority(int priority)
|
||||||
{
|
{
|
||||||
if((priority != 0) && (priority != 16) && (priority != 31) && (priority != 32))
|
if ((priority != 0) && (priority != 16) && (priority != 31) && (priority != 32))
|
||||||
|
{
|
||||||
return; //no valid values
|
return; //no valid values
|
||||||
|
}
|
||||||
|
|
||||||
ObReferenceObjectByHandle(system_thread_handle, (POBJECT_TYPE)PsThreadObjectType, &system_thread_handle);
|
ObReferenceObjectByHandle(system_thread_handle, (POBJECT_TYPE)PsThreadObjectType, &system_thread_handle);
|
||||||
KeSetBasePriorityThread((PKTHREAD)system_thread_handle, (PVOID)priority);
|
KeSetBasePriorityThread((PKTHREAD)system_thread_handle, (PVOID)priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Thread::Sleep(int millisecondsTimeout)
|
void Thread::Sleep(int millisecondsTimeout)
|
||||||
{
|
{
|
||||||
if(millisecondsTimeout <= 0)
|
if (millisecondsTimeout <= 0)
|
||||||
|
{
|
||||||
return; //no reason to sleep. We could also throw an ArgumentOutOfRangeException, but what's the point in that?
|
return; //no reason to sleep. We could also throw an ArgumentOutOfRangeException, but what's the point in that?
|
||||||
|
}
|
||||||
|
|
||||||
LARGE_INTEGER pli;
|
LARGE_INTEGER pli;
|
||||||
|
|
||||||
@ -113,7 +119,9 @@ namespace System
|
|||||||
void Thread::Sleep(TimeSpan timeout)
|
void Thread::Sleep(TimeSpan timeout)
|
||||||
{
|
{
|
||||||
if(timeout == TimeSpan::Zero)
|
if(timeout == TimeSpan::Zero)
|
||||||
|
{
|
||||||
return; //! no reason to sleep
|
return; //! no reason to sleep
|
||||||
|
}
|
||||||
|
|
||||||
LARGE_INTEGER pli;
|
LARGE_INTEGER pli;
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make clean 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeCleanCommandLine>
|
<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">make clean 2>&1 | sed -e %27s/\(\w\+\):\([0-9]\+\):/\1(\2):/%27</NMakeCleanCommandLine>
|
||||||
<NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">libmscorlib.a</NMakeOutput>
|
<NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">libmscorlib.a</NMakeOutput>
|
||||||
<NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ENABLE_XBOX; DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
<NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ENABLE_XBOX; DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
||||||
<NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\cygwin\usr\local\openxdk\include;C:\cygwin\usr\local\openxdk\i386-pc-xbox\include;C:\cygwin\usr\local\openxdk\include\SDL;..\..\include;$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
|
<NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\devKitPro\msys\local\openxdk\include;C:\devKitPro\msys\local\openxdk\i386-pc-xbox\include;C:\devKitPro\msys\local\openxdk\include\SDL;$(SolutionDir)include;$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
|
||||||
<NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
|
<NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
|
||||||
<NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>
|
<NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>
|
||||||
<NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>
|
<NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>
|
||||||
@ -55,7 +55,7 @@
|
|||||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<IncludePath>C:\cygwin\usr\include;C:\cygwin\usr\local\openxdk\i386-pc-xbox\include;C:\cygwin\usr\local\openxdk\include;C:\cygwin\usr\local\openxdk\include\SDL;$(SolutionDir)include</IncludePath>
|
<IncludePath>C:\devKitPro\msys\include;C:\devKitPro\msys\local\openxdk\i386-pc-xbox\include;C:\devKitPro\msys\local\openxdk\include;C:\devKitPro\msys\local\openxdk\include\SDL;$(SolutionDir)include</IncludePath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<BuildLog>
|
<BuildLog>
|
||||||
|
@ -26,7 +26,7 @@ LD_FLAGS = $(CLINK) $(ALIGN) $(SHARED) $(ENTRYPOINT) $(STRIP)
|
|||||||
LD_DIRS = -L$(PREFIX)/i386-pc-xbox/lib -L$(PREFIX)/lib
|
LD_DIRS = -L$(PREFIX)/i386-pc-xbox/lib -L$(PREFIX)/lib
|
||||||
LD_LIBS = $(LD_DIRS) -lm -lopenxdk -lhal -lc -lusb -lc -lxboxkrnl -lc -lhal -lxboxkrnl -lhal -lopenxdk -lc -lgcc -lstdc++
|
LD_LIBS = $(LD_DIRS) -lm -lopenxdk -lhal -lc -lusb -lc -lxboxkrnl -lc -lhal -lxboxkrnl -lhal -lopenxdk -lc -lgcc -lstdc++
|
||||||
|
|
||||||
OBJS = BinaryReader.o BinaryWriter.o BitConverter.o Boolean.o Byte.o Calendar.o Comparer.o Console.o DateTime.o DaylightTime.o Directory.o DirectoryInfo.o Double.o Environment.o EventArgs.o File.o FileStream.o FrameworkResources.o Int32.o Int64.o Math.o Object.o OperatingSystem.o Path.o sassert.o SByte.o Single.o Stream.o StreamAsyncResult.o StreamReader.o StreamWriter.o String.o StringBuilder.o Thread.o TimeSpan.o UInt16.o UInt32.o UInt64.o Version.o
|
OBJS = BinaryReader.o BinaryWriter.o BitConverter.o Boolean.o Byte.o Calendar.o Comparer.o Console.o DateTime.o DaylightTime.o Directory.o DirectoryInfo.o Double.o Environment.o EventArgs.o File.o FileStream.o FrameworkResources.o Int32.o Int64.o Math.o Object.o OperatingSystem.o Path.o sassert.o SByte.o Single.o Stream.o StreamAsyncResult.o StreamReader.o StreamWriter.o String.o StringBuilder.o Thread.o TimeSpan.o Type.o UInt16.o UInt32.o UInt64.o Version.o
|
||||||
|
|
||||||
all: libmscorlib.a
|
all: libmscorlib.a
|
||||||
|
|
||||||
|
@ -6,9 +6,9 @@
|
|||||||
void __sassert(const char *fileName, int lineNumber, const char* conditionString, const char* message)
|
void __sassert(const char *fileName, int lineNumber, const char* conditionString, const char* message)
|
||||||
{
|
{
|
||||||
debugClearScreen();
|
debugClearScreen();
|
||||||
debugPrint("\tAssertion!\n\tFile: \n%s\n\nLine: %d\n\nCondition:\n%s\n\n\t%s", fileName, lineNumber, conditionString, message);
|
debugPrint("\tAssertion!\n\tFile: \n%s\n\nLine: %d\n\nCondition:\n%s\n\n\t%s", fileName, lineNumber, conditionString, message);
|
||||||
|
|
||||||
XSleep(100);
|
XSleep(100);
|
||||||
|
|
||||||
__asm__ ("cli\nhlt");
|
__asm__ ("cli\nhlt");
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
#########################################################################
|
#########################################################################
|
||||||
PREFIX = /usr/local/openxdk
|
PREFIX = /usr/local/openxdk
|
||||||
XFX_PREFIX = /cygdrive/j/XFX
|
XFX_PREFIX = /usr/local/XFX
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CCAS = gcc
|
CCAS = gcc
|
||||||
|
Loading…
x
Reference in New Issue
Block a user