mirror of
https://github.com/Halofreak1990/XFXFramework
synced 2024-12-26 13:49:34 +01:00
Added a couple of helper classes and functions. Libraries compile, but a project based on them is flooded with undefined references.
This commit is contained in:
parent
95f3ff3ab6
commit
da68d727e4
@ -1,27 +1,15 @@
|
|||||||
#ifndef XFRAMEWORK_AUDIO_H
|
/********************************************************
|
||||||
#define XFRAMEWORK_AUDIO_H
|
* Audio.h *
|
||||||
|
* *
|
||||||
|
* XFX::Audio namespace include file *
|
||||||
|
* Copyright © XFX Team. All Rights Reserved *
|
||||||
|
********************************************************/
|
||||||
|
#ifndef _XFX_AUDIO_
|
||||||
|
#define _XFX_AUDIO_
|
||||||
|
|
||||||
#ifdef XBOX
|
|
||||||
//
|
|
||||||
//Data Types
|
|
||||||
//
|
|
||||||
#include "AudioCategory.h"
|
|
||||||
#include "AudioEmitter.h"
|
|
||||||
#include "AudioEngine.h"
|
|
||||||
#include "AudioListener.h"
|
|
||||||
#include "Cue.h"
|
|
||||||
#include "RendererDetail.h"
|
|
||||||
#include "SoundBank.h"
|
|
||||||
#include "SoundState.h"
|
|
||||||
#include "WaveBank.h"
|
|
||||||
//
|
//
|
||||||
//Enums
|
//Enums
|
||||||
//
|
//
|
||||||
#include "AudioStopOptions.h"
|
#include "Audio/Enums.h"
|
||||||
//
|
|
||||||
//Interfaces
|
|
||||||
//
|
|
||||||
|
|
||||||
#endif
|
#endif //_XFX_AUDIO_
|
||||||
|
|
||||||
#endif //XFRAMEWORK_AUDIO_H
|
|
||||||
|
16
include/Content.h
Normal file
16
include/Content.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/********************************************************
|
||||||
|
* Content.h *
|
||||||
|
* *
|
||||||
|
* XFX::Content namespace include file *
|
||||||
|
* Copyright © XFX Team. All Rights Reserved *
|
||||||
|
********************************************************/
|
||||||
|
#ifndef _XFX_CONTENT_
|
||||||
|
#define _XFX_CONTENT_
|
||||||
|
|
||||||
|
//
|
||||||
|
//Classes
|
||||||
|
//
|
||||||
|
#include "Content/ContentManager.h"
|
||||||
|
#include "Content/ContentReader.h"
|
||||||
|
|
||||||
|
#endif //_XFX_CONTENT_
|
@ -29,11 +29,11 @@ namespace XFX
|
|||||||
/// It also manages the lifespan of the loaded objects, disposing the content
|
/// It also manages the lifespan of the loaded objects, disposing the content
|
||||||
/// manager will also dispose any assets which are themselves System.IDisposable.
|
/// manager will also dispose any assets which are themselves System.IDisposable.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class ContentManager : public IDisposable, public Object
|
class ContentManager : public IDisposable, virtual Object
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
List<IDisposable*> disposableAssets;
|
List<IDisposable*> disposableAssets;
|
||||||
//Dictionary<String, Object*> loadedAssets;
|
//Dictionary<char*, Object*> loadedAssets;
|
||||||
bool disposed;
|
bool disposed;
|
||||||
IServiceProvider* _provider;
|
IServiceProvider* _provider;
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ namespace XFX
|
|||||||
void Dispose();
|
void Dispose();
|
||||||
void Exit();
|
void Exit();
|
||||||
void ResetElapsedTime();
|
void ResetElapsedTime();
|
||||||
void Run();
|
virtual void Run();
|
||||||
void SuppressDraw();
|
void SuppressDraw();
|
||||||
void Tick();
|
void Tick();
|
||||||
};
|
};
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
#include <System/Interfaces.h>
|
#include <System/Interfaces.h>
|
||||||
#include <System/Object.h>
|
#include <System/Object.h>
|
||||||
|
|
||||||
|
using namespace System;
|
||||||
|
|
||||||
namespace XFX
|
namespace XFX
|
||||||
{
|
{
|
||||||
/// <Summary>
|
/// <Summary>
|
||||||
@ -25,4 +27,4 @@ namespace XFX
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //_XFX_GAMESERVICECONTAINER_H
|
#endif //_XFX_GAMESERVICECONTAINER_
|
||||||
|
20
include/GamerServices.h
Normal file
20
include/GamerServices.h
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/********************************************************
|
||||||
|
* GamerServices.h *
|
||||||
|
* *
|
||||||
|
* XFX::GamerServices namespace include file *
|
||||||
|
* Copyright © XFX Team. All Rights Reserved *
|
||||||
|
********************************************************/
|
||||||
|
#ifndef _XFX_GAMERSERVICES_
|
||||||
|
#define _XFX_GAMERSERVICES_
|
||||||
|
|
||||||
|
//
|
||||||
|
//Classes
|
||||||
|
//
|
||||||
|
#include "GamerServices/Guide.h"
|
||||||
|
|
||||||
|
//
|
||||||
|
//Enums
|
||||||
|
//
|
||||||
|
#include "GamerServices/Enums.h"
|
||||||
|
|
||||||
|
#endif //_XFX_GAMERSERVICES_
|
@ -16,7 +16,7 @@ namespace XFX
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new GamerServicesComponent.
|
/// Creates a new GamerServicesComponent.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class GamerServicesComponent : GameComponent
|
class GamerServicesComponent : public GameComponent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GamerServicesComponent(Game game);
|
GamerServicesComponent(Game game);
|
||||||
|
@ -11,12 +11,10 @@
|
|||||||
//Data Types
|
//Data Types
|
||||||
//
|
//
|
||||||
#include "Graphics/BasicDirectionalLight.h"
|
#include "Graphics/BasicDirectionalLight.h"
|
||||||
#include "Graphics/BasicEffect.h"
|
|
||||||
#include "Graphics/Color.h"
|
#include "Graphics/Color.h"
|
||||||
#include "Graphics/DepthStencilBuffer.h"
|
#include "Graphics/DepthStencilBuffer.h"
|
||||||
#include "Graphics/DisplayMode.h"
|
#include "Graphics/DisplayMode.h"
|
||||||
#include "Graphics/DisplayModeCollection.h"
|
#include "Graphics/DisplayModeCollection.h"
|
||||||
#include "Graphics/Effect.h"
|
|
||||||
#include "Graphics/Exceptions.h"
|
#include "Graphics/Exceptions.h"
|
||||||
#include "Graphics/GraphicsAdapter.h"
|
#include "Graphics/GraphicsAdapter.h"
|
||||||
#include "Graphics/GraphicsDevice.h"
|
#include "Graphics/GraphicsDevice.h"
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
* BasicDirectionalLight definition file *
|
* BasicDirectionalLight definition file *
|
||||||
* Copyright © XFX Team. All Rights Reserved *
|
* Copyright © XFX Team. All Rights Reserved *
|
||||||
********************************************************/
|
********************************************************/
|
||||||
#ifndef _BASICDIRECTIONALLIGHT_H_
|
#ifndef _XFX_GRAPHICS_BASICDIRECTIONALLIGHT_
|
||||||
#define _BASICDIRECTIONALLICHT_H_
|
#define _XFX_GRAPHICS_BASICDIRECTIONALLICHT_
|
||||||
|
|
||||||
#include <Vector3.h>
|
#include <Vector3.h>
|
||||||
|
|
||||||
@ -21,10 +21,10 @@ namespace XFX
|
|||||||
public:
|
public:
|
||||||
Vector3 DiffuseColor;
|
Vector3 DiffuseColor;
|
||||||
Vector3 Direction;
|
Vector3 Direction;
|
||||||
int Enabled;
|
bool Enabled;
|
||||||
Vector3 SpecularColor;
|
Vector3 SpecularColor;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //_BASICDIRECTIONALLIGHT_H_
|
#endif //_XFX_GRAPHICS_BASICDIRECTIONALLIGHT_
|
||||||
|
@ -15,35 +15,36 @@ namespace XFX
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Queries and prepares depth stencil buffers.
|
/// Queries and prepares depth stencil buffers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class DepthStencilBuffer : IDisposable
|
class DepthStencilBuffer : public IDisposable
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
GraphicsDevice *_graphicsDevice;
|
GraphicsDevice *_graphicsDevice;
|
||||||
int _width;
|
int _width;
|
||||||
int _height;
|
int _height;
|
||||||
DepthFormat_t _format;
|
DepthFormat_t _format;
|
||||||
int isDisposed;
|
bool isDisposed;
|
||||||
int _multiSampleQuality;
|
int _multiSampleQuality;
|
||||||
MultiSampleType_t _multiSampleType;
|
MultiSampleType_t _multiSampleType;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void Dispose(int __p1);
|
virtual void Dispose(bool __p1);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DepthFormat_t Format();
|
DepthFormat_t Format();
|
||||||
GraphicsDevice GraphicsDevice_();
|
GraphicsDevice *GraphicsDevice_();
|
||||||
int IsDisposed();
|
bool IsDisposed();
|
||||||
int MultiSampleQuality();
|
int MultiSampleQuality();
|
||||||
MultiSampleType_t MultiSampleType_();
|
MultiSampleType_t MultiSampleType_();
|
||||||
int Height();
|
int Height();
|
||||||
int Width();
|
int Width();
|
||||||
|
|
||||||
DepthStencilBuffer(GraphicsDevice &graphicsDevice, int width, int height, DepthFormat_t format);
|
DepthStencilBuffer(GraphicsDevice *graphicsDevice, int width, int height, DepthFormat_t format);
|
||||||
DepthStencilBuffer(GraphicsDevice &graphicsDevice, int width, int height, DepthFormat_t format, MultiSampleType_t multiSampleType, int multiSampleQuality);
|
DepthStencilBuffer(GraphicsDevice *graphicsDevice, int width, int height, DepthFormat_t format, MultiSampleType_t multiSampleType, int multiSampleQuality);
|
||||||
DepthStencilBuffer();
|
DepthStencilBuffer();
|
||||||
virtual ~DepthStencilBuffer();
|
DepthStencilBuffer(const DepthStencilBuffer &obj);
|
||||||
|
virtual ~DepthStencilBuffer();
|
||||||
void Dispose();
|
|
||||||
|
void Dispose();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -457,10 +457,10 @@ namespace XFX
|
|||||||
{
|
{
|
||||||
enum type
|
enum type
|
||||||
{
|
{
|
||||||
Boolean = 0,
|
Boolean = 0, //Boolean value.
|
||||||
Float = 2,
|
Float = 2, //4D floating-point number.
|
||||||
Int4 = 1,
|
Int4 = 1, //4D integer number.
|
||||||
Sampler = 3
|
Sampler = 3 //The register contains 4D sampler data.
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -470,9 +470,9 @@ namespace XFX
|
|||||||
{
|
{
|
||||||
enum type
|
enum type
|
||||||
{
|
{
|
||||||
Additive = 2,
|
Additive = 2, //Enable Additive blending.
|
||||||
AlphaBlend = 1,
|
AlphaBlend = 1, //Enable Alpha blending.
|
||||||
None = 0
|
None = 0 //No blending specified.
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -482,9 +482,9 @@ namespace XFX
|
|||||||
{
|
{
|
||||||
enum type
|
enum type
|
||||||
{
|
{
|
||||||
FlipHorizontally = 1,
|
FlipHorizontally = 1, //Rotate 180 degrees about the Y axis before rendering.
|
||||||
FlipVertically = 256,
|
FlipVertically = 0x100, //Rotate 180 degrees about the X axis before rendering.
|
||||||
None = 0
|
None = 0 //No rotations specified.
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -26,7 +26,7 @@ namespace XFX
|
|||||||
class GraphicsAdapter : public IDisposable
|
class GraphicsAdapter : public IDisposable
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
void Dispose(int __p1);
|
void Dispose(bool __p1);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DisplayMode CurrentDisplayMode();
|
DisplayMode CurrentDisplayMode();
|
||||||
@ -47,16 +47,16 @@ namespace XFX
|
|||||||
bool CheckDeviceFormat(DeviceType_t deviceType, SurfaceFormat_t adapterFormat, TextureUsage_t usage, QueryUsages_t queryUsages, ResourceType_t resourceType, SurfaceFormat_t checkFormat);
|
bool CheckDeviceFormat(DeviceType_t deviceType, SurfaceFormat_t adapterFormat, TextureUsage_t usage, QueryUsages_t queryUsages, ResourceType_t resourceType, SurfaceFormat_t checkFormat);
|
||||||
bool CheckDeviceFormat(DeviceType_t deviceType, SurfaceFormat_t adapterFormat, TextureUsage_t usage, QueryUsages_t queryUsages, ResourceType_t resourceType, DepthFormat_t checkFormat);
|
bool CheckDeviceFormat(DeviceType_t deviceType, SurfaceFormat_t adapterFormat, TextureUsage_t usage, QueryUsages_t queryUsages, ResourceType_t resourceType, DepthFormat_t checkFormat);
|
||||||
bool CheckDeviceFormatConversion(DeviceType_t deviceType, SurfaceFormat_t sourceFormat, SurfaceFormat_t targetFormat);
|
bool CheckDeviceFormatConversion(DeviceType_t deviceType, SurfaceFormat_t sourceFormat, SurfaceFormat_t targetFormat);
|
||||||
bool CheckDeviceMultiSampleType(DeviceType_t deviceType, SurfaceFormat_t surfaceFormat, int isFullScreen, MultiSampleType_t sampleType);
|
bool CheckDeviceMultiSampleType(DeviceType_t deviceType, SurfaceFormat_t surfaceFormat, bool isFullScreen, MultiSampleType_t sampleType);
|
||||||
bool CheckDeviceMultiSampleType(DeviceType_t deviceType, SurfaceFormat_t surfaceFormat, int isFullScreen, MultiSampleType_t sampleType, out int qualityLevels);
|
bool CheckDeviceMultiSampleType(DeviceType_t deviceType, SurfaceFormat_t surfaceFormat, bool isFullScreen, MultiSampleType_t sampleType, out int qualityLevels);
|
||||||
bool CheckDeviceType(DeviceType_t deviceType, SurfaceFormat_t displayFormat, SurfaceFormat_t backBufferFormat, int isFullScreen);
|
bool CheckDeviceType(DeviceType_t deviceType, SurfaceFormat_t displayFormat, SurfaceFormat_t backBufferFormat, bool isFullScreen);
|
||||||
void Dispose();
|
void Dispose();
|
||||||
bool Equals(GraphicsAdapter &other);
|
bool Equals(const GraphicsAdapter obj);
|
||||||
int GetHashCode();
|
int GetHashCode();
|
||||||
bool IsDeviceTypeAvailable(DeviceType_t deviceType);
|
bool IsDeviceTypeAvailable(DeviceType_t deviceType);
|
||||||
|
|
||||||
bool operator!=(GraphicsAdapter other);
|
bool operator!=(const GraphicsAdapter other);
|
||||||
bool operator==(GraphicsAdapter other);
|
bool operator==(const GraphicsAdapter other);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,6 +86,8 @@ namespace XFX
|
|||||||
float* GetPixelShaderSingleConstant(int startRegister, int constantCount);
|
float* GetPixelShaderSingleConstant(int startRegister, int constantCount);
|
||||||
Vector2* GetPixelShaderVector2ArrayConstant(int startRegister, int constantCount);
|
Vector2* GetPixelShaderVector2ArrayConstant(int startRegister, int constantCount);
|
||||||
Vector2 GetPixelShaderVector2Constant(int startRegister);
|
Vector2 GetPixelShaderVector2Constant(int startRegister);
|
||||||
|
void SetVertexShaderConstant(int startRegister, Matrix constantData);
|
||||||
|
void SetVertexShaderConstant(int startRegister, Vector4 constantData);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,10 @@
|
|||||||
* XFX PresentationParameters definition file *
|
* XFX PresentationParameters definition file *
|
||||||
* Copyright © XFX Team. All Rights Reserved *
|
* Copyright © XFX Team. All Rights Reserved *
|
||||||
********************************************************/
|
********************************************************/
|
||||||
#ifndef _PRESENTATIONPARAMETERS_
|
#ifndef _XFX_GRAPHICS_PRESENTATIONPARAMETERS_
|
||||||
#define _PRESENTATIONPARAMETERS_
|
#define _XFX_GRAPHICS_PRESENTATIONPARAMETERS_
|
||||||
|
|
||||||
#include "../System.h"
|
#include <System/Types.h>
|
||||||
#include "Enums.h"
|
#include "Enums.h"
|
||||||
|
|
||||||
using namespace System;
|
using namespace System;
|
||||||
@ -19,13 +19,13 @@ namespace XFX
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Contains presentation parameters.
|
/// Contains presentation parameters.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class PresentationParameters : IDisposable
|
class PresentationParameters : public IDisposable
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int disposed;
|
bool disposed;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void Dispose(int disposing);
|
virtual void Dispose(bool disposing);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DepthFormat_t AutoDepthStencilFormat;
|
DepthFormat_t AutoDepthStencilFormat;
|
||||||
@ -39,9 +39,9 @@ namespace XFX
|
|||||||
IntPtr DeviceWindowHandle;
|
IntPtr DeviceWindowHandle;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int EnableAutoDepthStencil;
|
bool EnableAutoDepthStencil;
|
||||||
int FullScreenRefreshRateInHz;
|
int FullScreenRefreshRateInHz;
|
||||||
int IsFullScreen;
|
bool IsFullScreen;
|
||||||
int MultiSampleQuality;
|
int MultiSampleQuality;
|
||||||
MultiSampleType_t MultiSampleType_;
|
MultiSampleType_t MultiSampleType_;
|
||||||
PresentInterval_t PresentationInterval;
|
PresentInterval_t PresentationInterval;
|
||||||
@ -54,12 +54,12 @@ namespace XFX
|
|||||||
void Clear();
|
void Clear();
|
||||||
PresentationParameters Clone();
|
PresentationParameters Clone();
|
||||||
void Dispose();
|
void Dispose();
|
||||||
int Equals(PresentationParameters &other);
|
bool Equals(const PresentationParameters other);
|
||||||
|
|
||||||
int operator!=(PresentationParameters &other);
|
bool operator!=(const PresentationParameters other);
|
||||||
int operator==(PresentationParameters &other);
|
bool operator==(const PresentationParameters other);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //_PRESENTATIONPARAMETERS_
|
#endif //_XFX_GRAPHICS_PRESENTATIONPARAMETERS_
|
||||||
|
50
include/Graphics/Sprite.h
Normal file
50
include/Graphics/Sprite.h
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/********************************************************
|
||||||
|
* Sprite.h *
|
||||||
|
* *
|
||||||
|
* XFX Sprite definition file *
|
||||||
|
* Copyright © XFX Team. All Rights Reserved *
|
||||||
|
********************************************************/
|
||||||
|
#ifndef _XFX_GRAPHICS_SPRITE_
|
||||||
|
#define _XFX_GRAPHICS_SPRITE_
|
||||||
|
|
||||||
|
#include "Color.h"
|
||||||
|
#include "Enums.h"
|
||||||
|
#include "Texture2D.h"
|
||||||
|
#include <Rectangle.h>
|
||||||
|
#include <Vector2.h>
|
||||||
|
|
||||||
|
namespace XFX
|
||||||
|
{
|
||||||
|
namespace Graphics
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
class Sprite
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
Texture2D texture;
|
||||||
|
Rectangle destinationRectangle;
|
||||||
|
Rectangle sourceRectangle;
|
||||||
|
Color color;
|
||||||
|
float rotation;
|
||||||
|
Vector2 origin;
|
||||||
|
SpriteEffects_t effects;
|
||||||
|
float layerDepth;
|
||||||
|
|
||||||
|
public:
|
||||||
|
Texture2D Texture();
|
||||||
|
Rectangle DestinationRectangle();
|
||||||
|
Rectangle SourceRectangle();
|
||||||
|
Color Color_();
|
||||||
|
float Rotation();
|
||||||
|
Vector2 Origin();
|
||||||
|
SpriteEffects_t Effects();
|
||||||
|
float LayerDepth();
|
||||||
|
|
||||||
|
Sprite(Texture2D texture, Rectangle sourceRectangle, Rectangle destinationRectangle, Color color, float rotation, Vector2 origin, SpriteEffects_t effects, float layerDepth);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //_XFX_GRAPHICS_SPRITE_
|
@ -4,19 +4,25 @@
|
|||||||
* XFX SpriteBatch definition file *
|
* XFX SpriteBatch definition file *
|
||||||
* Copyright © XFX Team. All Rights Reserved *
|
* Copyright © XFX Team. All Rights Reserved *
|
||||||
********************************************************/
|
********************************************************/
|
||||||
#ifndef _SPRITEBATCH_
|
#ifndef _XFX_GRAPHICS_SPRITEBATCH_
|
||||||
#define _SPRITEBATCH_
|
#define _XFX_GRAPHICS_SPRITEBATCH_
|
||||||
|
|
||||||
#include <System/Types.h>
|
|
||||||
#include "Enums.h"
|
#include "Enums.h"
|
||||||
|
#include "GraphicsDevice.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;
|
||||||
|
using namespace System::Collections::Generic;
|
||||||
|
|
||||||
namespace XFX
|
namespace XFX
|
||||||
{
|
{
|
||||||
struct Matrix;
|
|
||||||
struct Rectangle;
|
struct Rectangle;
|
||||||
struct Vector2;
|
|
||||||
|
|
||||||
namespace Graphics
|
namespace Graphics
|
||||||
{
|
{
|
||||||
@ -27,15 +33,22 @@ namespace XFX
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enables a group of sprites to be drawn using the same settings.
|
/// Enables a group of sprites to be drawn using the same settings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class SpriteBatch : public IDisposable
|
class SpriteBatch : public IDisposable, virtual Object
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
GraphicsDevice* device;
|
Texture2D* currentTexture;
|
||||||
bool disposed;
|
GraphicsDevice device;
|
||||||
|
bool isDisposed;
|
||||||
|
bool inBeginEndPair;
|
||||||
|
SaveStateMode_t saveStateMode;
|
||||||
|
StateBlock saveState;
|
||||||
|
SpriteSortMode_t spriteSortMode;
|
||||||
static SpriteBlendMode_t spriteBlendMode;
|
static SpriteBlendMode_t spriteBlendMode;
|
||||||
|
int spriteQueueCount;
|
||||||
|
List<Sprite> SpriteList;
|
||||||
|
|
||||||
void applyGraphicsDeviceSettings();
|
void applyGraphicsDeviceSettings();
|
||||||
void flush();
|
void Flush();
|
||||||
void restoreRenderState();
|
void restoreRenderState();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -47,8 +60,9 @@ namespace XFX
|
|||||||
|
|
||||||
EventHandler Disposing;
|
EventHandler Disposing;
|
||||||
|
|
||||||
~SpriteBatch();
|
virtual ~SpriteBatch();
|
||||||
SpriteBatch(GraphicsDevice graphicsDevice);
|
SpriteBatch(GraphicsDevice graphicsDevice);
|
||||||
|
SpriteBatch();
|
||||||
|
|
||||||
void Begin();
|
void Begin();
|
||||||
void Begin(SpriteBlendMode_t blendMode);
|
void Begin(SpriteBlendMode_t blendMode);
|
||||||
@ -56,18 +70,19 @@ namespace XFX
|
|||||||
void Begin(SpriteBlendMode_t blendMode, SpriteSortMode_t sortMode, SaveStateMode_t stateMode, Matrix transformMatrix);
|
void Begin(SpriteBlendMode_t blendMode, SpriteSortMode_t sortMode, SaveStateMode_t stateMode, Matrix transformMatrix);
|
||||||
void Dispose();
|
void Dispose();
|
||||||
void Draw(Texture2D texture, Rectangle destinationRectangle, Color color);
|
void Draw(Texture2D texture, Rectangle destinationRectangle, Color color);
|
||||||
void Draw(Texture2D texture, Rectangle destinationRectangle, Rectangle* sourceRectangle, 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, Color color);
|
||||||
void Draw(Texture2D texture, Vector2 position, Rectangle* sourceRectangle, 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, 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, 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 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);
|
||||||
|
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 DrawString(SpriteFont spriteFont, char* text, Vector2 position, Color color, float rotation, Vector2 origin, float scale, SpriteEffects_t effects, float layerDepth);
|
||||||
|
|
||||||
void End();
|
void End();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //_SPRITEBATCH_
|
#endif //_XFX_GRAPHICS_SPRITEBATCH_
|
||||||
|
55
include/Graphics/SpriteFont.h
Normal file
55
include/Graphics/SpriteFont.h
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/********************************************************
|
||||||
|
* SpriteFont.h *
|
||||||
|
* *
|
||||||
|
* XFX SpriteFont definition file *
|
||||||
|
* Copyright © XFX Team. All Rights Reserved *
|
||||||
|
********************************************************/
|
||||||
|
#ifndef _XFX_GRAPHICS_SPRITEFONT_
|
||||||
|
#define _XFX_GRAPHICS_SPRITEFONT_
|
||||||
|
|
||||||
|
#include <Rectangle.h>
|
||||||
|
#include "Texture2D.h"
|
||||||
|
#include <Vector3.h>
|
||||||
|
#include <System/Collections/Generic/List.h>
|
||||||
|
#include <System/Types.h>
|
||||||
|
|
||||||
|
using namespace System;
|
||||||
|
using namespace System::Collections::Generic;
|
||||||
|
|
||||||
|
namespace XFX
|
||||||
|
{
|
||||||
|
struct Vector2;
|
||||||
|
|
||||||
|
namespace Graphics
|
||||||
|
{
|
||||||
|
class SpriteBatch;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a font texture.
|
||||||
|
/// </summary>
|
||||||
|
class SpriteFont
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
List<char> characterMap;
|
||||||
|
List<Rectangle> croppingData;
|
||||||
|
List<Rectangle> glyphData;
|
||||||
|
List<Vector3> kerning;
|
||||||
|
int lineSpacing;
|
||||||
|
float spacing;
|
||||||
|
Texture2D textureValue;
|
||||||
|
|
||||||
|
int GetIndexForCharacter(char character);
|
||||||
|
|
||||||
|
public:
|
||||||
|
int LineSpacing();
|
||||||
|
float Spacing;
|
||||||
|
|
||||||
|
SpriteFont(Texture2D texture, List<Rectangle> glyphs, List<Rectangle> cropping, List<char> charMap, int lineSpacing, float spacing, List<Vector3> kerning);
|
||||||
|
|
||||||
|
void Draw(char* text, SpriteBatch spriteBatch, Vector2 textblockPosition, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects_t spriteEffects, float depth);
|
||||||
|
Vector2 MeasureString(char* text);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //_XFX_GRAPHICS_SPRITEFONT_
|
41
include/Graphics/StateBlock.h
Normal file
41
include/Graphics/StateBlock.h
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/********************************************************
|
||||||
|
* StateBlock.h *
|
||||||
|
* *
|
||||||
|
* XFX StateBlock definition file *
|
||||||
|
* Copyright © XFX Team. All Rights Reserved *
|
||||||
|
********************************************************/
|
||||||
|
#ifndef _XFX_GRAPHICS_STATEBLOCK_
|
||||||
|
#define _XFX_GRAPHICS_STATEBLOCK_
|
||||||
|
|
||||||
|
#include <System/Delegates.h>
|
||||||
|
#include "GraphicsDevice.h"
|
||||||
|
|
||||||
|
namespace XFX
|
||||||
|
{
|
||||||
|
namespace Graphics
|
||||||
|
{
|
||||||
|
class StateBlock : public IDisposable
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
void Dispose(bool disposing);
|
||||||
|
|
||||||
|
public:
|
||||||
|
EventHandler Disposing;
|
||||||
|
|
||||||
|
StateBlock();
|
||||||
|
StateBlock(GraphicsDevice graphiceDevice);
|
||||||
|
StateBlock(const StateBlock &obj);
|
||||||
|
|
||||||
|
void Apply();
|
||||||
|
void Capture();
|
||||||
|
void Dispose();
|
||||||
|
bool Equals(StateBlock other);
|
||||||
|
int GetHashCode();
|
||||||
|
|
||||||
|
bool operator!=(const StateBlock other);
|
||||||
|
bool operator==(const StateBlock other);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //_XFX_GRAPHICS_STATEBLOCK_
|
@ -19,7 +19,7 @@ namespace XFX
|
|||||||
|
|
||||||
namespace Graphics
|
namespace Graphics
|
||||||
{
|
{
|
||||||
class Texture2D : public Texture
|
class Texture2D : public Texture, virtual Object
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
GraphicsDevice device;
|
GraphicsDevice device;
|
||||||
@ -44,8 +44,10 @@ namespace XFX
|
|||||||
TextureUsage_t TextureUsage_();
|
TextureUsage_t TextureUsage_();
|
||||||
int Width();
|
int Width();
|
||||||
|
|
||||||
|
Texture2D();
|
||||||
Texture2D(GraphicsDevice graphicsDevice, int width, int height);
|
Texture2D(GraphicsDevice graphicsDevice, int width, int height);
|
||||||
Texture2D(GraphicsDevice graphicsDevice, int width, int height, int numberLevels, TextureUsage_t usage, SurfaceFormat_t format);
|
Texture2D(GraphicsDevice graphicsDevice, int width, int height, int numberLevels, TextureUsage_t usage, SurfaceFormat_t format);
|
||||||
|
Texture2D(const Texture2D &obj);
|
||||||
|
|
||||||
static Texture2D FromFile(GraphicsDevice graphicsDevice, Stream textureStream);
|
static Texture2D FromFile(GraphicsDevice graphicsDevice, Stream textureStream);
|
||||||
static Texture2D FromFile(GraphicsDevice graphicsDevice, Stream textureStream, TextureCreationParameters creationParameters);
|
static Texture2D FromFile(GraphicsDevice graphicsDevice, Stream textureStream, TextureCreationParameters creationParameters);
|
||||||
|
@ -9,10 +9,10 @@
|
|||||||
|
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "Graphics/GraphicsDevice.h"
|
#include "Graphics/GraphicsDevice.h"
|
||||||
|
#include "Graphics/Enums.h"
|
||||||
|
#include "Graphics/IGraphicsDeviceService.h"
|
||||||
#include "GraphicsDeviceInformation.h"
|
#include "GraphicsDeviceInformation.h"
|
||||||
#include "Interfaces.h"
|
#include "Interfaces.h"
|
||||||
#include "Graphics/IGraphicsDeviceService.h"
|
|
||||||
#include "Graphics/Enums.h"
|
|
||||||
#include "System/Interfaces.h"
|
#include "System/Interfaces.h"
|
||||||
|
|
||||||
using namespace System;
|
using namespace System;
|
||||||
@ -20,16 +20,25 @@ using namespace XFX::Graphics;
|
|||||||
|
|
||||||
namespace XFX
|
namespace XFX
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Handles the configuration and management of the graphics device.
|
||||||
|
/// </summary>
|
||||||
class GraphicsDeviceManager : public IGraphicsDeviceService, public IDisposable, public IGraphicsDeviceManager, virtual Object
|
class GraphicsDeviceManager : public IGraphicsDeviceService, public IDisposable, public IGraphicsDeviceManager, virtual Object
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
bool isFullScreen;
|
bool isFullScreen;
|
||||||
Game _game;
|
Game _game;
|
||||||
|
SurfaceFormat_t backBufferFormat;
|
||||||
|
int backBufferHeight;
|
||||||
|
int backBufferWidth;
|
||||||
GraphicsDevice graphicsDevice;
|
GraphicsDevice graphicsDevice;
|
||||||
|
ShaderProfile_t minimumVertexShaderProfile;
|
||||||
|
|
||||||
|
void CreateDevice();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool CanResetDevice(GraphicsDeviceInformation newDeviceInfo);
|
virtual bool CanResetDevice(GraphicsDeviceInformation newDeviceInfo);
|
||||||
virtual void Dispose(int disposing);
|
virtual void Dispose(bool disposing);
|
||||||
virtual GraphicsDeviceInformation FindBestDevice(bool anySuitableDevice);
|
virtual GraphicsDeviceInformation FindBestDevice(bool anySuitableDevice);
|
||||||
virtual void OnDeviceCreated(Object* sender, EventArgs args);
|
virtual void OnDeviceCreated(Object* sender, EventArgs args);
|
||||||
virtual void OnDeviceDisposing(Object* sender, EventArgs args);
|
virtual void OnDeviceDisposing(Object* sender, EventArgs args);
|
||||||
@ -42,12 +51,12 @@ namespace XFX
|
|||||||
bool IsFullScreen();
|
bool IsFullScreen();
|
||||||
float MinimumPixelShaderProfile;
|
float MinimumPixelShaderProfile;
|
||||||
float MinimumVertexShaderProfile;
|
float MinimumVertexShaderProfile;
|
||||||
int PreferMultiSampling;
|
bool PreferMultiSampling;
|
||||||
SurfaceFormat_t PreferredBackBufferFormat;
|
SurfaceFormat_t PreferredBackBufferFormat;
|
||||||
int PreferredBackBufferWidth;
|
int PreferredBackBufferWidth;
|
||||||
int PreferredBackBufferHeight;
|
int PreferredBackBufferHeight;
|
||||||
DepthFormat_t PreferredDepthStencilFormat;
|
DepthFormat_t PreferredDepthStencilFormat;
|
||||||
int SynchronizeWithVerticalRetrace;
|
bool SynchronizeWithVerticalRetrace;
|
||||||
|
|
||||||
static const int DefaultBackBufferWidth;
|
static const int DefaultBackBufferWidth;
|
||||||
static const int DefaultBackBufferHeight;
|
static const int DefaultBackBufferHeight;
|
||||||
@ -55,6 +64,7 @@ namespace XFX
|
|||||||
static SurfaceFormat_t ValidBackBufferFormats[];
|
static SurfaceFormat_t ValidBackBufferFormats[];
|
||||||
static const DeviceType_t ValidDeviceTypes[];
|
static const DeviceType_t ValidDeviceTypes[];
|
||||||
|
|
||||||
|
GraphicsDeviceManager();
|
||||||
GraphicsDeviceManager(Game game);
|
GraphicsDeviceManager(Game game);
|
||||||
|
|
||||||
EventHandler DeviceCreated;
|
EventHandler DeviceCreated;
|
||||||
@ -64,7 +74,9 @@ namespace XFX
|
|||||||
EventHandler Disposed;
|
EventHandler Disposed;
|
||||||
|
|
||||||
void ApplyChanges();
|
void ApplyChanges();
|
||||||
|
bool BeginDraw();
|
||||||
void Dispose();
|
void Dispose();
|
||||||
|
void EndDraw();
|
||||||
void ToggleFullscreen();
|
void ToggleFullscreen();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,9 @@
|
|||||||
#define _XFX_INTERFACES_
|
#define _XFX_INTERFACES_
|
||||||
|
|
||||||
#include <System/Types.h>
|
#include <System/Types.h>
|
||||||
|
#include <System/Delegates.h>
|
||||||
|
|
||||||
|
using namespace System;
|
||||||
|
|
||||||
namespace XFX
|
namespace XFX
|
||||||
{
|
{
|
||||||
@ -23,7 +26,7 @@ namespace XFX
|
|||||||
virtual bool Visible()=0;
|
virtual bool Visible()=0;
|
||||||
|
|
||||||
virtual void Draw(GameTime gameTime)=0;
|
virtual void Draw(GameTime gameTime)=0;
|
||||||
virtual ~IDrawable();
|
virtual ~IDrawable() {}
|
||||||
|
|
||||||
EventHandler DrawOrderChanged;
|
EventHandler DrawOrderChanged;
|
||||||
EventHandler VisibleChanged;
|
EventHandler VisibleChanged;
|
||||||
@ -36,7 +39,7 @@ namespace XFX
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Initialize()=0;
|
virtual void Initialize()=0;
|
||||||
virtual ~IGameComponent();
|
virtual ~IGameComponent() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -49,7 +52,7 @@ namespace XFX
|
|||||||
virtual void CreateDevice()=0;
|
virtual void CreateDevice()=0;
|
||||||
virtual void EndDraw()=0;
|
virtual void EndDraw()=0;
|
||||||
|
|
||||||
virtual ~IGraphicsDeviceManager();
|
virtual ~IGraphicsDeviceManager() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -63,7 +66,7 @@ namespace XFX
|
|||||||
virtual int UpdateOrder()=0;
|
virtual int UpdateOrder()=0;
|
||||||
virtual void UpdateOrder(int value)=0;
|
virtual void UpdateOrder(int value)=0;
|
||||||
|
|
||||||
virtual ~IUpdateable();
|
virtual ~IUpdateable() {}
|
||||||
virtual void Update(GameTime gameTime)=0;
|
virtual void Update(GameTime gameTime)=0;
|
||||||
|
|
||||||
EventHandler EnabledChanged;
|
EventHandler EnabledChanged;
|
||||||
|
20
include/Media.h
Normal file
20
include/Media.h
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/********************************************************
|
||||||
|
* Media.h *
|
||||||
|
* *
|
||||||
|
* XFX::Media namespace include file *
|
||||||
|
* Copyright © XFX Team. All Rights Reserved *
|
||||||
|
********************************************************/
|
||||||
|
#ifndef _XFX_MEDIA_
|
||||||
|
#define _XFX_MEDIA_
|
||||||
|
|
||||||
|
//
|
||||||
|
//Classes
|
||||||
|
//
|
||||||
|
#include "Media/Video.h"
|
||||||
|
#include "Media/VideoPlayer.h"
|
||||||
|
//
|
||||||
|
//Enums
|
||||||
|
//
|
||||||
|
#include "Media/Enums.h"
|
||||||
|
|
||||||
|
#endif //_XFX_MEDIA_
|
19
include/Net.h
Normal file
19
include/Net.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/********************************************************
|
||||||
|
* Net.h *
|
||||||
|
* *
|
||||||
|
* XFX::Net namespace include file *
|
||||||
|
* Copyright © XFX Team. All Rights Reserved *
|
||||||
|
********************************************************/
|
||||||
|
#ifndef _XFX_NET_
|
||||||
|
#define _XFX_NET_
|
||||||
|
|
||||||
|
//
|
||||||
|
//Classes
|
||||||
|
//
|
||||||
|
#include "Net/NetworkException.h"
|
||||||
|
//
|
||||||
|
//Enums
|
||||||
|
//
|
||||||
|
#include "Net/Enums.h"
|
||||||
|
|
||||||
|
#endif //_XFX_NET_
|
@ -1,9 +1,17 @@
|
|||||||
|
/********************************************************
|
||||||
|
* NetworkException.h *
|
||||||
|
* *
|
||||||
|
* XFX NetworkException definition file *
|
||||||
|
* Copyright © XFX Team. All Rights Reserved *
|
||||||
|
********************************************************/
|
||||||
#ifndef _XFX_NET_NETWORKEXCEPTION_
|
#ifndef _XFX_NET_NETWORKEXCEPTION_
|
||||||
#define _XFX_NET_NETWORKEXCEPTION_
|
#define _XFX_NET_NETWORKEXCEPTION_
|
||||||
|
|
||||||
#include <System/Exception.h>
|
#include <System/Exception.h>
|
||||||
#include "Enums.h"
|
#include "Enums.h"
|
||||||
|
|
||||||
|
using namespace System;
|
||||||
|
|
||||||
namespace XFX
|
namespace XFX
|
||||||
{
|
{
|
||||||
namespace Net
|
namespace Net
|
||||||
@ -11,27 +19,27 @@ namespace XFX
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Thrown if there is a network communication failure.
|
/// Thrown if there is a network communication failure.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class NetworkException : Exception
|
class NetworkException : public Exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
public NetworkException();
|
NetworkException();
|
||||||
public NetworkException(char* message);
|
NetworkException(char* message);
|
||||||
public NetworkException(char* message, Exception innerException);
|
NetworkException(char* message, Exception innerException);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Thrown if an error was encountered while joining a session.
|
/// Thrown if an error was encountered while joining a session.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class NetworkSessionJoinException : NetworkException
|
class NetworkSessionJoinException : public NetworkException
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
public NetworkSessionJoinException();
|
NetworkSessionJoinException();
|
||||||
public NetworkSessionJoinException(char* message);
|
NetworkSessionJoinException(char* message);
|
||||||
public NetworkSessionJoinException(char* message, NetworkSessionJoinError joinError);
|
NetworkSessionJoinException(char* message, NetworkSessionJoinError joinError);
|
||||||
public NetworkSessionJoinException(char* message, Exception innerException);
|
NetworkSessionJoinException(char* message, Exception innerException);
|
||||||
|
|
||||||
public NetworkSessionJoinError JoinError(); //! get
|
NetworkSessionJoinError JoinError(); //! get
|
||||||
public void JoinError(NetworkSessionJoinError joinError); //! set
|
void JoinError(NetworkSessionJoinError joinError); //! set
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,13 +16,15 @@ namespace XFX
|
|||||||
struct Rectangle
|
struct Rectangle
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int Bottom();
|
int Bottom(); //Returns the y-coordinate of the bottom of the rectangle.
|
||||||
int Left();
|
static const Rectangle Empty; //Returns a Rectangle with all of its values set to zero.
|
||||||
int Right();
|
int Left(); //Returns the x-coordinate of the left side of the rectangle.
|
||||||
int Top();
|
int Right(); //Returns the x-coordinate of the right side of the rectangle.
|
||||||
int X, Y;
|
int Top(); //Returns the y-coordinate of the top of the rectangle.
|
||||||
static const Rectangle Empty;
|
int Height; //Specifies the height of the rectangle.
|
||||||
int Width, Height;
|
int Width; //Specifies the width of the rectangle.
|
||||||
|
int X; //Specifies the x-coordinate of the rectangle.
|
||||||
|
int Y; //Specifies the y-coordinate of the rectangle.
|
||||||
|
|
||||||
Rectangle(int x,int y,int width,int height);
|
Rectangle(int x,int y,int width,int height);
|
||||||
Rectangle(const Rectangle &obj);
|
Rectangle(const Rectangle &obj);
|
||||||
@ -43,7 +45,7 @@ namespace XFX
|
|||||||
|
|
||||||
int operator==(const Rectangle other);
|
int operator==(const Rectangle other);
|
||||||
int operator!=(const Rectangle other);
|
int operator!=(const Rectangle other);
|
||||||
Rectangle &operator=(const Rectangle other);
|
Rectangle operator=(const Rectangle other);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
#ifndef _XFX_STORAGE_
|
#ifndef _XFX_STORAGE_
|
||||||
#define _XFX_STORAGE_
|
#define _XFX_STORAGE_
|
||||||
|
|
||||||
#include "StorageContainer.h"
|
#include "Storage/StorageContainer.h"
|
||||||
#include "StorageDevice.h"
|
#include "Storage/StorageDevice.h"
|
||||||
#include "StorageDeviceNotConnectedException.h"
|
#include "Storage/StorageDeviceNotConnectedException.h"
|
||||||
|
|
||||||
#endif //_XFX_STORAGE_
|
#endif //_XFX_STORAGE_
|
||||||
|
@ -23,7 +23,7 @@ namespace XFX
|
|||||||
public:
|
public:
|
||||||
StorageDeviceNotConnectedException();
|
StorageDeviceNotConnectedException();
|
||||||
StorageDeviceNotConnectedException(char* message);
|
StorageDeviceNotConnectedException(char* message);
|
||||||
StorageDeviceNotConnectedException(char* message, Exception innerException);
|
StorageDeviceNotConnectedException(char* message, Exception* innerException);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,11 +8,17 @@
|
|||||||
#ifndef _SYSTEM_ARRAY_
|
#ifndef _SYSTEM_ARRAY_
|
||||||
#define _SYSTEM_ARRAY_
|
#define _SYSTEM_ARRAY_
|
||||||
|
|
||||||
|
#include <System/Collections/Generic/Interfaces.h>
|
||||||
|
|
||||||
|
using namespace System::Collections::Generic;
|
||||||
|
|
||||||
namespace System
|
namespace System
|
||||||
{
|
{
|
||||||
class Array
|
class Array
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
template <class T>
|
||||||
|
static int BinarySearch(T array[], int index, int length, T value, IComparer<T>* comparer);
|
||||||
template <class T>
|
template <class T>
|
||||||
static void Clear(T array[], int index, int length);
|
static void Clear(T array[], int index, int length);
|
||||||
template <class T>
|
template <class T>
|
||||||
|
@ -13,6 +13,7 @@ namespace System
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides a base class for implementations of the System.Collections.Generic.IComparer<T1> generic interface.
|
/// Provides a base class for implementations of the System.Collections.Generic.IComparer<T1> generic interface.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
template <class T>
|
||||||
class Comparer : public IComparer<T>
|
class Comparer : public IComparer<T>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
@ -29,7 +29,7 @@ namespace System
|
|||||||
virtual bool Remove(T item)=0;
|
virtual bool Remove(T item)=0;
|
||||||
|
|
||||||
virtual int Count()=0;
|
virtual int Count()=0;
|
||||||
virtual bool IsReadOnly();
|
virtual bool IsReadOnly() { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -102,7 +102,7 @@ namespace System
|
|||||||
|
|
||||||
virtual T operator[](int index)=0;
|
virtual T operator[](int index)=0;
|
||||||
|
|
||||||
virtual ~IList();
|
virtual ~IList() {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ namespace System
|
|||||||
public:
|
public:
|
||||||
KeyNotFoundException();
|
KeyNotFoundException();
|
||||||
KeyNotFoundException(char* message);
|
KeyNotFoundException(char* message);
|
||||||
KeyNotFoundException(char* message, Exception innerException);
|
KeyNotFoundException(char* message, Exception* innerException);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,8 @@ namespace System
|
|||||||
namespace Generic
|
namespace Generic
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a strongly typed list of objects that can be accessed by index. Provides methods to search, sort, and manipulate lists.
|
/// Represents a strongly typed list of objects that can be accessed by index. Provides methods to search, sort, and
|
||||||
|
/// manipulate lists.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
template <class T>
|
template <class T>
|
||||||
class List : public IList<T>
|
class List : public IList<T>
|
||||||
@ -42,24 +43,23 @@ namespace System
|
|||||||
|
|
||||||
void Add(T item); //Adds an element to the end of the list
|
void Add(T item); //Adds an element to the end of the list
|
||||||
int BinarySearch(T item);
|
int BinarySearch(T item);
|
||||||
int BinarySearch(T item, IComparer<T> comparer);
|
int BinarySearch(T item, IComparer<T>* comparer);
|
||||||
int BinarySearch(int index, int count, T item, IComparer<T> comparer);
|
int BinarySearch(int index, int count, T item, IComparer<T>* comparer);
|
||||||
void Clear(); //Removes all elements from the list
|
void Clear(); //Removes all elements from the list
|
||||||
bool Contains(T item);
|
bool Contains(T item);
|
||||||
void CopyTo(T array[], int arrayIndex);
|
void CopyTo(T array[], int arrayIndex);
|
||||||
int First(); //Goes to the first element in the list
|
int First(); //Goes to the first element in the list
|
||||||
int First(out T item); //Goes to the first element returns the value
|
int First(out T item); //Goes to the first element returns the value
|
||||||
void ForEach(char* action); //Executes the specified action on each element in the list
|
|
||||||
int IndexOf(T item);
|
int IndexOf(T item);
|
||||||
void Insert(int index, T item);
|
void Insert(int index, T item);
|
||||||
int Next(); //Goes to next element in the list
|
int Next(); //Goes to next element in the list
|
||||||
int Next(out T item); //Goes to next element and writes the element in parameter
|
int Next(out T item); //Goes to next element and writes the element in parameter
|
||||||
int Change(const T newElem); //changes the current element
|
int Change(const T newElem); //changes the current element
|
||||||
bool Remove(T item); //Removes current element
|
bool Remove(T item); //Removes current element
|
||||||
void RemoveAt(int index);
|
void RemoveAt(int index); //Removes the element at the specified index
|
||||||
void RemoveRange(int index, int count);
|
void RemoveRange(int index, int count); //Removes all elements in the specified range
|
||||||
void Reverse();
|
void Reverse(); //Reverses the items in the list
|
||||||
void Reverse(int index, int count);
|
void Reverse(int index, int count); //Reverses the items in the specified range
|
||||||
T *ToArray();
|
T *ToArray();
|
||||||
void TrimExcess();
|
void TrimExcess();
|
||||||
|
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
#ifndef _SYSTEM_EXCEPTION_
|
#ifndef _SYSTEM_EXCEPTION_
|
||||||
#define _SYSTEM_EXCEPTION_
|
#define _SYSTEM_EXCEPTION_
|
||||||
|
|
||||||
|
#include <System/Object.h>
|
||||||
|
|
||||||
namespace System
|
namespace System
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -21,14 +23,15 @@ namespace System
|
|||||||
char* _message;
|
char* _message;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Exception InnerException();
|
Exception* InnerException();
|
||||||
virtual char* Message();
|
virtual char* Message();
|
||||||
|
|
||||||
Exception();
|
Exception();
|
||||||
Exception(char* message);
|
Exception(char* message);
|
||||||
|
Exception(char* message, Exception* innerException);
|
||||||
virtual ~Exception();
|
virtual ~Exception();
|
||||||
|
|
||||||
virtual Exception GetBaseException();
|
virtual Exception* GetBaseException();
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -39,7 +42,7 @@ namespace System
|
|||||||
public:
|
public:
|
||||||
ApplicationException();
|
ApplicationException();
|
||||||
ApplicationException(char* message);
|
ApplicationException(char* message);
|
||||||
~ApplicationException();
|
ApplicationException(char* message, Exception* innerException);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -50,7 +53,7 @@ namespace System
|
|||||||
public:
|
public:
|
||||||
ArithmeticException();
|
ArithmeticException();
|
||||||
ArithmeticException(char* message);
|
ArithmeticException(char* message);
|
||||||
~ArithmeticException();
|
ArithmeticException(char* message, Exception* innerException);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -61,7 +64,7 @@ namespace System
|
|||||||
public:
|
public:
|
||||||
DivideByZeroException();
|
DivideByZeroException();
|
||||||
DivideByZeroException(char* message);
|
DivideByZeroException(char* message);
|
||||||
~DivideByZeroException();
|
DivideByZeroException(char* message, Exception* innerException);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -72,7 +75,7 @@ namespace System
|
|||||||
public:
|
public:
|
||||||
SystemException();
|
SystemException();
|
||||||
SystemException(char* message);
|
SystemException(char* message);
|
||||||
SystemException(char* message, Exception innerException);
|
SystemException(char* message, Exception* innerException);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -83,7 +86,7 @@ namespace System
|
|||||||
public:
|
public:
|
||||||
AccessViolationException();
|
AccessViolationException();
|
||||||
AccessViolationException(char* message);
|
AccessViolationException(char* message);
|
||||||
AccessViolationException(char* message, Exception innerException);
|
AccessViolationException(char* message, Exception* innerException);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -94,6 +97,7 @@ namespace System
|
|||||||
public:
|
public:
|
||||||
AppDomainUnloadedException();
|
AppDomainUnloadedException();
|
||||||
AppDomainUnloadedException(char* message);
|
AppDomainUnloadedException(char* message);
|
||||||
|
AppDomainUnloadedException(char* message, Exception* innerException);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -110,7 +114,9 @@ namespace System
|
|||||||
|
|
||||||
ArgumentException();
|
ArgumentException();
|
||||||
ArgumentException(char* message);
|
ArgumentException(char* message);
|
||||||
|
ArgumentException(char* message, Exception* innerException);
|
||||||
ArgumentException(char* message, char* paramName);
|
ArgumentException(char* message, char* paramName);
|
||||||
|
ArgumentException(char* message, char* paramName, Exception* innerException);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -123,6 +129,7 @@ namespace System
|
|||||||
ArgumentNullException();
|
ArgumentNullException();
|
||||||
ArgumentNullException(char* paramName);
|
ArgumentNullException(char* paramName);
|
||||||
ArgumentNullException(char* paramName, char* message);
|
ArgumentNullException(char* paramName, char* message);
|
||||||
|
ArgumentNullException(char* message, Exception* innerException);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -131,14 +138,19 @@ namespace System
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
class ArgumentOutOfRangeException : public ArgumentException
|
class ArgumentOutOfRangeException : public ArgumentException
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
static char* _rangeMessage;
|
||||||
|
Object* _actualValue;
|
||||||
|
static char* RangeMessage();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ArgumentOutOfRangeException();
|
ArgumentOutOfRangeException();
|
||||||
ArgumentOutOfRangeException(char* paramName);
|
ArgumentOutOfRangeException(char* paramName);
|
||||||
ArgumentOutOfRangeException(char* paramName, void* object, char* message);
|
ArgumentOutOfRangeException(char* message, Exception* innerException);
|
||||||
ArgumentOutOfRangeException(char* paramName, char* message);
|
ArgumentOutOfRangeException(char* paramName, char* message);
|
||||||
|
ArgumentOutOfRangeException(char* paramName, Object* actualValue, char* message);
|
||||||
|
|
||||||
virtual void *ActualValue();
|
virtual Object* ActualValue();
|
||||||
char* Message();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -160,7 +172,7 @@ namespace System
|
|||||||
public:
|
public:
|
||||||
InvalidOperationException();
|
InvalidOperationException();
|
||||||
InvalidOperationException(char* message);
|
InvalidOperationException(char* message);
|
||||||
InvalidOperationException(char* message, Exception inner);
|
InvalidOperationException(char* message, Exception* innerException);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -171,7 +183,7 @@ namespace System
|
|||||||
public:
|
public:
|
||||||
NotImplementedException();
|
NotImplementedException();
|
||||||
NotImplementedException(char* message);
|
NotImplementedException(char* message);
|
||||||
NotImplementedException(char* message, Exception innerException);
|
NotImplementedException(char* message, Exception* innerException);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -205,11 +217,13 @@ namespace System
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
char* _objectName;
|
char* _objectName;
|
||||||
|
ObjectDisposedException();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
char* ObjectName();
|
char* ObjectName();
|
||||||
|
|
||||||
ObjectDisposedException(char* objectName);
|
ObjectDisposedException(char* objectName);
|
||||||
|
ObjectDisposedException(char* message, Exception* innerException);
|
||||||
ObjectDisposedException(char* objectName, char* message);
|
ObjectDisposedException(char* objectName, char* message);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
/********************************************************
|
||||||
|
* Interfaces.h *
|
||||||
|
* *
|
||||||
|
* System namespace interfaces definition file *
|
||||||
|
* Copyright © XFX Team. All Rights Reserved *
|
||||||
|
********************************************************/
|
||||||
#ifndef _SYSTEM_INTERFACES_
|
#ifndef _SYSTEM_INTERFACES_
|
||||||
#define _SYSTEM_INTERFACES_
|
#define _SYSTEM_INTERFACES_
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
* XFX ExternalException definition *
|
* XFX ExternalException definition *
|
||||||
* Copyright © XFX Team. All Rights Reserved *
|
* Copyright © XFX Team. All Rights Reserved *
|
||||||
********************************************************/
|
********************************************************/
|
||||||
#ifndef _SYSTEM_RUNTIME_INTEROPSERVICES_
|
#ifndef _SYSTEM_RUNTIME_INTEROPSERVICES_ExternalException_
|
||||||
#define _SYSTEM_RUNTIME_INTEROPSERVICES_
|
#define _SYSTEM_RUNTIME_INTEROPSERVICES_ExternalException_
|
||||||
|
|
||||||
#include <System/Exception.h>
|
#include <System/Exception.h>
|
||||||
|
|
||||||
@ -23,10 +23,10 @@ namespace System
|
|||||||
public:
|
public:
|
||||||
ExternalException();
|
ExternalException();
|
||||||
ExternalException(char* message);
|
ExternalException(char* message);
|
||||||
ExternalException(char* message, Exception inner);
|
ExternalException(char* message, Exception* inner);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //_SYSTEM_RUNTIME_INTEROPSERVICES_
|
#endif //_SYSTEM_RUNTIME_INTEROPSERVICES_ExternalException_
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
* XFX namespace include file for libXFX.Game.a *
|
* XFX namespace include file for libXFX.Game.a *
|
||||||
* Copyright © XFX Team. All Rights Reserved *
|
* Copyright © XFX Team. All Rights Reserved *
|
||||||
********************************************************/
|
********************************************************/
|
||||||
#ifndef _XFX_GAME_
|
#ifndef _XFX__GAME_
|
||||||
#define _XFX_GAME_
|
#define _XFX__GAME_
|
||||||
|
|
||||||
//
|
//
|
||||||
//Data Types
|
//Data Types
|
||||||
//
|
//
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "GamerServicesComponent.h"
|
#include "GamerServices/GamerServicesComponent.h"
|
||||||
#include "GameComponentCollection.h"
|
#include "GameComponentCollection.h"
|
||||||
#include "GameServiceContainer.h"
|
#include "GameServiceContainer.h"
|
||||||
#include "GameTime.h"
|
#include "GameTime.h"
|
||||||
|
@ -22,22 +22,9 @@
|
|||||||
#include "Vector2.h"
|
#include "Vector2.h"
|
||||||
#include "Vector3.h"
|
#include "Vector3.h"
|
||||||
#include "Vector4.h"
|
#include "Vector4.h"
|
||||||
|
//
|
||||||
|
//Enums
|
||||||
|
//
|
||||||
#include "Enums.h"
|
#include "Enums.h"
|
||||||
|
|
||||||
//
|
|
||||||
//Interfaces
|
|
||||||
//
|
|
||||||
#include "IDrawable.h"
|
|
||||||
#include "IGameComponent.h"
|
|
||||||
#include "IGraphicsDeviceManager.h"
|
|
||||||
#include "IUpdateable.h"
|
|
||||||
|
|
||||||
//
|
|
||||||
//Namespaces
|
|
||||||
//
|
|
||||||
#include "Audio.h"
|
|
||||||
#include "Graphics.h"
|
|
||||||
#include "Media.h"
|
|
||||||
|
|
||||||
#endif //_XFX_
|
#endif //_XFX_
|
||||||
|
@ -25,12 +25,15 @@
|
|||||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
// POSSIBILITY OF SUCH DAMAGE.
|
// POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
extern "C" {
|
extern "C"
|
||||||
|
{
|
||||||
#include <hal/input.h>
|
#include <hal/input.h>
|
||||||
#include <hal/xbox.h>
|
#include <hal/xbox.h>
|
||||||
}
|
}
|
||||||
|
#include "../libXFX/pbKit.h"
|
||||||
|
|
||||||
#include <Game.h>
|
#include <Game.h>
|
||||||
|
#include <System/Collections/Generic/List.h>
|
||||||
|
|
||||||
namespace XFX
|
namespace XFX
|
||||||
{
|
{
|
||||||
@ -78,6 +81,10 @@ namespace XFX
|
|||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Game::BeginRun()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
bool Game::BeginDraw()
|
bool Game::BeginDraw()
|
||||||
{
|
{
|
||||||
return graphicsManager->BeginDraw();
|
return graphicsManager->BeginDraw();
|
||||||
@ -100,7 +107,7 @@ namespace XFX
|
|||||||
{
|
{
|
||||||
IDisposable disposable = component as IDisposable;
|
IDisposable disposable = component as IDisposable;
|
||||||
if (disposable != null)
|
if (disposable != null)
|
||||||
disposable.Dispose();
|
disposable->Dispose();
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
@ -132,6 +139,10 @@ namespace XFX
|
|||||||
if(graphicsManager != null)
|
if(graphicsManager != null)
|
||||||
graphicsManager->EndDraw();
|
graphicsManager->EndDraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Game::EndRun()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void Game::Exit()
|
void Game::Exit()
|
||||||
{
|
{
|
||||||
@ -154,6 +165,10 @@ namespace XFX
|
|||||||
LoadContent();
|
LoadContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Game::LoadContent()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void Game::OnActivated(Object* sender, EventArgs args)
|
void Game::OnActivated(Object* sender, EventArgs args)
|
||||||
{
|
{
|
||||||
if (Activated != null)
|
if (Activated != null)
|
||||||
@ -197,11 +212,19 @@ namespace XFX
|
|||||||
|
|
||||||
if(BeginDraw())
|
if(BeginDraw())
|
||||||
{
|
{
|
||||||
|
pb_reset();
|
||||||
|
pb_erase_depth_stencil_buffer(0, 0, 640, 480);
|
||||||
|
|
||||||
Draw(gameTime);
|
Draw(gameTime);
|
||||||
|
|
||||||
EndDraw();
|
EndDraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Game::UnloadContent()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void Game::Update(GameTime gameTime)
|
void Game::Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
/*for (int i = 0; i < this.updateableComponents.Count; i++)
|
/*for (int i = 0; i < this.updateableComponents.Count; i++)
|
||||||
|
24
src/libXFX.Game/GameComponentCollection.cpp
Normal file
24
src/libXFX.Game/GameComponentCollection.cpp
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#include <GameComponentCollection.h>
|
||||||
|
|
||||||
|
namespace XFX
|
||||||
|
{
|
||||||
|
GameComponentCollection::GameComponentCollection()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameComponentCollection::ClearItems()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameComponentCollection::InsertItem(int index, IGameComponent* item)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameComponentCollection::RemoveItem(int index)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameComponentCollection::SetItem(int index, IGameComponent* item)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
20
src/libXFX.Game/GameServiceContainer.cpp
Normal file
20
src/libXFX.Game/GameServiceContainer.cpp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#include <GameServiceContainer.h>
|
||||||
|
|
||||||
|
namespace XFX
|
||||||
|
{
|
||||||
|
GameServiceContainer::GameServiceContainer()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameServiceContainer::AddService(Object* provider)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Object* GetService(Object* ServiceType)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void RemoceService(Object* type)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -26,7 +26,10 @@
|
|||||||
// POSSIBILITY OF SUCH DAMAGE.
|
// POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <GraphicsDeviceManager.h>
|
#include <GraphicsDeviceManager.h>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
#include "../libXFX/pbKit.h"
|
#include "../libXFX/pbKit.h"
|
||||||
|
}
|
||||||
|
|
||||||
namespace XFX
|
namespace XFX
|
||||||
{
|
{
|
||||||
@ -35,13 +38,32 @@ namespace XFX
|
|||||||
const DeviceType_t GraphicsDeviceManager::ValidDeviceTypes[] = { DeviceType::Hardware };
|
const DeviceType_t GraphicsDeviceManager::ValidDeviceTypes[] = { DeviceType::Hardware };
|
||||||
SurfaceFormat_t GraphicsDeviceManager::ValidAdapterFormats[] = { SurfaceFormat::Bgr32, SurfaceFormat::Bgr555, SurfaceFormat::Bgr565, SurfaceFormat::Bgra1010102 };
|
SurfaceFormat_t GraphicsDeviceManager::ValidAdapterFormats[] = { SurfaceFormat::Bgr32, SurfaceFormat::Bgr555, SurfaceFormat::Bgr565, SurfaceFormat::Bgra1010102 };
|
||||||
SurfaceFormat_t GraphicsDeviceManager::ValidBackBufferFormats[] = { SurfaceFormat::Bgr565, SurfaceFormat::Bgr555, SurfaceFormat::Bgra5551, SurfaceFormat::Bgr32, SurfaceFormat::Color, SurfaceFormat::Bgra1010102 };
|
SurfaceFormat_t GraphicsDeviceManager::ValidBackBufferFormats[] = { SurfaceFormat::Bgr565, SurfaceFormat::Bgr555, SurfaceFormat::Bgra5551, SurfaceFormat::Bgr32, SurfaceFormat::Color, SurfaceFormat::Bgra1010102 };
|
||||||
|
|
||||||
|
GraphicsDeviceManager::GraphicsDeviceManager()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
GraphicsDeviceManager::GraphicsDeviceManager(Game game)
|
||||||
|
{
|
||||||
|
SynchronizeWithVerticalRetrace = true;
|
||||||
|
backBufferFormat = SurfaceFormat::Color;
|
||||||
|
backBufferHeight = DefaultBackBufferHeight;
|
||||||
|
backBufferWidth = DefaultBackBufferWidth;
|
||||||
|
minimumVertexShaderProfile = ShaderProfile::XVS_1_1;
|
||||||
|
_game = game;
|
||||||
|
/*
|
||||||
|
if (game.Services().GetService((Object*)IGraphicsDeviceManager) != null)
|
||||||
|
throw ArgumentException("A graphics device manager is already registered. The graphics device manager cannot be changed once it is set.");*/
|
||||||
|
|
||||||
|
game.Services().AddService(this);
|
||||||
|
}
|
||||||
|
|
||||||
GraphicsDevice GraphicsDeviceManager::GraphicsDevice_()
|
GraphicsDevice GraphicsDeviceManager::GraphicsDevice_()
|
||||||
{
|
{
|
||||||
return graphicsDevice;
|
return graphicsDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsFullScreen()
|
bool GraphicsDeviceManager::IsFullScreen()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -51,6 +73,13 @@ namespace XFX
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GraphicsDeviceManager::BeginDraw()
|
||||||
|
{
|
||||||
|
pb_reset();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool GraphicsDeviceManager::CanResetDevice(GraphicsDeviceInformation newDeviceInfo)
|
bool GraphicsDeviceManager::CanResetDevice(GraphicsDeviceInformation newDeviceInfo)
|
||||||
{
|
{
|
||||||
if (graphicsDevice.CreationParameters().DeviceType_() != newDeviceInfo.DeviceType_)
|
if (graphicsDevice.CreationParameters().DeviceType_() != newDeviceInfo.DeviceType_)
|
||||||
@ -60,15 +89,32 @@ namespace XFX
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
GraphicsDeviceManager::GraphicsDeviceManager(Game game)
|
void GraphicsDeviceManager::CreateDevice()
|
||||||
{
|
{
|
||||||
_game = game;
|
switch(pb_init())
|
||||||
/*
|
{
|
||||||
if (game.Services().GetService((Object*)IGraphicsDeviceManager) != null)
|
default:
|
||||||
throw ArgumentException("A graphics device manager is already registered. The graphics device manager cannot be changed once it is set.");*/
|
OnDeviceCreated(this, EventArgs::Empty);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
game.Services().AddService((Object*)this);
|
void GraphicsDeviceManager::Dispose()
|
||||||
game.Services().AddService((Object*)this);
|
{
|
||||||
|
Dispose(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphicsDeviceManager::Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphicsDeviceManager::EndDraw()
|
||||||
|
{
|
||||||
|
pb_wait_for_vbl();
|
||||||
|
pb_finished();
|
||||||
}
|
}
|
||||||
|
|
||||||
GraphicsDeviceInformation GraphicsDeviceManager::FindBestDevice(bool anySuitableDevice)
|
GraphicsDeviceInformation GraphicsDeviceManager::FindBestDevice(bool anySuitableDevice)
|
||||||
@ -125,14 +171,4 @@ namespace XFX
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IGraphicsDeviceManager::BeginDraw()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IGraphicsDeviceManager::EndDraw()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -128,6 +128,14 @@
|
|||||||
RelativePath=".\GameComponent.cpp"
|
RelativePath=".\GameComponent.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\GameComponentCollection.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\GameServiceContainer.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\GameTime.cpp"
|
RelativePath=".\GameTime.cpp"
|
||||||
>
|
>
|
||||||
@ -136,6 +144,10 @@
|
|||||||
RelativePath=".\GraphicsDeviceManager.cpp"
|
RelativePath=".\GraphicsDeviceManager.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\makefile"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<Filter
|
<Filter
|
||||||
Name="GamerServices"
|
Name="GamerServices"
|
||||||
>
|
>
|
||||||
@ -178,6 +190,10 @@
|
|||||||
RelativePath="..\..\include\Interfaces.h"
|
RelativePath="..\..\include\Interfaces.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\include\XFX.Game.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<Filter
|
<Filter
|
||||||
Name="GamerServices"
|
Name="GamerServices"
|
||||||
>
|
>
|
||||||
@ -187,10 +203,6 @@
|
|||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
</Filter>
|
</Filter>
|
||||||
<File
|
|
||||||
RelativePath=".\makefile"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
</Globals>
|
</Globals>
|
||||||
|
@ -25,9 +25,9 @@ ENTRYPOINT = -Wl,--entry,_WinMainCRTStartup
|
|||||||
STRIP = -Wl,--strip-all
|
STRIP = -Wl,--strip-all
|
||||||
LD_FLAGS = $(CLINK) $(ALIGN) $(SHARED) $(ENTRYPOINT) $(STRIP)
|
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 -lstdc++ -lgcc
|
LD_LIBS = $(LD_DIRS) -lmscorlib -lXFX -lm -lopenxdk -lhal -lc -lusb -lc -lxboxkrnl -lc -lhal -lxboxkrnl -lhal -lopenxdk -lc -lstdc++ -lgcc
|
||||||
|
|
||||||
OBJS = DrawableGameComponent.o Game.o GameComponent.o GamerServicesComponent.o GameTime.o GraphicsDeviceManager.o
|
OBJS = DrawableGameComponent.o Game.o GameComponent.o GameComponentCollection.o GameServiceContainer.o GamerServicesComponent.o GameTime.o GraphicsDeviceManager.o
|
||||||
|
|
||||||
all: libXFX.Game.a
|
all: libXFX.Game.a
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ namespace XFX
|
|||||||
{
|
{
|
||||||
DepthStencilBuffer()
|
DepthStencilBuffer()
|
||||||
{
|
{
|
||||||
|
_graphicsDevice = null;
|
||||||
_width = 0;
|
_width = 0;
|
||||||
_height = 0;
|
_height = 0;
|
||||||
_format = DepthFormat::Unknown;
|
_format = DepthFormat::Unknown;
|
||||||
@ -13,8 +14,9 @@ namespace XFX
|
|||||||
isDisposed = false;
|
isDisposed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
DepthStencilBuffer::DepthStencilBuffer(GraphicsDevice &graphicsDevice, int width, int height, DepthFormat_t format)
|
DepthStencilBuffer::DepthStencilBuffer(GraphicsDevice* graphicsDevice, int width, int height, DepthFormat_t format)
|
||||||
{
|
{
|
||||||
|
_graphicsDevice = graphiceDevice;
|
||||||
_width = width;
|
_width = width;
|
||||||
_height = height;
|
_height = height;
|
||||||
_format = format;
|
_format = format;
|
||||||
@ -22,26 +24,42 @@ namespace XFX
|
|||||||
isDisposed = false;
|
isDisposed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
DepthStencilBuffer(GraphicsDevice &graphicsDevice, int width, int height, DepthFormat_t format, MultiSampleType_t multiSampleType, int multiSampleQuality)
|
DepthStencilBuffer::DepthStencilBuffer(GraphicsDevice* graphicsDevice, int width, int height, DepthFormat_t format, MultiSampleType_t multiSampleType, int multiSampleQuality)
|
||||||
{
|
{
|
||||||
|
_graphicsDevice = graphiceDevice;
|
||||||
_width = width;
|
_width = width;
|
||||||
_height = height;
|
_height = height;
|
||||||
_format = format;
|
_format = format;
|
||||||
_multiSampleType = multiSampleType;
|
_multiSampleType = multiSampleType;
|
||||||
isDisposed = false;
|
isDisposed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DepthStencilBuffer::DepthStencilBuffer(const DepthStencilBuffer &obj)
|
||||||
|
{
|
||||||
|
_graphicsDevice = obj._graphicsDevice;
|
||||||
|
_width = obj._width;
|
||||||
|
_height = obj._height;
|
||||||
|
_format = obj._format;
|
||||||
|
_multiSampleType = obj._multiSampleType;
|
||||||
|
isDisposed = obj.isDisposed;
|
||||||
|
}
|
||||||
|
|
||||||
|
DepthStencilBuffer::~DepthStencilBuffer()
|
||||||
|
{
|
||||||
|
Dispose(false);
|
||||||
|
}
|
||||||
|
|
||||||
DepthFormat_t DepthStencilBuffer::Format()
|
DepthFormat_t DepthStencilBuffer::Format()
|
||||||
{
|
{
|
||||||
return _format;
|
return _format;
|
||||||
}
|
}
|
||||||
|
|
||||||
GraphicsDevice DepthStencilBuffer::GraphicsDevice_()
|
GraphicsDevice* DepthStencilBuffer::GraphicsDevice_()
|
||||||
{
|
{
|
||||||
return _graphicsDevice;
|
return _graphicsDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DepthStencilBuffer::IsDisposed()
|
bool DepthStencilBuffer::IsDisposed()
|
||||||
{
|
{
|
||||||
return isDisposed();
|
return isDisposed();
|
||||||
}
|
}
|
||||||
@ -61,7 +79,7 @@ namespace XFX
|
|||||||
Dispose(true);
|
Dispose(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DepthStencilBuffer::Dispose(int __p1)
|
void DepthStencilBuffer::Dispose(bool __p1)
|
||||||
{
|
{
|
||||||
if(__p1)
|
if(__p1)
|
||||||
{
|
{
|
||||||
|
36
src/libXFX/Effect.cpp
Normal file
36
src/libXFX/Effect.cpp
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
// Copyright (C) 2010-2012, XFX Team
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer in the
|
||||||
|
// documentation and/or other materials provided with the distribution.
|
||||||
|
// * Neither the name of the copyright holder nor the names of any
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
// POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
#include <Graphics/Effect.h>
|
||||||
|
|
||||||
|
namespace XFX
|
||||||
|
{
|
||||||
|
namespace Graphics
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -25,14 +25,22 @@
|
|||||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
// POSSIBILITY OF SUCH DAMAGE.
|
// POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "pbKit.h"
|
|
||||||
#include <Graphics/GraphicsAdapter.h>
|
#include <Graphics/GraphicsAdapter.h>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include "pbKit.h"
|
||||||
#include <hal/video.h>
|
#include <hal/video.h>
|
||||||
|
}
|
||||||
|
|
||||||
namespace XFX
|
namespace XFX
|
||||||
{
|
{
|
||||||
namespace Graphics
|
namespace Graphics
|
||||||
{
|
{
|
||||||
|
GraphicsAdapter::~GraphicsAdapter()
|
||||||
|
{
|
||||||
|
Dispose(false);
|
||||||
|
}
|
||||||
|
|
||||||
char* GraphicsAdapter::Description()
|
char* GraphicsAdapter::Description()
|
||||||
{
|
{
|
||||||
//TODO: Come up with a device description
|
//TODO: Come up with a device description
|
||||||
@ -71,8 +79,37 @@ namespace XFX
|
|||||||
|
|
||||||
bool GraphicsAdapter::IsWideScreen()
|
bool GraphicsAdapter::IsWideScreen()
|
||||||
{
|
{
|
||||||
|
//TODO: Get WideScreen setting from EEPROM
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GraphicsAdapter::CheckDepthStencilMatch(DeviceType_t deviceType, SurfaceFormat_t adapterFormat, SurfaceFormat_t renderTargetFormat, DepthFormat_t depthStencilFormat)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GraphicsAdapter::CheckDeviceFormat(DeviceType_t deviceType, SurfaceFormat_t adapterFormat, TextureUsage_t usage, QueryUsages_t queryUsages, ResourceType_t resourceType, SurfaceFormat_t checkFormat)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GraphicsAdapter::CheckDeviceFormat(DeviceType_t deviceType, SurfaceFormat_t adapterFormat, TextureUsage_t usage, QueryUsages_t queryUsages, ResourceType_t resourceType, DepthFormat_t checkFormat)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GraphicsAdapter::CheckDeviceFormatConversion(DeviceType_t deviceType, SurfaceFormat_t sourceFormat, SurfaceFormat_t targetFormat)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GraphicsAdapter::CheckDeviceMultiSampleType(DeviceType_t deviceType, SurfaceFormat_t surfaceFormat, bool isFullScreen, MultiSampleType_t sampleType)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GraphicsAdapter::CheckDeviceMultiSampleType(DeviceType_t deviceType, SurfaceFormat_t surfaceFormat, bool isFullScreen, MultiSampleType_t sampleType, out int qualityLevels)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GraphicsAdapter::CheckDeviceType(DeviceType_t deviceType, SurfaceFormat_t displayFormat, SurfaceFormat_t backBufferFormat, bool isFullScreen)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
DisplayMode GraphicsAdapter::CurrentDisplayMode()
|
DisplayMode GraphicsAdapter::CurrentDisplayMode()
|
||||||
{
|
{
|
||||||
@ -93,15 +130,33 @@ namespace XFX
|
|||||||
}
|
}
|
||||||
return disp;
|
return disp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphicsAdapter::Dispose()
|
||||||
|
{
|
||||||
|
Dispose(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphicsAdapter::Dispose(bool __p1)
|
||||||
|
{
|
||||||
|
if (__p1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GraphicsAdapter::Equals(const GraphicsAdapter obj)
|
||||||
|
{
|
||||||
|
// There's for now only one GraphicsAdapter instance, so just return true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool GraphicsAdapter::IsDeviceTypeAvailable(DeviceType_t deviceType)
|
bool GraphicsAdapter::IsDeviceTypeAvailable(DeviceType_t deviceType)
|
||||||
{
|
{
|
||||||
switch(deviceType)
|
switch(deviceType)
|
||||||
{
|
{
|
||||||
case DeviceType::Hardware: return true;
|
case DeviceType::Hardware: return true;
|
||||||
case DeviceType::NullReference: return false;
|
case DeviceType::NullReference: return false;
|
||||||
case DeviceType::Reference: return false;
|
case DeviceType::Reference: return false;
|
||||||
default: return false;
|
default: return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,5 +166,15 @@ namespace XFX
|
|||||||
|
|
||||||
return collection;
|
return collection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GraphicsAdapter::operator!=(const GraphicsAdapter other)
|
||||||
|
{
|
||||||
|
return !Equals(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GraphicsAdapter::operator==(const GraphicsAdapter other)
|
||||||
|
{
|
||||||
|
return Equals(other);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,9 @@
|
|||||||
#include <Graphics/GraphicsDevice.h>
|
#include <Graphics/GraphicsDevice.h>
|
||||||
#include <Matrix.h>
|
#include <Matrix.h>
|
||||||
#include <Quaternion.h>
|
#include <Quaternion.h>
|
||||||
|
#include <Rectangle.h>
|
||||||
|
#include <Vector2.h>
|
||||||
|
#include <Vector4.h>
|
||||||
|
|
||||||
#include "pbKit.h"
|
#include "pbKit.h"
|
||||||
|
|
||||||
@ -143,5 +146,10 @@ namespace XFX
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphicsDevice::SetVertexShaderConstant(int startRegister, Vector4 constantData)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,17 +32,17 @@ namespace XFX
|
|||||||
namespace Graphics
|
namespace Graphics
|
||||||
{
|
{
|
||||||
const int PresentationParameters::DefaultPresentRate = 60;
|
const int PresentationParameters::DefaultPresentRate = 60;
|
||||||
|
|
||||||
PresentationParameters::~PresentationParameters()
|
|
||||||
{
|
|
||||||
Dispose(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
PresentationParameters::PresentationParameters()
|
PresentationParameters::PresentationParameters()
|
||||||
{
|
{
|
||||||
disposed = false;
|
disposed = false;
|
||||||
Clear();
|
Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PresentationParameters::~PresentationParameters()
|
||||||
|
{
|
||||||
|
Dispose(false);
|
||||||
|
}
|
||||||
|
|
||||||
void PresentationParameters::Clear()
|
void PresentationParameters::Clear()
|
||||||
{
|
{
|
||||||
@ -92,7 +92,7 @@ namespace XFX
|
|||||||
Dispose(true);
|
Dispose(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PresentationParameters::Dispose(int disposing)
|
void PresentationParameters::Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (!disposed)
|
if (!disposed)
|
||||||
{
|
{
|
||||||
@ -105,7 +105,7 @@ namespace XFX
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int PresentationParameters::Equals(PresentationParameters &other)
|
bool PresentationParameters::Equals(const PresentationParameters other)
|
||||||
{
|
{
|
||||||
return ((other.AutoDepthStencilFormat == AutoDepthStencilFormat) &&
|
return ((other.AutoDepthStencilFormat == AutoDepthStencilFormat) &&
|
||||||
(other.BackBufferCount == BackBufferCount) &&
|
(other.BackBufferCount == BackBufferCount) &&
|
||||||
@ -126,12 +126,12 @@ namespace XFX
|
|||||||
(other.SwapEffect_ == SwapEffect_));
|
(other.SwapEffect_ == SwapEffect_));
|
||||||
}
|
}
|
||||||
|
|
||||||
int PresentationParameters::operator!=(PresentationParameters &other)
|
bool PresentationParameters::operator!=(const PresentationParameters other)
|
||||||
{
|
{
|
||||||
return !Equals(other);
|
return !Equals(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
int PresentationParameters::operator==(PresentationParameters &other)
|
bool PresentationParameters::operator==(const PresentationParameters other)
|
||||||
{
|
{
|
||||||
return Equals(other);
|
return Equals(other);
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ namespace XFX
|
|||||||
return !Equals(other);
|
return !Equals(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle &Rectangle::operator=(const Rectangle other)
|
Rectangle Rectangle::operator=(const Rectangle other)
|
||||||
{
|
{
|
||||||
X = other.X;
|
X = other.X;
|
||||||
Y = other.Y;
|
Y = other.Y;
|
||||||
|
86
src/libXFX/Sprite.cpp
Normal file
86
src/libXFX/Sprite.cpp
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
// Copyright (C) 2010-2012, XFX Team
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer in the
|
||||||
|
// documentation and/or other materials provided with the distribution.
|
||||||
|
// * Neither the name of the copyright holder nor the names of any
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
// POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
#include <Graphics/Sprite.h>
|
||||||
|
|
||||||
|
namespace XFX
|
||||||
|
{
|
||||||
|
namespace Graphics
|
||||||
|
{
|
||||||
|
Sprite::Sprite(Texture2D texture, Rectangle sourceRectangle, Rectangle destinationRectangle, Color color, float rotation, Vector2 origin, SpriteEffects_t effects, float layerDepth)
|
||||||
|
{
|
||||||
|
this->texture = texture;
|
||||||
|
this->sourceRectangle = sourceRectangle;
|
||||||
|
this->destinationRectangle = destinationRectangle;
|
||||||
|
this->color = color;
|
||||||
|
this->rotation = rotation;
|
||||||
|
this->origin = origin;
|
||||||
|
this->effects = effects;
|
||||||
|
this->layerDepth = layerDepth;
|
||||||
|
}
|
||||||
|
|
||||||
|
Texture2D Sprite::Texture()
|
||||||
|
{
|
||||||
|
return texture;
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle Sprite::SourceRectangle()
|
||||||
|
{
|
||||||
|
return sourceRectangle;
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle Sprite::DestinationRectangle()
|
||||||
|
{
|
||||||
|
return destinationRectangle;
|
||||||
|
}
|
||||||
|
|
||||||
|
Color Sprite::Color_()
|
||||||
|
{
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
float Sprite::Rotation()
|
||||||
|
{
|
||||||
|
return rotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector2 Sprite::Origin()
|
||||||
|
{
|
||||||
|
return origin;
|
||||||
|
}
|
||||||
|
|
||||||
|
SpriteEffects_t Sprite::Effects()
|
||||||
|
{
|
||||||
|
return effects;
|
||||||
|
}
|
||||||
|
|
||||||
|
float Sprite::LayerDepth()
|
||||||
|
{
|
||||||
|
return layerDepth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -25,14 +25,19 @@
|
|||||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
// POSSIBILITY OF SUCH DAMAGE.
|
// POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include "pbkit.h"
|
||||||
|
}
|
||||||
#include <Graphics/Color.h>
|
#include <Graphics/Color.h>
|
||||||
#include <Graphics/Sprite.h>
|
#include <Graphics/Sprite.h>
|
||||||
#include <Graphics/SpriteBatch.h>
|
#include <Graphics/SpriteBatch.h>
|
||||||
#include <Graphics/SpriteFont.h>
|
#include <Graphics/SpriteFont.h>
|
||||||
#include <Graphics/Texture2D.h>
|
#include <Graphics/Texture2D.h>
|
||||||
|
#include <MathHelper.h>
|
||||||
#include <Matrix.h>
|
#include <Matrix.h>
|
||||||
#include <Rectangle.h>
|
#include <Rectangle.h>
|
||||||
#include <Vector2.h>
|
#include <Vector2.h>
|
||||||
|
#include <Vector4.h>
|
||||||
|
|
||||||
using namespace XFX;
|
using namespace XFX;
|
||||||
|
|
||||||
@ -40,64 +45,72 @@ namespace XFX
|
|||||||
{
|
{
|
||||||
namespace Graphics
|
namespace Graphics
|
||||||
{
|
{
|
||||||
SpriteBatch::GraphicsDevice_()
|
SpriteBatch::SpriteBatch()
|
||||||
{
|
{
|
||||||
return device;
|
|
||||||
spriteBlendMode = SpriteBlendMode::None
|
|
||||||
}
|
|
||||||
|
|
||||||
SpriteBatch::IsDisposed()
|
|
||||||
{
|
|
||||||
return disposed;
|
|
||||||
}
|
|
||||||
|
|
||||||
SpriteBatch::~SpriteBatch()
|
|
||||||
{
|
|
||||||
Dispose(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SpriteBatch::SpriteBatch(GraphicsDevice graphicsDevice)
|
SpriteBatch::SpriteBatch(GraphicsDevice graphicsDevice)
|
||||||
{
|
{
|
||||||
device = graphicsDevice;
|
device = graphicsDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SpriteBatch::~SpriteBatch()
|
||||||
|
{
|
||||||
|
Dispose(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
GraphicsDevice SpriteBatch::GraphicsDevice_()
|
||||||
|
{
|
||||||
|
return device;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SpriteBatch::IsDisposed()
|
||||||
|
{
|
||||||
|
return isDisposed;
|
||||||
|
}
|
||||||
|
|
||||||
void SpriteBatch::Begin()
|
void SpriteBatch::Begin()
|
||||||
{
|
{
|
||||||
Begin(SpriteBlendMode::AlphaBlend, SpriteSortMode::Deferred, SaveStateMode::None, Matrix::Identity);
|
Begin(SpriteBlendMode::AlphaBlend, SpriteSortMode::Deferred, SaveStateMode::None, Matrix::Identity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SpriteBatch::Begin(SpriteBlendMode_t blendMode)
|
||||||
|
{
|
||||||
|
Begin(blendMode, SpriteSortMode::Deferred, SaveStateMode::None, Matrix::Identity);
|
||||||
|
}
|
||||||
|
|
||||||
void SpriteBatch::Begin(SpriteBlendMode blendMode, SpriteSortMode sortMode, SaveStateMode stateMode)
|
void SpriteBatch::Begin(SpriteBlendMode_t blendMode, SpriteSortMode_t sortMode, SaveStateMode_t stateMode)
|
||||||
{
|
{
|
||||||
Begin(blendMode, sortMode, stateMode, Matrix::Identity);
|
Begin(blendMode, sortMode, stateMode, Matrix::Identity);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Begin(SpriteBlendMode blendMode, SpriteSortMode sortMode, SaveStateMode stateMode, Matrix transformMatrix)
|
void SpriteBatch::Begin(SpriteBlendMode_t blendMode, SpriteSortMode_t sortMode, SaveStateMode_t stateMode, Matrix transformMatrix)
|
||||||
{
|
{
|
||||||
//to respect order Begin/Draw/end
|
if (inBeginEndPair)
|
||||||
if (isRunning)
|
{
|
||||||
return;
|
throw InvalidOperationException("Begin cannot be called again until End has been successfully called.");
|
||||||
|
}
|
||||||
|
|
||||||
if (stateMode == SaveStateMode::SaveState)
|
if (stateMode == SaveStateMode::SaveState)
|
||||||
saveState = StateBlock(device);
|
saveState = StateBlock(device);
|
||||||
|
spriteBlendMode = blendMode;
|
||||||
spriteBlendMode = blendMode;
|
spriteSortMode = sortMode;
|
||||||
this.sortMode = sortMode;
|
if (sortMode == SpriteSortMode::Immediate)
|
||||||
if (sortMode == SpriteSortMode::Immediate)
|
applyGraphicsDeviceSettings();
|
||||||
applyGraphicsDeviceSettings();
|
|
||||||
isRunning = true;
|
inBeginEndPair = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteBatch::Dispose(int disposing)
|
void SpriteBatch::Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (!disposed)
|
if (disposing && !isDisposed)
|
||||||
{
|
{
|
||||||
if (disposing)
|
if (Disposing != null)
|
||||||
{
|
{
|
||||||
// Release any managed components
|
Disposing(this, EventArgs::Empty);
|
||||||
}
|
}
|
||||||
disposed = true;
|
}
|
||||||
// Release any unmanaged components
|
isDisposed = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteBatch::Dispose()
|
void SpriteBatch::Dispose()
|
||||||
@ -105,95 +118,93 @@ namespace XFX
|
|||||||
Dispose(true);
|
Dispose(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteBatch::Draw(Texture2D &texture, Rectangle &destinationRectangle, Color &color)
|
void SpriteBatch::Draw(Texture2D texture, Rectangle destinationRectangle, Color color)
|
||||||
{
|
{
|
||||||
Draw(texture, destinationRectangle, Rectangle::Zero, color, 0f, Vector2::Zero, SpriteEffects::None, 0f);
|
Draw(texture, destinationRectangle, Rectangle::Empty, color, 0.0f, Vector2::Zero, SpriteEffects::None, 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpriteBatch::Draw(Texture2D texture, Vector2 position, Color color)
|
||||||
|
{
|
||||||
|
Draw(texture, position, Rectangle::Empty, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SriteBatch::Draw(Texture2D &texture, Rectangle &destinationRectangle, Rectangle &sourceRectangle, Color &color)
|
void SpriteBatch::Draw(Texture2D texture, Rectangle destinationRectangle, Rectangle sourceRectangle, Color color)
|
||||||
{
|
{
|
||||||
Draw(texture, destinationRectangle, sourceRectangle, color, 0f, Vector2::Zero, SpriteEffects::None, 0f);
|
Draw(texture, destinationRectangle, sourceRectangle, color, 0.0f, Vector2::Zero, SpriteEffects::None, 0.0f);
|
||||||
}
|
|
||||||
|
|
||||||
void SpriteBatch::Draw(Texture2D &texture, Vector2 &position, Color &color)
|
|
||||||
{
|
|
||||||
Draw(texture, position, Rectangle::Zero, color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteBatch::Draw(Texture2D &texture, Vector2 &position, Rectangle &sourceRectangle, Color &color)
|
void SpriteBatch::Draw(Texture2D texture, Vector2 position, Rectangle sourceRectangle, Color color)
|
||||||
{
|
{
|
||||||
Rectangle destination = Rectangle((int)vector.X, (int)vector.Y, texture.Width, texture.Height);
|
Rectangle destination = Rectangle((int)position.X, (int)position.Y, texture.Width(), texture.Height());
|
||||||
Draw(texture, destination, sourceRectangle, color, 0f, Vector2::Zero, SpriteEffects::None, 0f);
|
Draw(texture, destination, sourceRectangle, color, 0.0f, Vector2::Zero, SpriteEffects::None, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteBatch::Draw(Texture2D &texture, Vector2 &position, Rectangle &sourceRectangle, Color &color, float rotation, Vector2 &origin, float scale, SpriteEffects_t effects, float layerDepth)
|
void SpriteBatch::Draw(Texture2D texture, Rectangle destinationRectangle, Rectangle sourceRectangle, Color color, float rotation, Vector2 origin, SpriteEffects_t effects, float layerDepth)
|
||||||
{
|
|
||||||
int width;
|
|
||||||
int height;
|
|
||||||
if (sourceRectangle != Rectangle::Zero)
|
|
||||||
{
|
|
||||||
width = (int)(sourceRectangle.Width * scale);
|
|
||||||
height = (int)(sourceRectangle.Height * scale);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
width = (int)(texture.Width * scale);
|
|
||||||
height = (int)(texture.Height * scale);
|
|
||||||
}
|
|
||||||
Rectangle destination = Rectangle((int)vector.X, (int)vector.Y, width, height);
|
|
||||||
Draw(texture, destination, sourceRectangle, color, rotation, origin, effects, layerDepth);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpriteBatch::Draw(Texture2D &texture, Vector2 &position, Rectangle &sourceRectangle, Color &color, float rotation, Vector2 &origin, Vector2 &scale, SpriteEffects_t effects, float layerDepth)
|
|
||||||
{
|
{
|
||||||
int width;
|
Sprite sprite = Sprite(texture,
|
||||||
int height;
|
sourceRectangle != Rectangle::Empty ? sourceRectangle : Rectangle(0, 0, texture.Width(), texture.Height()),
|
||||||
if (sourceRectangle != Rectangle::Zero)
|
destinationRectangle,
|
||||||
{
|
color,
|
||||||
width = (int)(sourceRectangle.Width * scale.X);
|
rotation,
|
||||||
height = (int)(sourceRectangle.Height * scale.Y);
|
origin,
|
||||||
}
|
effects,
|
||||||
else
|
layerDepth);
|
||||||
{
|
|
||||||
width = (int)(texture.Width * scale.X);
|
SpriteList.Add(sprite);
|
||||||
height = (int)(texture.Height * scale.Y);
|
|
||||||
}
|
if (spriteSortMode == SpriteSortMode::Immediate)
|
||||||
Rectangle destination = Rectangle((int)vector.X, (int)vector.Y, width, height);
|
Flush();
|
||||||
Draw(texture, destination, sourceRectangle, color, rotation, origin, effects, layerDepth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteBatch::Draw(Texture2D &texture, Rectangle &destinationRectangle, Rectangle &sourceRectangle, Color &color, float rotation, Vector2 &origin, SpriteEffects_t &effects, float layerDepth)
|
void SpriteBatch::Draw(Texture2D texture, Vector2 position, Rectangle sourceRectangle, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects_t effects, float layerDepth)
|
||||||
{
|
{
|
||||||
if (!isRunning)
|
int width;
|
||||||
return;
|
int height;
|
||||||
|
if (sourceRectangle != Rectangle::Empty)
|
||||||
Sprite temp = Sprite(texture, (sourceRectangle != Rectangle::Zero) ? sourceRectangle : Rectangle(0, 0, texture.Width, texture.Height),
|
{
|
||||||
destinationRectangle, color, rotation, origin, effects, layerDepth);
|
width = (int)(sourceRectangle.Width * scale.X);
|
||||||
|
height = (int)(sourceRectangle.Height * scale.Y);
|
||||||
spriteList.Add(temp);
|
}
|
||||||
|
else
|
||||||
if (sortMode == SpriteSortMode::Immediate)
|
{
|
||||||
flush();
|
width = (int)(texture.Width() * scale.X);
|
||||||
|
height = (int)(texture.Height() * scale.Y);
|
||||||
|
}
|
||||||
|
Rectangle destination = Rectangle((int)position.X, (int)position.Y, width, height);
|
||||||
|
Draw(texture, destination, sourceRectangle, color, rotation, origin, effects, layerDepth);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteBatch::DrawString(SpriteFont &spriteFont, char* text, Vector2 &position, Color &color)
|
void SpriteBatch::Draw(Texture2D texture, Vector2 position, Rectangle sourceRectangle, Color color, float rotation, Vector2 origin, float scale, SpriteEffects_t effects, float layerDepth)
|
||||||
{
|
{
|
||||||
if (!spriteFont)
|
int width;
|
||||||
return;
|
int height;
|
||||||
if (!text)
|
if (sourceRectangle != Rectangle::Empty)
|
||||||
return;
|
{
|
||||||
|
width = (int)(sourceRectangle.Width * scale);
|
||||||
spriteFont.Draw(text, *this, position, color, 0f, Vector2::Zero, Vector2::One, SpriteEffects::None, 0f);
|
height = (int)(sourceRectangle.Height * scale);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
width = (int)(texture.Width() * scale);
|
||||||
|
height = (int)(texture.Height() * scale);
|
||||||
|
}
|
||||||
|
Rectangle destination = Rectangle((int)position.X, (int)position.Y, width, height);
|
||||||
|
Draw(texture, destination, sourceRectangle, color, rotation, origin, effects, layerDepth);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteBatch::DrawString(SpriteFont &spriteFont, char* text, Vector2 &position, Color &color, float rotation, Vector2 &origin, float scale, SpriteEffects_t effects, float layerDepth)
|
void SpriteBatch::DrawString(SpriteFont spriteFont, char* text, Vector2 position, Color color)
|
||||||
|
{
|
||||||
|
spriteFont.Draw(text, *this, position, color, 0.0f, Vector2::Zero, Vector2::One, SpriteEffects::None, 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpriteBatch::DrawString(SpriteFont spriteFont, char* text, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects_t effects, float layerDepth)
|
||||||
|
{
|
||||||
|
spriteFont.Draw(text, *this, position, color, rotation, origin, scale, effects, layerDepth);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpriteBatch::DrawString(SpriteFont spriteFont, char* text, Vector2 position, Color color, float rotation, Vector2 origin, float scale, SpriteEffects_t effects, float layerDepth)
|
||||||
{
|
{
|
||||||
Vector2 vector;
|
Vector2 vector = Vector2::Zero;
|
||||||
if (!spriteFont)
|
|
||||||
return;
|
|
||||||
if (!text)
|
|
||||||
return;
|
|
||||||
|
|
||||||
vector.X = scale;
|
vector.X = scale;
|
||||||
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);
|
||||||
@ -201,125 +212,134 @@ namespace XFX
|
|||||||
|
|
||||||
void SpriteBatch::End()
|
void SpriteBatch::End()
|
||||||
{
|
{
|
||||||
if (!isRunning)
|
if (!inBeginEndPair)
|
||||||
return;
|
throw InvalidOperationException("Begin must be called successfully before End can be called.");
|
||||||
|
|
||||||
if (sortMode != SpriteSortMode::Immediate)
|
if (spriteSortMode != SpriteSortMode::Immediate)
|
||||||
{
|
{
|
||||||
applyGraphicsDeviceSettings();
|
applyGraphicsDeviceSettings();
|
||||||
flush();
|
Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
glDisable(GL_TEXTURE_2D);
|
/*glDisable(GL_TEXTURE_2D);
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
Gl::glMatrixMode(Gl::GL_PROJECTION);
|
glPopMatrix();
|
||||||
Gl::glPopMatrix();
|
glMatrixMode(GL_MODELVIEW);
|
||||||
Gl::glMatrixMode(Gl::GL_MODELVIEW);
|
glPopMatrix();*/
|
||||||
Gl::glPopMatrix();
|
|
||||||
|
restoreRenderState();
|
||||||
restoreRenderState();
|
|
||||||
isRunning = false;
|
inBeginEndPair = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteBatch::restoreRenderState()
|
void SpriteBatch::restoreRenderState()
|
||||||
{
|
{
|
||||||
if (stateMode == SaveStateMode::SaveState)
|
if (saveStateMode == SaveStateMode::SaveState)
|
||||||
saveState.Apply();
|
saveState.Apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteBatch::flush()
|
|
||||||
{
|
|
||||||
switch (sortMode)
|
|
||||||
{
|
|
||||||
case SpriteSortMode::BackToFront:
|
|
||||||
spriteList.Sort(BackToFrontSpriteComparer<Sprite>());
|
|
||||||
break;
|
|
||||||
case SpriteSortMode::FrontToBack:
|
|
||||||
spriteList.Sort(FrontToBackSpriteComparer<Sprite>());
|
|
||||||
break;
|
|
||||||
case SpriteSortMode::Texture: // nothing here?
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
spriteList.First();
|
|
||||||
Sprite temp;
|
|
||||||
while(spriteList.Next(temp))
|
|
||||||
{
|
|
||||||
// Set the color, bind the texture for drawing and prepare the texture source
|
|
||||||
if (temp.Color.A <= 0) continue;
|
|
||||||
Gl::glColor4f((float)temp.Color.R / 255f, (float)temp.Color.G / 255f, (float)temp.Color.B / 255f, (float)temp.Color.A / 255f);
|
|
||||||
Gl::glBindTexture(Gl::GL_TEXTURE_2D, temp.Texture.textureId);
|
|
||||||
|
|
||||||
// Setup the matrix
|
|
||||||
Gl::glPushMatrix();
|
|
||||||
if ((temp.DestinationRectangle.X != 0) || (temp.DestinationRectangle.Y != 0))
|
|
||||||
Gl::glTranslatef(temp.DestinationRectangle.X, temp.DestinationRectangle.Y, 0f); // Position
|
|
||||||
if (temp.Rotation != 0)
|
|
||||||
Gl::glRotatef(MathHelper.ToDegrees(temp.Rotation), 0f, 0f, 1f); // Rotation
|
|
||||||
if ((temp.DestinationRectangle.Width != 0 && temp.Origin.X != 0) || (temp.DestinationRectangle.Height != 0 && temp.Origin.Y != 0))
|
|
||||||
Gl::glTranslatef( // Orientation
|
|
||||||
-temp.Origin.X * (float)temp.DestinationRectangle.Width / (float)temp.SourceRectangle.Width,
|
|
||||||
-temp.Origin.Y * (float)temp.DestinationRectangle.Height / (float)temp.SourceRectangle.Height, 0f);
|
|
||||||
|
|
||||||
// Calculate the points on the texture
|
|
||||||
float x = (float)temp.SourceRectangle.X / (float)temp.Texture.Width;
|
|
||||||
float y = (float)temp.SourceRectangle.Y / (float)temp.Texture.Height;
|
|
||||||
float twidth = (float)temp.SourceRectangle.Width / (float)temp.Texture.Width;
|
|
||||||
float theight = (float)temp.SourceRectangle.Height / (float)temp.Texture.Height;
|
|
||||||
|
|
||||||
// Draw
|
|
||||||
Gl::glBegin(Gl::GL_QUADS);
|
|
||||||
{
|
|
||||||
Gl::glTexCoord2f(x,y + theight);
|
|
||||||
Gl::glVertex2f(0f, temp.DestinationRectangle.Height);
|
|
||||||
|
|
||||||
Gl::glTexCoord2f(x + twidth, y + theight);
|
|
||||||
Gl::glVertex2f(temp.DestinationRectangle.Width, temp.DestinationRectangle.Height);
|
|
||||||
|
|
||||||
Gl::glTexCoord2f(x + twidth,y);
|
|
||||||
Gl::glVertex2f(temp.DestinationRectangle.Width, 0f);
|
|
||||||
|
|
||||||
Gl::glTexCoord2f(x,y);
|
|
||||||
Gl::glVertex2f(0f, 0f);
|
|
||||||
}
|
|
||||||
Gl::glEnd();
|
|
||||||
Gl::glPopMatrix(); // Finish with the matrix
|
|
||||||
}
|
|
||||||
spriteList.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpriteBatch::applyGraphicsDeviceSettings()
|
void SpriteBatch::applyGraphicsDeviceSettings()
|
||||||
{
|
{
|
||||||
|
unsigned int* p;
|
||||||
|
|
||||||
// Set the blend mode
|
// Set the blend mode
|
||||||
switch (spriteBlendMode)
|
switch (spriteBlendMode)
|
||||||
{
|
{
|
||||||
case SpriteBlendMode::AlphaBlend:
|
case SpriteBlendMode::AlphaBlend:
|
||||||
glEnable(GL_BLEND);
|
p = pb_begin();
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
//Enable blending
|
||||||
|
pb_push(p, NV20_TCL_PRIMITIVE_3D_BLEND_FUNC_ENABLE, 1); p+=2;
|
||||||
|
//set blendmode
|
||||||
|
pb_push2(p, NV20_TCL_PRIMITIVE_3D_BLEND_FUNC_SRC, (0x302<<16) | 0x302, (0x303<<16) | 0x303); p+=3;
|
||||||
|
//send data to GPU
|
||||||
|
pb_end(p);
|
||||||
break;
|
break;
|
||||||
case SpriteBlendMode::Additive:
|
case SpriteBlendMode::Additive:
|
||||||
glEnable(GL_BLEND);
|
p = pb_begin();
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
//Enable blending
|
||||||
|
pb_push(p, NV20_TCL_PRIMITIVE_3D_BLEND_FUNC_ENABLE, 1); p+=2;
|
||||||
|
//set blendmode
|
||||||
|
pb_push2(p, NV20_TCL_PRIMITIVE_3D_BLEND_FUNC_SRC, (0x302<<16) | 0x302, (1<<16) | 1); p+=3;
|
||||||
|
//send data to GPU
|
||||||
|
pb_end(p);
|
||||||
break;
|
break;
|
||||||
case SpriteBlendMode::None:
|
case SpriteBlendMode::None:
|
||||||
glDisable(GL_BLEND);
|
p = pb_begin();
|
||||||
|
//Disable Blending
|
||||||
|
pb_push(p, NV20_TCL_PRIMITIVE_3D_BLEND_FUNC_ENABLE, 0); p+=2;
|
||||||
|
//send data to GPU
|
||||||
|
pb_end(p);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
//glEnable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
// Reset the projection matrix and use the orthographic matrix
|
// Reset the projection matrix and use the orthographic matrix
|
||||||
int[] viewPort = new int[4];
|
/*int viewPort[4];
|
||||||
Gl::glGetIntegerv(Gl::GL_VIEWPORT, viewPort);
|
glGetIntegerv(GL_VIEWPORT, viewPort);
|
||||||
Gl::glMatrixMode(Gl::GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
Gl::glPushMatrix();
|
glPushMatrix();
|
||||||
Gl::glLoadIdentity();
|
glLoadIdentity();
|
||||||
Gl::glOrtho(0, viewPort[2], viewPort[3], 0, -1, 1); // viewPort[2] = width, viewPort[3] = height
|
glOrtho(0, device.Viewport_().Width, device.Viewport_().Height, 0, -1, 1); // viewPort[2] = width, viewPort[3] = height
|
||||||
Gl::glMatrixMode(Gl::GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
Gl::glPushMatrix();
|
glPushMatrix();
|
||||||
Gl::glLoadIdentity();
|
glLoadIdentity();*/
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpriteBatch::Flush()
|
||||||
|
{
|
||||||
|
switch (spriteSortMode)
|
||||||
|
{
|
||||||
|
case SpriteSortMode::BackToFront:
|
||||||
|
//SpriteList.Sort(BackToFrontSpriteComparer<Sprite>());
|
||||||
|
break;
|
||||||
|
case SpriteSortMode::FrontToBack:
|
||||||
|
//SpriteList.Sort(FrontToBackSpriteComparer<Sprite>());
|
||||||
|
break;
|
||||||
|
case SpriteSortMode::Texture: // nothing here?
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < SpriteList.Count(); i++)
|
||||||
|
{
|
||||||
|
// Set the color, bind the texture for drawing and prepare the texture source
|
||||||
|
if (SpriteList[i].Color_().A() <= 0) continue;
|
||||||
|
//glColor4f((float)sprite.Color_().R() / 255f, (float)sprite.Color_().G() / 255f, (float)sprite.Color_().B() / 255f, (float)sprite.Color_().A() / 255f);
|
||||||
|
//glBindTexture(GL_TEXTURE_2D, sprite.Texture->textureId);
|
||||||
|
// Setup the matrix
|
||||||
|
//if ((SpriteList[i].DestinationRectangle().X != 0) || (SpriteList[i].DestinationRectangle().Y != 0))
|
||||||
|
// glTranslatef(SpriteList[i].DestinationRectangle().X, SpriteList[i].DestinationRectangle().Y, 0.0f); // Position
|
||||||
|
|
||||||
|
//if (SpriteList[i].Rotation() != 0)
|
||||||
|
// glRotatef(MathHelper::ToDegrees(SpriteList[i].Rotation()), 0.0f, 0.0f, 1.0f); // Rotation
|
||||||
|
|
||||||
|
/*if ((SpriteList[i].DestinationRectangle().Width != 0 && SpriteList[i].Origin().X != 0) || (SpriteList[i].DestinationRectangle().Height != 0 && SpriteList[i].Origin().Y != 0))
|
||||||
|
glTranslatef(
|
||||||
|
// Orientation
|
||||||
|
-SpriteList[i].Origin.X * (float)SpriteList[i].DestinationRectangle().Width / (float)SpriteList[i].SourceRectangle().Width,
|
||||||
|
-SpriteList[i].Origin.Y * (float)SpriteList[i].DestinationRectangle().Height / (float)SpriteList[i].SourceRectangle().Height, 0.0f);*/
|
||||||
|
// Calculate the points on the texture
|
||||||
|
float x = (float)SpriteList[i].SourceRectangle().X / (float)SpriteList[i].Texture().Width();
|
||||||
|
float y = (float)SpriteList[i].SourceRectangle().Y / (float)SpriteList[i].Texture().Height();
|
||||||
|
float twidth = (float)SpriteList[i].SourceRectangle().Width / (float)SpriteList[i].Texture().Width();
|
||||||
|
float theight = (float)SpriteList[i].SourceRectangle().Height / (float)SpriteList[i].Texture().Height();
|
||||||
|
// Draw
|
||||||
|
/*glBegin(GL_QUADS);
|
||||||
|
{
|
||||||
|
glTexCoord2f(x,y + theight);
|
||||||
|
glVertex2f(0f, SpriteList[i].DestinationRectangle().Height);
|
||||||
|
glTexCoord2f(x + twidth, y + theight);
|
||||||
|
glVertex2f(SpriteList[i].DestinationRectangle().Width, SpriteList[i].DestinationRectangle().Height);
|
||||||
|
glTexCoord2f(x + twidth,y);
|
||||||
|
glVertex2f(SpriteList[i].DestinationRectangle().Width, 0f);
|
||||||
|
glTexCoord2f(x,y);
|
||||||
|
glVertex2f(0f, 0f);
|
||||||
|
}
|
||||||
|
glEnd();
|
||||||
|
glPopMatrix(); // Finish with the matrix*/
|
||||||
|
}
|
||||||
|
SpriteList.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
162
src/libXFX/SpriteFont.cpp
Normal file
162
src/libXFX/SpriteFont.cpp
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
// Copyright (C) 2010-2012, XFX Team
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer in the
|
||||||
|
// documentation and/or other materials provided with the distribution.
|
||||||
|
// * Neither the name of the copyright holder nor the names of any
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
// POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
#include <Graphics/SpriteBatch.h>
|
||||||
|
#include <Graphics/SpriteFont.h>
|
||||||
|
#include <Matrix.h>
|
||||||
|
#include <System/Array.h>
|
||||||
|
#include <System/Exception.h>
|
||||||
|
#include <System/Math.h>
|
||||||
|
|
||||||
|
namespace XFX
|
||||||
|
{
|
||||||
|
namespace Graphics
|
||||||
|
{
|
||||||
|
SpriteFont::SpriteFont(Texture2D texture, List<Rectangle> glyphs, List<Rectangle> cropping, List<char> charMap, int lineSpacing, float spacing, List<Vector3> kerning)
|
||||||
|
{
|
||||||
|
textureValue = texture;
|
||||||
|
glyphData = glyphs;
|
||||||
|
croppingData = cropping;
|
||||||
|
characterMap = charMap;
|
||||||
|
this->lineSpacing = lineSpacing;
|
||||||
|
this->spacing = spacing;
|
||||||
|
this->kerning = kerning;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpriteFont::Draw(char* text, SpriteBatch spriteBatch, Vector2 textblockPosition, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects_t spriteEffects, float depth)
|
||||||
|
{
|
||||||
|
Vector2 vector2;
|
||||||
|
Matrix matrix;
|
||||||
|
Matrix matrix2;
|
||||||
|
|
||||||
|
if (text == null)
|
||||||
|
throw ArgumentNullException("text");
|
||||||
|
|
||||||
|
Matrix::CreateRotationZ(rotation, matrix2);
|
||||||
|
Matrix::CreateTranslation(-origin.X * scale.X, -origin.Y * scale.Y, 0.0f, matrix);
|
||||||
|
Matrix::Multiply(matrix, matrix2, matrix2);
|
||||||
|
int num2 = 1;
|
||||||
|
float num4 = 0.0f;
|
||||||
|
bool flag = true;
|
||||||
|
if ((spriteEffects & SpriteEffects::FlipHorizontally) == SpriteEffects::FlipHorizontally)
|
||||||
|
{
|
||||||
|
num4 = MeasureString(text).X * scale.X;
|
||||||
|
num2 = -1;
|
||||||
|
}
|
||||||
|
if ((spriteEffects & SpriteEffects::FlipVertically) == SpriteEffects::FlipVertically)
|
||||||
|
{
|
||||||
|
vector2.Y = (MeasureString(text).Y - lineSpacing) * scale.Y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vector2.Y = 0.0f;
|
||||||
|
}
|
||||||
|
vector2.X = num4;
|
||||||
|
for (int i = 0; i < Array::Length(text); i++)
|
||||||
|
{
|
||||||
|
char character = text[i];
|
||||||
|
switch (character)
|
||||||
|
{
|
||||||
|
case '\r':
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '\n':
|
||||||
|
flag = true;
|
||||||
|
vector2.X = num4;
|
||||||
|
if ((spriteEffects & SpriteEffects::FlipVertically) == SpriteEffects::FlipVertically)
|
||||||
|
{
|
||||||
|
vector2.Y -= lineSpacing * scale.Y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vector2.Y += lineSpacing * scale.Y;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
int indexForCharacter = GetIndexForCharacter(character);
|
||||||
|
Vector3 vector3 = kerning[indexForCharacter];
|
||||||
|
if (flag)
|
||||||
|
{
|
||||||
|
vector3.X = Math::Max(vector3.X, 0.0f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vector2.X += (spacing * scale.X) * num2;
|
||||||
|
}
|
||||||
|
vector2.X += (vector3.X * scale.X) * num2;
|
||||||
|
Rectangle rectangle = glyphData[indexForCharacter];
|
||||||
|
Rectangle rectangle2 = croppingData[indexForCharacter];
|
||||||
|
if ((spriteEffects & SpriteEffects::FlipVertically) == SpriteEffects::FlipVertically)
|
||||||
|
{
|
||||||
|
rectangle2.Y = (lineSpacing - rectangle.Height) - rectangle2.Y;
|
||||||
|
}
|
||||||
|
if ((spriteEffects & SpriteEffects::FlipHorizontally) == SpriteEffects::FlipHorizontally)
|
||||||
|
{
|
||||||
|
rectangle2.X -= rectangle2.Width;
|
||||||
|
}
|
||||||
|
Vector2 position = vector2;
|
||||||
|
position.X += rectangle2.X * scale.X;
|
||||||
|
position.Y += rectangle2.Y * scale.Y;
|
||||||
|
Vector2::Transform(position, matrix2, position);
|
||||||
|
position.X += textblockPosition.X;
|
||||||
|
position.Y += textblockPosition.Y;
|
||||||
|
spriteBatch.Draw(textureValue, position, rectangle, color, rotation, Vector2::Zero, scale, spriteEffects, depth);
|
||||||
|
flag = false;
|
||||||
|
vector2.X += ((vector3.Y + vector3.Z) * scale.X) * num2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int SpriteFont::GetIndexForCharacter(char character)
|
||||||
|
{
|
||||||
|
int num2 = 0;
|
||||||
|
int num3 = characterMap.Count() - 1;
|
||||||
|
while (num2 <= num3)
|
||||||
|
{
|
||||||
|
int num = num2 + ((num3 - num2) >> 1);
|
||||||
|
char ch = characterMap[num];
|
||||||
|
if (ch == character)
|
||||||
|
{
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
if (ch < character)
|
||||||
|
{
|
||||||
|
num2 = num + 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
num3 = num - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw ArgumentException("character");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
61
src/libXFX/StateBlock.cpp
Normal file
61
src/libXFX/StateBlock.cpp
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
// Copyright (C) 2010-2012, XFX Team
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer in the
|
||||||
|
// documentation and/or other materials provided with the distribution.
|
||||||
|
// * Neither the name of the copyright holder nor the names of any
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
// POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
#include <Graphics/StateBlock.h>
|
||||||
|
|
||||||
|
namespace XFX
|
||||||
|
{
|
||||||
|
namespace Graphics
|
||||||
|
{
|
||||||
|
StateBlock::StateBlock()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
StateBlock::StateBlock(GraphicsDevice graphicsDevice)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
StateBlock::StateBlock(const StateBlock &obj)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool StateBlock::Equals(StateBlock other)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool StateBlock::operator!=(const StateBlock other)
|
||||||
|
{
|
||||||
|
return !Equals(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool StateBlock::operator==(const StateBlock other)
|
||||||
|
{
|
||||||
|
return Equals(other);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -32,6 +32,7 @@ namespace XFX
|
|||||||
namespace Storage
|
namespace Storage
|
||||||
{
|
{
|
||||||
StorageDeviceNotConnectedException::StorageDeviceNotConnectedException()
|
StorageDeviceNotConnectedException::StorageDeviceNotConnectedException()
|
||||||
|
: ExternalException()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +41,7 @@ namespace XFX
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
StorageDeviceNotConnectedException::StorageDeviceNotConnectedException(char* message, Exception innerException)
|
StorageDeviceNotConnectedException::StorageDeviceNotConnectedException(char* message, Exception* innerException)
|
||||||
: ExternalException(message, innerException)
|
: ExternalException(message, innerException)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,11 @@ namespace XFX
|
|||||||
{
|
{
|
||||||
return _width;
|
return _width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Texture2D::Texture2D()
|
||||||
|
{
|
||||||
|
textureId = -1;
|
||||||
|
}
|
||||||
|
|
||||||
Texture2D::Texture2D(GraphicsDevice graphicsDevice)
|
Texture2D::Texture2D(GraphicsDevice graphicsDevice)
|
||||||
{
|
{
|
||||||
@ -78,6 +83,17 @@ namespace XFX
|
|||||||
_textureUsage = usage;
|
_textureUsage = usage;
|
||||||
_surfaceFormat = format;
|
_surfaceFormat = format;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Texture2D::Texture2D(const Texture2D &obj)
|
||||||
|
{
|
||||||
|
textureId = obj.textureId;
|
||||||
|
device = obj.device;
|
||||||
|
_width = obj._width;
|
||||||
|
_height = obj._height;
|
||||||
|
_numberOfLevels = obj._numberOfLevels;
|
||||||
|
_textureUsage = obj._textureUsage;
|
||||||
|
_surfaceFormat = obj._surfaceFormat;
|
||||||
|
}
|
||||||
|
|
||||||
void Texture2D::Dispose(bool disposing)
|
void Texture2D::Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
|
@ -187,10 +187,6 @@
|
|||||||
<Filter
|
<Filter
|
||||||
Name="Graphics"
|
Name="Graphics"
|
||||||
>
|
>
|
||||||
<File
|
|
||||||
RelativePath=".\BasicEffect.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Color.cpp"
|
RelativePath=".\Color.cpp"
|
||||||
>
|
>
|
||||||
@ -215,10 +211,6 @@
|
|||||||
RelativePath=".\GraphicsDeviceCapabilities.cpp"
|
RelativePath=".\GraphicsDeviceCapabilities.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\GraphicsDeviceManager.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\GraphicsResource.cpp"
|
RelativePath=".\GraphicsResource.cpp"
|
||||||
>
|
>
|
||||||
@ -227,10 +219,22 @@
|
|||||||
RelativePath=".\PresentationParameters.cpp"
|
RelativePath=".\PresentationParameters.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Sprite.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\SpriteBatch.cpp"
|
RelativePath=".\SpriteBatch.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\SpriteFont.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\StateBlock.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Texture.cpp"
|
RelativePath=".\Texture.cpp"
|
||||||
>
|
>
|
||||||
@ -386,9 +390,17 @@
|
|||||||
RelativePath="..\..\include\Vector4.h"
|
RelativePath="..\..\include\Vector4.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\include\XFX.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Audio"
|
Name="Audio"
|
||||||
>
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\include\Audio.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\Audio\Enums.h"
|
RelativePath="..\..\include\Audio\Enums.h"
|
||||||
>
|
>
|
||||||
@ -397,6 +409,10 @@
|
|||||||
<Filter
|
<Filter
|
||||||
Name="Content"
|
Name="Content"
|
||||||
>
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\include\Content.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\Content\ContentManager.h"
|
RelativePath="..\..\include\Content\ContentManager.h"
|
||||||
>
|
>
|
||||||
@ -413,10 +429,6 @@
|
|||||||
RelativePath="..\..\include\Graphics\BasicDirectionalLight.h"
|
RelativePath="..\..\include\Graphics\BasicDirectionalLight.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\include\Graphics\BasicEffect.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\Graphics\Color.h"
|
RelativePath="..\..\include\Graphics\Color.h"
|
||||||
>
|
>
|
||||||
@ -433,10 +445,6 @@
|
|||||||
RelativePath="..\..\include\Graphics\DisplayModeCollection.h"
|
RelativePath="..\..\include\Graphics\DisplayModeCollection.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\include\Graphics\Effect.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\Graphics\Enums.h"
|
RelativePath="..\..\include\Graphics\Enums.h"
|
||||||
>
|
>
|
||||||
@ -445,6 +453,10 @@
|
|||||||
RelativePath="..\..\include\Graphics\Exceptions.h"
|
RelativePath="..\..\include\Graphics\Exceptions.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\include\Graphics.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\Graphics\GraphicsAdapter.h"
|
RelativePath="..\..\include\Graphics\GraphicsAdapter.h"
|
||||||
>
|
>
|
||||||
@ -469,10 +481,22 @@
|
|||||||
RelativePath="..\..\include\Graphics\PresentationParameters.h"
|
RelativePath="..\..\include\Graphics\PresentationParameters.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\include\Graphics\Sprite.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\Graphics\SpriteBatch.h"
|
RelativePath="..\..\include\Graphics\SpriteBatch.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\include\Graphics\SpriteFont.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\include\Graphics\StateBlock.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\Graphics\Texture.h"
|
RelativePath="..\..\include\Graphics\Texture.h"
|
||||||
>
|
>
|
||||||
@ -541,6 +565,10 @@
|
|||||||
RelativePath="..\..\include\Input\GamePadState.h"
|
RelativePath="..\..\include\Input\GamePadState.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\include\Input.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\Input\Keyboard.h"
|
RelativePath="..\..\include\Input\Keyboard.h"
|
||||||
>
|
>
|
||||||
@ -557,6 +585,10 @@
|
|||||||
RelativePath="..\..\include\Media\Enums.h"
|
RelativePath="..\..\include\Media\Enums.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\include\Media.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\Media\Video.h"
|
RelativePath="..\..\include\Media\Video.h"
|
||||||
>
|
>
|
||||||
@ -569,6 +601,10 @@
|
|||||||
<Filter
|
<Filter
|
||||||
Name="Storage"
|
Name="Storage"
|
||||||
>
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\include\Storage.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\Storage\StorageContainer.h"
|
RelativePath="..\..\include\Storage\StorageContainer.h"
|
||||||
>
|
>
|
||||||
@ -589,6 +625,10 @@
|
|||||||
RelativePath="..\..\include\GamerServices\Enums.h"
|
RelativePath="..\..\include\GamerServices\Enums.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\include\GamerServices.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\GamerServices\Guide.h"
|
RelativePath="..\..\include\GamerServices\Guide.h"
|
||||||
>
|
>
|
||||||
|
@ -35,7 +35,7 @@ OBJS = BoundingBox.o BoundingFrustrum.o BoundingSphere.o MathHelper.o Matrix.o P
|
|||||||
AUDIO_OBJS =
|
AUDIO_OBJS =
|
||||||
CONTENT_OBJS = ContentManager.o ContentReader.o
|
CONTENT_OBJS = ContentManager.o ContentReader.o
|
||||||
GAMERSERVICES_OBJS = Guide.o
|
GAMERSERVICES_OBJS = Guide.o
|
||||||
GRAPHICS_OBJS = Color.o DisplayMode.o GraphicsAdapter.o GraphicsDevice.o pbKit.o Texture.o Texture2D.o TextureCollection.o TextureCreationParameters.o VertexElement.o VertexPositionColor.o VertexPositionNormalTexture.o VertexPositionTexture.o Viewport.o
|
GRAPHICS_OBJS = Color.o DisplayMode.o GraphicsAdapter.o GraphicsDevice.o pbKit.o Sprite.o SpriteBatch.o SpriteFont.o Texture.o Texture2D.o TextureCollection.o TextureCreationParameters.o VertexElement.o VertexPositionColor.o VertexPositionNormalTexture.o VertexPositionTexture.o Viewport.o
|
||||||
INPUT_OBJS = GamePad.o Keyboard.o Mouse.o
|
INPUT_OBJS = GamePad.o Keyboard.o Mouse.o
|
||||||
MEDIA_OBJS = VideoPlayer.o
|
MEDIA_OBJS = VideoPlayer.o
|
||||||
NET_OBJS =
|
NET_OBJS =
|
||||||
|
@ -26,11 +26,48 @@
|
|||||||
// POSSIBILITY OF SUCH DAMAGE.
|
// POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <System/Array.h>
|
#include <System/Array.h>
|
||||||
|
#include <System/Collections/Generic/Comparer.h>
|
||||||
#include <System/Exception.h>
|
#include <System/Exception.h>
|
||||||
#include <System/Types.h>
|
#include <System/Types.h>
|
||||||
|
|
||||||
namespace System
|
namespace System
|
||||||
{
|
{
|
||||||
|
template <class T>
|
||||||
|
int Array::BinarySearch(T array[], int index, int length, T value, IComparer<T>* comparer)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (comparer == null)
|
||||||
|
{
|
||||||
|
comparer = Comparer<T>::Default();
|
||||||
|
}
|
||||||
|
int num = index;
|
||||||
|
int num2 = (index + length) - 1;
|
||||||
|
while (num <= num2)
|
||||||
|
{
|
||||||
|
int num3 = num + ((num2 - num) >> 1);
|
||||||
|
int num4 = comparer->Compare(array[num3], value);
|
||||||
|
if (num4 == 0)
|
||||||
|
{
|
||||||
|
return num3;
|
||||||
|
}
|
||||||
|
if (num4 < 0)
|
||||||
|
{
|
||||||
|
num = num3 + 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
num2 = num3 - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ~num;
|
||||||
|
}
|
||||||
|
catch(Exception* exception)
|
||||||
|
{
|
||||||
|
throw InvalidOperationException("", exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void Array::Clear(T array[], int index, int length)
|
void Array::Clear(T array[], int index, int length)
|
||||||
{
|
{
|
||||||
|
@ -1,3 +1,30 @@
|
|||||||
|
// Copyright (C) 2010-2012, XFX Team
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer in the
|
||||||
|
// documentation and/or other materials provided with the distribution.
|
||||||
|
// * Neither the name of the copyright holder nor the names of any
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
// POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <System/Collections/Generic/Comparer.h>
|
#include <System/Collections/Generic/Comparer.h>
|
||||||
|
|
||||||
namespace System
|
namespace System
|
||||||
@ -6,7 +33,27 @@ namespace System
|
|||||||
{
|
{
|
||||||
namespace Generic
|
namespace Generic
|
||||||
{
|
{
|
||||||
|
template <class T>
|
||||||
|
Comparer<T>::Comparer()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
Comparer<T> Comparer<T>::Default()
|
||||||
|
{
|
||||||
|
return defaultComparer;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
int Comparer<T>::Compare(T x, T y)
|
||||||
|
{
|
||||||
|
if (x < y)
|
||||||
|
return -1;
|
||||||
|
if (x == y)
|
||||||
|
return 0;
|
||||||
|
if (x > y)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ namespace System
|
|||||||
bool Dictionary<TKey, TValue>::Contains(KeyValuePair<TKey, TValue> keyValuePair)
|
bool Dictionary<TKey, TValue>::Contains(KeyValuePair<TKey, TValue> keyValuePair)
|
||||||
{
|
{
|
||||||
int index = FindEntry(keyValuePair.Key());
|
int index = FindEntry(keyValuePair.Key());
|
||||||
return ((index >= 0) && EqualityComparer<TValue>::Default.Equals(entries[index].value, keyValuePair.Value()));
|
return ((index >= 0) && EqualityComparer<TValue>::Default().Equals(entries[index].value, keyValuePair.Value()));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class TKey, class TValue>
|
template <class TKey, class TValue>
|
||||||
@ -115,10 +115,10 @@ namespace System
|
|||||||
{
|
{
|
||||||
if (buckets != null)
|
if (buckets != null)
|
||||||
{
|
{
|
||||||
int num = comparer.GetHashCode(key) & 0x7fffffff;
|
int num = comparer->GetHashCode(key) & 0x7fffffff;
|
||||||
for (int i = buckets[num % Array::Length(buckets)]; i >= 0; i = entries[i].next)
|
for (int i = buckets[num % Array::Length(buckets)]; i >= 0; i = entries[i].next)
|
||||||
{
|
{
|
||||||
if ((entries[i].hashCode == num) && comparer.Equals(entries[i].key, key))
|
if ((entries[i].hashCode == num) && comparer->Equals(entries[i].key, key))
|
||||||
{
|
{
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@ -147,11 +147,11 @@ namespace System
|
|||||||
if(buckets == null)
|
if(buckets == null)
|
||||||
Initialize(0);
|
Initialize(0);
|
||||||
|
|
||||||
int num = comparer.GetHashCode(key) & 0x7fffffff;
|
int num = comparer->GetHashCode(key) & 0x7fffffff;
|
||||||
int index = num % Array::Length(buckets);
|
int index = num % Array::Length(buckets);
|
||||||
for(int i = buckets[index]; i >= 0; i = entries[i].next)
|
for(int i = buckets[index]; i >= 0; i = entries[i].next)
|
||||||
{
|
{
|
||||||
if((entries[i].hashCode == num) && comparer.Equals(entries[i].key, key))
|
if((entries[i].hashCode == num) && comparer->Equals(entries[i].key, key))
|
||||||
{
|
{
|
||||||
if(add)
|
if(add)
|
||||||
throw ArgumentException("Adding duplicate of existing key.");
|
throw ArgumentException("Adding duplicate of existing key.");
|
||||||
@ -190,12 +190,12 @@ namespace System
|
|||||||
{
|
{
|
||||||
if(buckets != null)
|
if(buckets != null)
|
||||||
{
|
{
|
||||||
int num = comparer.GetHashCode(key) & 0x7fffffff;
|
int num = comparer->GetHashCode(key) & 0x7fffffff;
|
||||||
int index = num % Array::Length(buckets);
|
int index = num % Array::Length(buckets);
|
||||||
int num3 = -1;
|
int num3 = -1;
|
||||||
for(int i = buckets[index]; i >= 0; i = entries[i].next)
|
for(int i = buckets[index]; i >= 0; i = entries[i].next)
|
||||||
{
|
{
|
||||||
if((entries[i].hashCode == num) && comparer.Equals(entries[i].key, key))
|
if((entries[i].hashCode == num) && comparer->Equals(entries[i].key, key))
|
||||||
{
|
{
|
||||||
if(num3 < 0)
|
if(num3 < 0)
|
||||||
{
|
{
|
||||||
@ -207,8 +207,8 @@ namespace System
|
|||||||
}
|
}
|
||||||
entries[i].hashCode = -1;
|
entries[i].hashCode = -1;
|
||||||
entries[i].next = freeList;
|
entries[i].next = freeList;
|
||||||
//entries[i].key = default(TKey);
|
entries[i].key = TKey();
|
||||||
//entries[i].value = default(TValue);
|
entries[i].value = TValue();
|
||||||
freeList = i;
|
freeList = i;
|
||||||
freeCount++;
|
freeCount++;
|
||||||
version++;
|
version++;
|
||||||
@ -250,7 +250,7 @@ namespace System
|
|||||||
value = entries[index].value;
|
value = entries[index].value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//value = default(TValue);
|
value = TValue();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
// POSSIBILITY OF SUCH DAMAGE.
|
// POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
#include <System/Types.h>
|
||||||
#include <System/Exception.h>
|
#include <System/Exception.h>
|
||||||
|
|
||||||
namespace System
|
namespace System
|
||||||
@ -37,46 +38,92 @@ namespace System
|
|||||||
Exception::Exception()
|
Exception::Exception()
|
||||||
{
|
{
|
||||||
_message = "";
|
_message = "";
|
||||||
|
_innerException = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Exception::Exception(char* message)
|
Exception::Exception(char* message)
|
||||||
{
|
{
|
||||||
_message = message;
|
_message = message;
|
||||||
|
_innerException = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Exception::Exception(char* message, Exception* innerException)
|
||||||
|
{
|
||||||
|
_message = message;
|
||||||
|
_innerException = innerException;
|
||||||
|
}
|
||||||
|
|
||||||
|
Exception::~Exception()
|
||||||
|
{
|
||||||
|
_innerException = null;
|
||||||
|
delete[] _message;
|
||||||
|
}
|
||||||
|
|
||||||
|
Exception* Exception::GetBaseException()
|
||||||
|
{
|
||||||
|
Exception *innerException = _innerException;
|
||||||
|
Exception *exception2 = this;
|
||||||
|
while(innerException != null)
|
||||||
|
{
|
||||||
|
exception2 = innerException;
|
||||||
|
innerException = innerException->_innerException;
|
||||||
|
}
|
||||||
|
return innerException;
|
||||||
|
}
|
||||||
|
|
||||||
|
Exception* Exception::InnerException()
|
||||||
|
{
|
||||||
|
return _innerException;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// ApplicationException
|
// ApplicationException
|
||||||
//
|
//
|
||||||
ApplicationException::ApplicationException()
|
ApplicationException::ApplicationException()
|
||||||
|
: Exception()
|
||||||
{
|
{
|
||||||
_message = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplicationException::ApplicationException(char* message)
|
ApplicationException::ApplicationException(char* message)
|
||||||
|
: Exception(message)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ApplicationException::ApplicationException(char* message, Exception* innerException)
|
||||||
|
: Exception(message, innerException)
|
||||||
{
|
{
|
||||||
_message = message;
|
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// ArithmeticException
|
// ArithmeticException
|
||||||
//
|
//
|
||||||
ArithmeticException::ArithmeticException()
|
ArithmeticException::ArithmeticException()
|
||||||
|
: Exception()
|
||||||
{
|
{
|
||||||
_message = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ArithmeticException::ArithmeticException(char* message)
|
ArithmeticException::ArithmeticException(char* message)
|
||||||
|
: Exception(message)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ArithmeticException::ArithmeticException(char* message, Exception* innerException)
|
||||||
|
: Exception(message, innerException)
|
||||||
{
|
{
|
||||||
_message = message;
|
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// DivideByZeroException
|
// DivideByZeroException
|
||||||
//
|
//
|
||||||
DivideByZeroException::DivideByZeroException()
|
DivideByZeroException::DivideByZeroException()
|
||||||
|
: ArithmeticException()
|
||||||
{
|
{
|
||||||
_message = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DivideByZeroException::DivideByZeroException(char* message)
|
DivideByZeroException::DivideByZeroException(char* message)
|
||||||
|
: ArithmeticException(message)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
DivideByZeroException::DivideByZeroException(char* message, Exception* innerException)
|
||||||
|
: ArithmeticException(message, innerException)
|
||||||
{
|
{
|
||||||
_message = message;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ namespace System
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyNotFoundException::KeyNotFoundException(char* message, Exception innerException)
|
KeyNotFoundException::KeyNotFoundException(char* message, Exception* innerException)
|
||||||
: SystemException(message, innerException)
|
: SystemException(message, innerException)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,16 @@ namespace System
|
|||||||
|
|
||||||
bool Object::Equals(Object* objA, Object* objB)
|
bool Object::Equals(Object* objA, Object* objB)
|
||||||
{
|
{
|
||||||
return ((&objA == &objB) || ((objA != null) && (objB != null) && objA->Equals(objB)));
|
return ((&objA == &objB) || ((objA != null) && (objB != null) && objA->Equals(objB)) || (objA == null) && (objB == null));
|
||||||
|
}
|
||||||
|
|
||||||
|
int Object::GetHashCode()
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* Object::ToString()
|
||||||
|
{
|
||||||
|
return "Object";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@ typedef struct
|
|||||||
}
|
}
|
||||||
stDriveMapping;
|
stDriveMapping;
|
||||||
|
|
||||||
#if ENABLE_XBOX
|
|
||||||
stDriveMapping driveMapping[] =
|
stDriveMapping driveMapping[] =
|
||||||
{
|
{
|
||||||
{ 'C', "Harddisk0\\Partition2", 2},
|
{ 'C', "Harddisk0\\Partition2", 2},
|
||||||
@ -28,17 +27,6 @@ char extendPartitionMapping[] =
|
|||||||
{
|
{
|
||||||
'F','G','R','S','V','W','A','B'
|
'F','G','R','S','V','W','A','B'
|
||||||
};
|
};
|
||||||
#else
|
|
||||||
stDriveMapping driveMapping[] =
|
|
||||||
{
|
|
||||||
{ 'C', "C:", 2},
|
|
||||||
{ 'D', "D:", -1},
|
|
||||||
{ 'E', "E:", 1},
|
|
||||||
{ 'X', "X:", 3},
|
|
||||||
{ 'Y', "Y:", 4},
|
|
||||||
{ 'Z', "Z:", 5},
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define NUM_OF_DRIVES (sizeof(driveMapping) / sizeof(driveMapping[0]))
|
#define NUM_OF_DRIVES (sizeof(driveMapping) / sizeof(driveMapping[0]))
|
||||||
|
|
||||||
@ -58,7 +46,7 @@ namespace System
|
|||||||
|
|
||||||
char* Path::ChangeExtension(char* path, char* extension)
|
char* Path::ChangeExtension(char* path, char* extension)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char* Path::Combine(char* path1, char* path2)
|
char* Path::Combine(char* path1, char* path2)
|
||||||
@ -111,13 +99,11 @@ namespace System
|
|||||||
}
|
}
|
||||||
|
|
||||||
part_num = atoi(szPartition + 19);
|
part_num = atoi(szPartition + 19);
|
||||||
#ifdef _XBOX
|
|
||||||
if (part_num >= 6)
|
if (part_num >= 6)
|
||||||
{
|
{
|
||||||
*cDriveLetter = extendPartitionMapping[part_num-6];
|
*cDriveLetter = extendPartitionMapping[part_num-6];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
for (unsigned int i=0; i < NUM_OF_DRIVES; i++)
|
for (unsigned int i=0; i < NUM_OF_DRIVES; i++)
|
||||||
if (strnicmp(driveMapping[i].szDevice, szPartition, strlen(driveMapping[i].szDevice)) == 0)
|
if (strnicmp(driveMapping[i].szDevice, szPartition, strlen(driveMapping[i].szDevice)) == 0)
|
||||||
{
|
{
|
||||||
@ -130,31 +116,21 @@ namespace System
|
|||||||
char *Path::GetInvalidFileNameChars()
|
char *Path::GetInvalidFileNameChars()
|
||||||
{
|
{
|
||||||
// return a new array as we do not want anyone to be able to change the values
|
// return a new array as we do not want anyone to be able to change the values
|
||||||
#if ENABLE_XBOX
|
|
||||||
char invChars[41] = { '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07',
|
char invChars[41] = { '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07',
|
||||||
'\x08', '\x09', '\x0A', '\x0B', '\x0C', '\x0D', '\x0E', '\x0F', '\x10', '\x11', '\x12',
|
'\x08', '\x09', '\x0A', '\x0B', '\x0C', '\x0D', '\x0E', '\x0F', '\x10', '\x11', '\x12',
|
||||||
'\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1A', '\x1B', '\x1C', '\x1D',
|
'\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1A', '\x1B', '\x1C', '\x1D',
|
||||||
'\x1E', '\x1F', '\x22', '\x3C', '\x3E', '\x7C', ':', '*', '?', '\\', '/' };
|
'\x1E', '\x1F', '\x22', '\x3C', '\x3E', '\x7C', ':', '*', '?', '\\', '/' };
|
||||||
return invChars;
|
return invChars;
|
||||||
#else
|
|
||||||
char invChars[2] = { '\x00', '/' };
|
|
||||||
return invChars;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *Path::GetInvalidPathChars()
|
char *Path::GetInvalidPathChars()
|
||||||
{
|
{
|
||||||
// return a new array as we do not want anyone to be able to change the values
|
// return a new array as we do not want anyone to be able to change the values
|
||||||
#if ENABLE_XBOX
|
|
||||||
char invChars[36] = { '\x22', '\x3C', '\x3E', '\x7C', '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07',
|
char invChars[36] = { '\x22', '\x3C', '\x3E', '\x7C', '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07',
|
||||||
'\x08', '\x09', '\x0A', '\x0B', '\x0C', '\x0D', '\x0E', '\x0F', '\x10', '\x11', '\x12',
|
'\x08', '\x09', '\x0A', '\x0B', '\x0C', '\x0D', '\x0E', '\x0F', '\x10', '\x11', '\x12',
|
||||||
'\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1A', '\x1B', '\x1C', '\x1D',
|
'\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1A', '\x1B', '\x1C', '\x1D',
|
||||||
'\x1E', '\x1F' };
|
'\x1E', '\x1F' };
|
||||||
return invChars;
|
return invChars;
|
||||||
#else
|
|
||||||
char invChar[1] = { '\x00' };
|
|
||||||
return invChar;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,168 +29,249 @@
|
|||||||
|
|
||||||
namespace System
|
namespace System
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// SystemException
|
||||||
|
//
|
||||||
SystemException::SystemException()
|
SystemException::SystemException()
|
||||||
|
Exception()
|
||||||
{
|
{
|
||||||
_message = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemException::SystemException(char* message)
|
SystemException::SystemException(char* message)
|
||||||
|
: Exception(message)
|
||||||
{
|
{
|
||||||
_message = message;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemException::SystemException(char* message, Exception innerException)
|
SystemException::SystemException(char* message, Exception* innerException)
|
||||||
|
: Exception(message, innerException)
|
||||||
{
|
{
|
||||||
_message = message;
|
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// AccessViolationException
|
||||||
|
//
|
||||||
AccessViolationException::AccessViolationException()
|
AccessViolationException::AccessViolationException()
|
||||||
|
: SystemException()
|
||||||
{
|
{
|
||||||
_message = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AccessViolationException::AccessViolationException(char* message)
|
AccessViolationException::AccessViolationException(char* message)
|
||||||
|
: SystemException(message)
|
||||||
{
|
{
|
||||||
_message = message;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AppDomainUnloadedException::AppDomainUnloadedException()
|
AccessViolationException::AccessViolationException(char* message, Exception* innerException)
|
||||||
|
: SystemException(message, innerException)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// AppDomainUnloadedException
|
||||||
|
//
|
||||||
|
AppDomainUnloadedException::AppDomainUnloadedException()
|
||||||
|
: SystemException()
|
||||||
{
|
{
|
||||||
_message = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AppDomainUnloadedException::AppDomainUnloadedException(char* message)
|
AppDomainUnloadedException::AppDomainUnloadedException(char* message)
|
||||||
|
: SystemException(message)
|
||||||
{
|
{
|
||||||
_message = message;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ArgumentException::ArgumentException()
|
AppDomainUnloadedException::AppDomainUnloadedException(char* message, Exception* innerException)
|
||||||
|
: SystemException(message, innerException)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// ArgumentException
|
||||||
|
//
|
||||||
|
ArgumentException::ArgumentException()
|
||||||
|
: SystemException()
|
||||||
{
|
{
|
||||||
_message = "";
|
|
||||||
_paramName = "";
|
_paramName = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
ArgumentException::ArgumentException(char* message)
|
ArgumentException::ArgumentException(char* message)
|
||||||
|
: SystemException(message);
|
||||||
{
|
{
|
||||||
_message = message;
|
|
||||||
_paramName = "";
|
_paramName = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
ArgumentException::ArgumentException(char* message, char* paramName)
|
ArgumentException::ArgumentException(char* message, char* paramName)
|
||||||
|
: SystemException(message)
|
||||||
{
|
{
|
||||||
_message = message;
|
|
||||||
_paramName = paramName;
|
_paramName = paramName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ArgumentException::ArgumentException(char* message, char* paramName, Exception* innerException)
|
||||||
|
: SystemException(message, innerException)
|
||||||
|
{
|
||||||
|
_paramName = paramName;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// ArgumentNullException
|
||||||
|
//
|
||||||
ArgumentNullException::ArgumentNullException()
|
ArgumentNullException::ArgumentNullException()
|
||||||
|
: ArgumentException()
|
||||||
{
|
{
|
||||||
_message = "";
|
|
||||||
_paramName = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ArgumentNullException::ArgumentNullException(char* message)
|
ArgumentNullException::ArgumentNullException(char* paramName)
|
||||||
|
: ArgumentException(paramName)
|
||||||
{
|
{
|
||||||
_message = message;
|
|
||||||
_paramName = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ArgumentNullException::ArgumentNullException(char* message, char* paramName)
|
ArgumentNullException::ArgumentNullException(char* paramName, char* message)
|
||||||
|
: ArgumentException(message, paramName)
|
||||||
{
|
{
|
||||||
_message = message;
|
|
||||||
_paramName = paramName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ArgumentNullException::ArgumentNullException(char* message, Exception* innerException)
|
||||||
|
: ArgumentException(message, innerException)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// ArgumentOutOfRangeException
|
||||||
|
//
|
||||||
ArgumentOutOfRangeException::ArgumentOutOfRangeException()
|
ArgumentOutOfRangeException::ArgumentOutOfRangeException()
|
||||||
|
: ArgumentException(RangeMessage())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ArgumentOutOfRangeException::ArgumentOutOfRangeException(char* paramName)
|
||||||
|
: ArgumentException(RangeMessage(), paramName)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ArgumentOutOfRangeException::ArgumentOutOfRangeException(char* message, Exception* innerException)
|
||||||
|
: ArgumentException(message, innerException)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ArgumentOutOfRangeException::ArgumentOutOfRangeException(char* paramName, char* message)
|
ArgumentOutOfRangeException::ArgumentOutOfRangeException(char* paramName, char* message)
|
||||||
|
: ArgumentException(message, paramName)
|
||||||
{
|
{
|
||||||
_message = message;
|
|
||||||
_paramName = paramName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ArgumentOutOfRangeException::ArgumentOutOfRangeException(char* paramName, void* object, char* message)
|
ArgumentOutOfRangeException::ArgumentOutOfRangeException(char* paramName, Object* actualValue, char* message)
|
||||||
|
: ArgumentException(message, paramName)
|
||||||
{
|
{
|
||||||
_message = message;
|
_actualValue = actualValue;
|
||||||
_paramName = paramName;
|
}
|
||||||
|
|
||||||
|
Object* ArgumentOutOfRangeException::ActualValue()
|
||||||
|
{
|
||||||
|
return _actualValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* ArgumentOutOfRangeException::RangeMessage()
|
||||||
|
{
|
||||||
|
if (_rangeMessage == null)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return _rangeMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
IndexOutOfRangeException::IndexOutOfRangeException()
|
IndexOutOfRangeException::IndexOutOfRangeException()
|
||||||
|
: SystemException()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
IndexOutOfRangeException::IndexOutOfRangeException(char* message)
|
IndexOutOfRangeException::IndexOutOfRangeException(char* message)
|
||||||
|
: SystemException(message)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
IndexOutOfRangeException::IndexOutOfRangeException(char* message, Exception* innerException)
|
||||||
|
: SystemException(message, innerException)
|
||||||
{
|
{
|
||||||
_message = message;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
InvalidOperationException::InvalidOperationException()
|
InvalidOperationException::InvalidOperationException()
|
||||||
|
: SystemException()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
InvalidOperationException::InvalidOperationException(char* message)
|
InvalidOperationException::InvalidOperationException(char* message)
|
||||||
|
: SystemException(message)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
InvalidOperationException::InvalidOperationException(char* message, Exception* innerException)
|
||||||
|
: SystemException(message, innerException)
|
||||||
{
|
{
|
||||||
_message = message;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NotImplementedException::NotImplementedException()
|
NotImplementedException::NotImplementedException()
|
||||||
|
: SystemException()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
NotImplementedException::NotImplementedException(char* message)
|
NotImplementedException::NotImplementedException(char* message)
|
||||||
|
: SystemException(message)
|
||||||
{
|
{
|
||||||
_message = message;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NotImplementedException::NotImplementedException(char* message, Exception innerException)
|
NotImplementedException::NotImplementedException(char* message, Exception* innerException)
|
||||||
|
: SystemException(message, innerException)
|
||||||
{
|
{
|
||||||
_message = message;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NotSupportedException::NotSupportedException()
|
NotSupportedException::NotSupportedException()
|
||||||
|
: SystemException()
|
||||||
{
|
{
|
||||||
_message = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NotSupportedException::NotSupportedException(char* message)
|
NotSupportedException::NotSupportedException(char* message)
|
||||||
|
: SystemException(message)
|
||||||
{
|
{
|
||||||
_message = message;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NotSupportedException::NotSupportedException(char* message, Exception innerException)
|
NotSupportedException::NotSupportedException(char* message, Exception* innerException)
|
||||||
|
: SystemException(message, innerException)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ObjectDisposedException::ObjectDisposedException()
|
||||||
|
: InvalidOperationException()
|
||||||
{
|
{
|
||||||
_message = message;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectDisposedException::ObjectDisposedException(char* objectName)
|
ObjectDisposedException::ObjectDisposedException(char* objectName)
|
||||||
{
|
{
|
||||||
_objectName = objectName;
|
_objectName = objectName;
|
||||||
|
_message = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
ObjectDisposedException::ObjectDisposedException(char* message, Exception* innerException)
|
||||||
|
: InvalidOperationException(message, innerException)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectDisposedException::ObjectDisposedException(char* objectName, char* message)
|
ObjectDisposedException::ObjectDisposedException(char* objectName, char* message)
|
||||||
|
: InvalidOperationException(message)
|
||||||
{
|
{
|
||||||
_objectName = objectName;
|
_objectName = objectName;
|
||||||
_message = message;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char* ObjectDisposedException::ObjectName()
|
char* ObjectDisposedException::ObjectName()
|
||||||
{
|
{
|
||||||
|
if (_objectName == null)
|
||||||
|
return "";
|
||||||
return _objectName;
|
return _objectName;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnauthorizedAccessException::UnauthorizedAccessException()
|
UnauthorizedAccessException::UnauthorizedAccessException()
|
||||||
|
: SystemException()
|
||||||
{
|
{
|
||||||
_message = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UnauthorizedAccessException::UnauthorizedAccessException(char* message)
|
UnauthorizedAccessException::UnauthorizedAccessException(char* message)
|
||||||
|
: SystemException(message)
|
||||||
{
|
{
|
||||||
_message = message;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UnauthorizedAccessException::UnauthorizedAccessException(char* message, Exception inner)
|
UnauthorizedAccessException::UnauthorizedAccessException(char* message, Exception* inner)
|
||||||
|
: SystemException(message, inner)
|
||||||
{
|
{
|
||||||
_message = message;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@
|
|||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\libSystem\Exception.cpp"
|
RelativePath=".\Exception.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
|
@ -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 -lstdc++ -lgcc
|
LD_LIBS = $(LD_DIRS) -lm -lopenxdk -lhal -lc -lusb -lc -lxboxkrnl -lc -lhal -lxboxkrnl -lhal -lopenxdk -lc -lstdc++ -lgcc
|
||||||
|
|
||||||
OBJS = Array.o BinaryReader.o BitConverter.o Buffer.o Calendar.o DateTime.o Decoder.o Dictionary.o Directory.o Encoder.o Environment.o Exception.o File.o FileStream.o HashHelpers.o KeyNotFoundException.o KeyValuePair.o List.o Math.o MemoryStream.o Path.o Stream.o StreamAsyncResult.o StreamReader.o StreamWriter.o Thread.o TimeSpan.o Version.o
|
OBJS = Array.o BinaryReader.o BitConverter.o Buffer.o Calendar.o Comparer.o DateTime.o Decoder.o Dictionary.o Directory.o Encoder.o Environment.o Exception.o File.o FileStream.o HashHelpers.o KeyNotFoundException.o KeyValuePair.o List.o Math.o MemoryStream.o Path.o Stream.o StreamAsyncResult.o StreamReader.o StreamWriter.o Thread.o TimeSpan.o Version.o
|
||||||
|
|
||||||
all: libmscorlib.a
|
all: libmscorlib.a
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user