1
0
mirror of https://github.com/Halofreak1990/XFXFramework synced 2024-12-26 13:49:34 +01:00

Added the current XFX directory tree.

WARNING!!! This revision cannot compile correctly. It is updated to reflect the many changes within the XFX project.
This commit is contained in:
Halofreak1990 2010-12-04 16:14:34 +00:00
commit 8f089dc2ab
277 changed files with 39181 additions and 0 deletions

51
XFX.sln Normal file
View File

@ -0,0 +1,51 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libXFX", "src\libXFX\libXFX.vcproj", "{379FFCFD-88FA-46D6-A686-CAE8F58652FC}"
ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.Debug = "False"
EndProjectSection
ProjectSection(ProjectDependencies) = postProject
{B7A9CAB6-B307-4A2E-A01F-970F9A8B044E} = {B7A9CAB6-B307-4A2E-A01F-970F9A8B044E}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libXFX.Game", "src\libXFX.Game\libXFX.Game.vcproj", "{467C54AE-676B-4D1A-AB8E-60B930F09FB1}"
ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.Debug = "False"
EndProjectSection
ProjectSection(ProjectDependencies) = postProject
{B7A9CAB6-B307-4A2E-A01F-970F9A8B044E} = {B7A9CAB6-B307-4A2E-A01F-970F9A8B044E}
{379FFCFD-88FA-46D6-A686-CAE8F58652FC} = {379FFCFD-88FA-46D6-A686-CAE8F58652FC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmscorlib", "src\libmscorlib\libmscorlib.vcproj", "{B7A9CAB6-B307-4A2E-A01F-970F9A8B044E}"
ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.Debug = "False"
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{379FFCFD-88FA-46D6-A686-CAE8F58652FC}.Debug|Win32.ActiveCfg = Debug|Win32
{379FFCFD-88FA-46D6-A686-CAE8F58652FC}.Debug|Win32.Build.0 = Debug|Win32
{379FFCFD-88FA-46D6-A686-CAE8F58652FC}.Release|Win32.ActiveCfg = Release|Win32
{379FFCFD-88FA-46D6-A686-CAE8F58652FC}.Release|Win32.Build.0 = Release|Win32
{467C54AE-676B-4D1A-AB8E-60B930F09FB1}.Debug|Win32.ActiveCfg = Debug|Win32
{467C54AE-676B-4D1A-AB8E-60B930F09FB1}.Debug|Win32.Build.0 = Debug|Win32
{467C54AE-676B-4D1A-AB8E-60B930F09FB1}.Release|Win32.ActiveCfg = Release|Win32
{467C54AE-676B-4D1A-AB8E-60B930F09FB1}.Release|Win32.Build.0 = Release|Win32
{B7A9CAB6-B307-4A2E-A01F-970F9A8B044E}.Debug|Win32.ActiveCfg = Debug|Win32
{B7A9CAB6-B307-4A2E-A01F-970F9A8B044E}.Debug|Win32.Build.0 = Debug|Win32
{B7A9CAB6-B307-4A2E-A01F-970F9A8B044E}.Release|Win32.ActiveCfg = Release|Win32
{B7A9CAB6-B307-4A2E-A01F-970F9A8B044E}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

27
include/Audio.h Normal file
View File

@ -0,0 +1,27 @@
#ifndef XFRAMEWORK_AUDIO_H
#define XFRAMEWORK_AUDIO_H
#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
//
#include "AudioStopOptions.h"
//
//Interfaces
//
#endif
#endif //XFRAMEWORK_AUDIO_H

View File

@ -0,0 +1,19 @@
#ifndef XFRAMEWORK_AUDIOCATEGORY_H
#define XFRAMEWORK_AUDIOCATEGORY_H
namespace XFramework::Audio
{
struct AudioCategory
{
char* Name;
void Pause();
int operator!=(AudioCategory &other);
int operator==(AudioCategory &other);
void Resume();
void SetVolume(float volume);
void Stop();
};
}
#endif //XFRAMEWORK_AUDIOCATEGORY_H

View File

@ -0,0 +1,33 @@
/********************************************************
* AudioEmitter.h *
* *
* XFX AudioEmitter definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef AUDIOEMITTER_H
#define AUDIOEMITTER_H
#include "System/System.h"
namespace XFX
{
namespace Audio
{
class Vector3;
class Audioemitter
{
public:
float DopplerScale;
Vector3 Forward;
Vector3 Position;
Vector3 Up;
Vector3 Velocity;
AudioEmitter();
}
}
}
#endif //AUDIOEMITTER_H

View File

@ -0,0 +1,39 @@
/********************************************************
* AudioEngine.h *
* *
* XFramework AudioEngine definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef XFRAMEWORK_AUDIOENGINE_H
#define XFRAMEWORK_AUDIOENGINE_H
#include "System/System.h"
namespace XFramework
{
namespace Audio
{
class AudioCategory;
class AudioEngine
{
protected:
virtual void Dispose(int disposing);
public:
const int ContentVersion; //XACT version supported
AudioEngine(); //Initialize the audio engine for direct wav play.
AudioEngine(char* settingsFile); //Initialize the audio engine for XACT
AudioEngine(char* settingsFile, Timespan &lookAheadTime, char* rendererId);
void Dispose();
AudioCategory GetCategory(char* name);
float GetGlobalVariable(char* name);
void SetGlobalVariable(char* name, float value);
void Update();
};
}
}
#endif //XFRAMEWORK_AUDIOENGINE_H

View File

@ -0,0 +1,32 @@
/********************************************************
* AudioListener.h *
* *
* XFramework AudioListener definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef XFRAMEWORK_AUDIOLISTENER_H
#define XFRAMEWORK_AUDIOLISTENER_H
#include "System/System.h"
namespace XFramework
{
class Vector3;
namespace Audio
{
class AudioListener
{
public:
Vector3 Forward;
Vector3 Position;
Vector3 Up;
Vector3 Velocity;
AudioListener();
}
}
}
#endif //XFRAMEWORK_AUDIOLISTENER_H

View File

@ -0,0 +1,22 @@
/********************************************************
* AudioStopOptions.h *
* *
* XFramework AudioStopOptions definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef XFRAMEWORK_AUDIOSTOPOPTIONS_H
#define XFRAMEWORK_AUDIOSTOPOPTIONS_H
namespace XFramework
{
namespace Audio
{
enum AudiostopOptions
{
AsAuthored,
Immediate
};
}
}
#endif //XFRAMEWORK_AUDIOSTOPOPTIONS_H

40
include/Audio/Cue.h Normal file
View File

@ -0,0 +1,40 @@
/********************************************************
* Cue.h *
* *
* XFramework Cue definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef XFRAMEWORK_CUE_H
#define XFRAMEWORK_CUE_H
namespace XFramework
{
namespace Audio
{
class AudioEmitter;
class AudioListener;
class Cue
{
private:
int isPaused;
int isPlaying;
int isStopped;
public:
int IsPaused();
int IsPlaying();
int IsStopped();
char* Name;
void Apply3D(AudioListener &listener, AudioEmitter &emitter);
float GetVariable(char* name);
void Pause();
void Play();
void SetVariable(char* name, float value);
void Stop();
};
}
}
#endif //XFRAMEWORK_CUE_H

View File

@ -0,0 +1,14 @@
#ifndef XFRAMEWORK_SOUNDSTATE_H
#define XFRAMEWORK_SOUNDSTATE_H
namespace XFramework::Audio
{
enum SoundState
{
Paused,
Playing,
Stopped
};
}
#endif //XFRAMEWORK_SOUNDSTATE_H

26
include/Audio/Soundbank.h Normal file
View File

@ -0,0 +1,26 @@
#ifndef XFRAMEWORK_SOUNDBANK_H
#define XFRAMEWORK_SOUNDBANK_H
#include "AudioEmitter.h"
#include "AudioEngine.h"
#include "AudioListener.h"
#include "Cue.h"
namespace XFramework::Audio
{
class SoundBank
{
protected:
void Dispose(int disposing);
public:
int IsInUse;
void Dispose();
Cue GetCue(char* name);
void PlayCue(char* name);
void PlayCue(char *name, AudioListener listener, AudioEmitter emitter);
SoundBank(AudioEngine audioEngine, char* filename);
};
}
#endif //XFRAMEWORK_SOUNDBANK_H

30
include/Audio/WaveBank.h Normal file
View File

@ -0,0 +1,30 @@
#ifndef XFRAMEWORK_WAVEBANK_H
#define XFRAMEWORK_WAVEBANK_H
#include "AudioEngine.h"
#include "../Net_Framework/System.h"
namespace XFramework::Audio
{
class WaveBank
{
private:
int isDisposed;
int isInUse;
int isPrepared;
protected:
void Dispose(int disposing);
public:
int IsDisposed();
int IsInUse();
int IsPrepared();
void Dispose();
WaveBank(AudioEngine audioEngine, char* nonStreamingWaveBankFilename);
WaveBank(AudioEngine audioEngine, char* streamingWaveBankFilename, int offset, short packetsize);
}
}
#endif //XFRAMEWORK_WAVEBANK_H

28
include/Audio/XACT.h Normal file
View File

@ -0,0 +1,28 @@
/********************************************************
* XACT.h *
* *
* XFramework XACT specification file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef XFRAMEWORK_XACT_H
#define XFRAMEWORK_XACT_H
//The header in an XACT Settings (XGS) file
struct XGSHeader
{
char magic[4]; //XGSF
}
//The header in a Sound Bank (XSB) file
struct XSBHeader
{
char magic[4]; //SDBK
}
//The header in a Wave Bank (XWB) file
struct XWBHeader
{
char magic[4];
}
#endif

31
include/Audio/wave.h Normal file
View File

@ -0,0 +1,31 @@
#include <hal/io.h>
#include <stdio.h>
#pragma pack(1)
struct WAV_Head
{
char ChunkID[4]; //"RIFF"
unsigned int ChunkSize;
char Format[4]; //"WAVE"
char Subchunk1ID[4]; //"fmt "
unsigned int Subchunk1Size;
short int AudioFormat;
short int NumChannels;
unsigned int SampleRate;
unsigned int ByteRate;
short int BlockAlign;
short int BitsPerSample;
char Subchunk2ID[4]; //"data"
unsigned int Subchunk2Size;
};
#pragma pack()
void Load_Wave(char* fileName, WAV_Head wavHead)
{
// Read in our header information
FILE* fp = fopen("test.wav", "rb");
fread(&wavHead, 1, sizeof(wavHead), fp);
fclose(fp);
}

61
include/BoundingBox.h Normal file
View File

@ -0,0 +1,61 @@
/********************************************************
* BoundingBox.h *
* *
* XFX BoundingBox definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _BOUNDINGBOX_
#define _BOUNDINGBOX_
#include <System/Types.h>
#include "Enums.h"
#include "Vector3.h"
namespace XFX
{
struct BoundingSphere;
struct Plane;
struct Ray;
/// <summary>
/// Defines an axis-aligned box-shaped 3D volume.
/// </summary>
struct BoundingBox
{
public:
Vector3 Max;
Vector3 Min;
static const int CornerCount;
BoundingBox(Vector3 min, Vector3 max);
BoundingBox(const BoundingBox &obj);
BoundingBox();
ContainmentType_t Contains(BoundingBox box);
void Contains(BoundingBox box, out ContainmentType_t result);
ContainmentType_t Contains(BoundingSphere sphere);
void Contains(BoundingSphere sphere, out ContainmentType_t result);
ContainmentType_t Contains(Vector3 vector);
void Contains(Vector3 vector, out ContainmentType_t result);
static BoundingBox CreateFromPoints(Vector3 points[]);
static BoundingBox CreateFromSphere(BoundingSphere sphere);
static void CreateFromSphere(BoundingSphere sphere, out BoundingBox result);
static BoundingBox CreateMerged(BoundingBox box1, BoundingBox box2);
static void CreateMerged(BoundingBox box1, BoundingBox box2, out BoundingBox result);
bool Equals(BoundingBox obj);
int Intersects(BoundingBox box);
void Intersects(BoundingBox box, out int result);
int Intersects(BoundingSphere sphere);
void Intersects(BoundingSphere sphere, out int result);
PlaneIntersectionType_t Intersects(Plane plane);
void Intersects(Plane plane, out PlaneIntersectionType_t result);
float Intersects(Ray ray);
void Intersects(Ray ray, out float distance);
bool operator!=(const BoundingBox other);
bool operator==(const BoundingBox other);
BoundingBox operator=(const BoundingBox other);
};
}
#endif //_BOUNDINGBOX_

View File

@ -0,0 +1,85 @@
/********************************************************
* BoundingFrustrum.h *
* *
* XFX BoundingFrustrum definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_BOUNDINGFRUSTRUM_
#define _XFX_BOUNDINGFRUSTRUM_
#include "Enums.h"
#include "Matrix.h"
#include "Plane.h"
#include <System/Types.h>
namespace XFX
{
struct BoundingBox;
struct BoundingSphere;
struct Ray;
struct Vector3;
/// <summary>
/// Defines a frustum and helps determine whether forms intersect with it.
/// </summary>
class BoundingFrustrum
{
private:
static const int BottomPlaneIndex;
Vector3 cornerArray[8];
static const int FarPlaneIndex;
static const int LeftPlaneIndex;
Matrix matrix;
static const int NearPlaneIndex;
static const int NumPlanes;
Plane planes[6];
static const int RightPlaneIndex;
static const int TopPlaneIndex;
static Vector3 ComputeIntersection(Plane plane, Ray ray);
static Ray ComputeIntersectionLine(Plane p1, Plane p2);
void SetMatrix(Matrix value);
void SupportMapping(Vector3 v, out Vector3 result);
public:
Plane Bottom();
static const int CornerCount;
Plane Far();
Plane Left();
Matrix Matrix_();
void Matrix_(Matrix value);
Plane Near();
Plane Right();
Plane Top();
BoundingFrustrum();
BoundingFrustrum(Matrix value);
BoundingFrustrum(const BoundingFrustrum &obj); // copy constructor
ContainmentType_t Contains(BoundingBox box);
ContainmentType_t Contains(BoundingFrustrum frustrum);
ContainmentType_t Contains(BoundingSphere sphere);
ContainmentType_t Contains(Vector3 point);
void Contains(BoundingBox box, out ContainmentType_t result);
void Contains(BoundingSphere sphere, out ContainmentType_t result);
void Contains(Vector3 point, out ContainmentType_t result);
bool Equals(BoundingFrustrum other);
Vector3* GetCorners();
void GetCorners(Vector3 corners[]);
int GetHashCode();
bool Intersects(BoundingBox box);
bool Intersects(BoundingFrustrum frustrum);
bool Intersects(BoundingSphere sphere);
PlaneIntersectionType_t Intersects(Plane plane);
float Intersects(Ray ray);
void Intersects(BoundingBox box, out bool result);
void Intersects(BoundingSphere sphere, out bool result);
void Intersects(Plane plane, out PlaneIntersectionType_t result);
void Intersects(Ray ray, out float result);
bool operator==(BoundingFrustrum other);
bool operator!=(BoundingFrustrum other);
};
}
#endif //_XFX_BOUNDINGFRUSTRUM_

34
include/BoundingSphere.h Normal file
View File

@ -0,0 +1,34 @@
/********************************************************
* BoundingSphere.h *
* *
* XFX BoundingSphere definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_BOUNDINGSPHERE_
#define _XFX_BOUNDINGSPHERE_
#include <System/Types.h>
#include "Vector3.h"
namespace XFX
{
/// <summary>
/// Defines a sphere.
/// </summary>
class BoundingSphere
{
public:
Vector3 Center;
float Radius;
BoundingSphere(Vector3 center, float radius);
BoundingSphere(const BoundingSphere &obj);
BoundingSphere();
int operator==(const BoundingSphere other);
int operator!=(const BoundingSphere other);
BoundingSphere operator=(const BoundingSphere other);
};
}
#endif //_XFX_BOUNDINGSPHERE_

View File

@ -0,0 +1,23 @@
#ifndef _CONTENT_CONTENTLOADEXCEPTION_
#define _CONTENT_CONTENTLOADEXCEPTION_
#include <System/Exception.h>
#include <System/Types.h>
using namespace System;
namespace XFX
{
namespace Content
{
class ContentLoadException : public Exception
{
public:
ContentLoadException();
ContentLoadException(char* message);
ContentLoadException(char* message, Exception innerException);
};
}
}
#endif //_CONTENT_CONTENTLOADEXCEPTION_

View File

@ -0,0 +1,58 @@
/********************************************************
* ContentManager.h *
* *
* XFX ContentManager definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_CONTENT_CONTENTMANAGER_
#define _XFX_CONTENT_CONTENTMANAGER_
#include <System/Collections/Generic/Dictionary.h>
#include <System/Collections/Generic/List.h>
#include <System/IO/Stream.h>
#include <System/Interfaces.h>
#include <System/String.h>
#include <System/Types.h>
using namespace System;
using namespace System::Collections::Generic;
using namespace System::IO;
namespace XFX
{
namespace Content
{
/// <summary>
/// The ContentManager is the run-time component which loads managed
/// objects from the binary files produced by the design time content pipeline.
/// It also manages the lifespan of the loaded objects, disposing the content
/// manager will also dispose any assets which are themselves System.IDisposable.
/// </summary>
class ContentManager : public IDisposable
{
private:
List<IDisposable*> disposableAssets;
bool disposed;
protected:
virtual void Dispose(bool disposing);
virtual Stream OpenStream(char* assetName);
template <class T>
T ReadAsset(char* assetName); //! usage: T ReadAsset<T>(assetName); where T is the preferred type, i.e. Texture2D
public:
char* RootDirectory;
ContentManager();
ContentManager(char* rootDirectory);
virtual ~ContentManager();
void Dispose();
template <class T>
T Load(char* assetName); //! usage: T Load<T>(assetName); where T is the preferred type, i.e. Texture2D
virtual void Unload();
};
}
}
#endif //_XFX_CONTENT_CONTENTMANAGER_

View File

@ -0,0 +1,74 @@
/********************************************************
* ContentReader.h *
* *
* XFX ContentReader class definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _CONTENT_CONTENTREADER_
#define _CONTENT_CONTENTREADER_
#include <System/IO/BinaryReader.h>
#include <Content/ContentManager.h>
#include <Graphics/GraphicsDevice.h>
using namespace System::IO;
using namespace XFX::Graphics;
namespace XFX
{
struct Matrix;
struct Quaternion;
struct Vector2;
struct Vector3;
struct Vector4;
namespace Content
{
class ContentTypeReader;
/// <summary>
/// A worker object that implements most of ContentManager.Load. A new
/// ContentReader is constructed for each asset loaded.
/// </summary>
class ContentReader : public BinaryReader
{
private:
ContentManager contentManager;
GraphicsDevice _graphicsDevice;
char* _assetName;
static const short XnbVersion;
static Stream PrepareStream(Stream stream, char* assetName);
public:
ContentReader(ContentManager manager, Stream stream, GraphicsDevice graphicsDevice);
ContentReader(ContentManager manager, Stream input, char* assetName);
template <class T>
T ReadExternalReference();
Matrix ReadMatrix();
template <class T>
T ReadObject();
template <class T>
T ReadObject(T existingInstance);
template <class T>
T ReadObject(ContentTypeReader typeReader);
template <class T>
T ReadObject(ContentTypeReader typeReader, T existingInstance);
Quaternion ReadQuaternion();
template <class T>
T ReadRawObject();
template <class T>
T ReadRawObject(ContentTypeReader typeReader);
template <class T>
T ReadRawObject(T existingInstance);
template <class T>
T ReadRawObject(ContentTypeReader typeReader, T existingInstance);
Vector2 ReadVector2();
Vector3 ReadVector3();
Vector4 ReadVector4();
};
}
}
#endif //_CONTENTREADER_

110
include/Enums.h Normal file
View File

@ -0,0 +1,110 @@
/********************************************************
* Enums.h *
* *
* XFX enumeration definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_ENUMS_
#define _XFX_ENUMS_
namespace XFX
{
/// <summary>
/// Describes how one bounding volume contains another.
/// </summary>
struct ContainmentType
{
enum type
{
Contains,
Disjoint,
Intersects
};
};
/// <summary>
/// Defines the continuity of CurveKeys on a Curve.
/// </summary>
struct CurveContinuity
{
enum type
{
Smooth,
Step
};
};
/// <summary>
/// Defines how the value of a Curve will be determined for positions before
/// the first point on the Curve or after the last point on the Curve.
/// </summary>
struct CurveLoopType
{
enum type
{
Constant,
Cycle,
CycleOffset,
Linear,
Oscillate
};
};
/// <summary>
/// Specifies different tangent types to be calculated for CurveKey points in a Curve.
/// </summary>
struct CurveTangent
{
enum type
{
Flat,
Linear,
Smooth
};
};
/// <summary>
/// Describes the intersection between a plane and a bounding volume.
/// </summary>
struct PlaneIntersectionType
{
enum type
{
Back,
Front,
Intersecting
};
};
/// <summary>
/// Specifies the index of a player.
/// </summary>
struct PlayerIndex
{
enum type
{
One,
Two,
Three,
Four
};
};
/// <summary>
/// Defines the target platform to be used when compiling content.
/// </summary>
struct TargetPlatform
{
enum type
{
Unknown,
Linux,
XBOX
};
};
//Lots of typedefs, but there was no other way to make these enum hacks look good.
typedef ContainmentType::type ContainmentType_t;
typedef CurveContinuity::type CurveContinuity_t;
typedef CurveLoopType::type CurveLoopType_t;
typedef CurveTangent::type CurveTangent_t;
typedef PlaneIntersectionType::type PlaneIntersectionType_t;
typedef PlayerIndex::type PlayerIndex_t;
typedef TargetPlatform::type TargetPlatform_t;
}
#endif //_ENUMS_

168
include/Game.h Normal file
View File

@ -0,0 +1,168 @@
/********************************************************
* Game.h *
* *
* XFX Game class definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_GAME_
#define _XFX_GAME_
#include <System/Types.h>
#include <System/Delegates.h>
#include "Content/ContentManager.h"
#include "GameComponentCollection.h"
#include "GameServiceContainer.h"
#include "GameTime.h"
#include "Graphics/GraphicsDevice.h"
#include "Graphics/IGraphicsDeviceService.h"
#include "Interfaces.h"
using namespace System;
using namespace XFX::Content;
using namespace XFX::Graphics;
namespace XFX
{
/// <summary>
/// Provides basic graphics device initialization, game logic, and rendering code.
/// </summary>
class Game : public IDisposable
{
private:
bool exiting;
bool inRun;
bool isActive;
GameComponentCollection components;
List<IDrawable*> visibleDrawable;
List<IUpdateable*> enabledUpdateable;
GameServiceContainer services;
bool disposed;
GameTime gameTime;
TimeSpan inactiveSleepTime;
IGraphicsDeviceManager* graphicsManager;
IGraphicsDeviceService graphicsService;
#if !ENABLE_XBOX
private bool isMouseVisible;
#endif
static const Int64 DefaultTargetElapsedTicks;
protected:
virtual bool BeginDraw();
virtual void BeginRun();
virtual void Dispose(bool disposing);
virtual void Draw(GameTime gameTime);
virtual void EndDraw();
virtual void EndRun();
void Finalize();
virtual void LoadContent();
virtual void Initialize();
#if !ENABLE_XBOX
virtual void OnActivated(void* sender, EventArgs args);
virtual void OnDeactivated(void* sender, EventArgs args);
#endif
virtual void OnExiting(void* sender, EventArgs args);
virtual void UnloadContent();
virtual void Update(GameTime gameTime);
public:
GameComponentCollection Components();
ContentManager Content;
GraphicsDevice GraphicsDevice_();
GameServiceContainer Services();
bool IsActive();
bool IsFixedTimeStep;
bool IsMouseVisible;
TimeSpan TargetElapsedTime;
#if !ENABLE_XBOX
EventHandler Activated;
EventHandler Deactivated;
#endif
EventHandler Disposed;
EventHandler Exiting;
void Dispose();
void Exit();
Game();
void ResetElapsedTime();
void Run();
void SuppressDraw();
void Tick();
};
/// <summary>
/// Base class for all XNA Framework game components.
/// </summary>
class GameComponent : IGameComponent, IUpdateable, IDisposable
{
private:
Game _game;
bool _disposed;
bool _enabled;
int _updateOrder;
protected:
virtual void Dispose(bool disposing);
virtual ~GameComponent();
virtual void OnEnabledChanged(void* sender, EventArgs args);
virtual void OnUpdateOrderChanged(void* sender, EventArgs args);
public:
bool Enabled();
void Enabled(bool value);
int UpdateOrder();
void UpdateOrder(int value);
Game Game_();
EventHandler EnabledChanged;
EventHandler UpdateOrderChanged;
EventHandler Disposed;
GameComponent(Game game);
GameComponent();
virtual void Dispose();
virtual void Initialize();
virtual void Update(GameTime gameTime);
};
/// <summary>
/// A game component that is notified when it needs to draw itself.
/// </summary>
class DrawableGameComponent : GameComponent, IDrawable
{
private:
int _drawOrder;
bool _visible;
IGraphicsDeviceService _graphicsService;
protected:
void Dispose(bool disposing);
virtual void LoadContent();
virtual void OnDrawOrderChanged(void* sender, EventArgs args);
virtual void OnVisibleChanged(void* sender, EventArgs args);
virtual void UnloadContent();
public:
int DrawOrder();
void DrawOrder(int value);
GraphicsDevice GraphicsDevice_();
bool Visible();
void Visible(bool value);
EventHandler DrawOrderChanged;
EventHandler VisibleChanged;
DrawableGameComponent(Game game);
virtual void Draw(GameTime gameTime);
void Initialize();
virtual void Update(GameTime gameTime);
};
}
#endif //_XFX_GAME_

View File

@ -0,0 +1,31 @@
/********************************************************
* GameComponentCollection.h *
* *
* XFX GameComponentCollection definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_GAMECOMPONENTCOLLECTION_
#define _XFX_GAMECOMPONENTCOLLECTION_
#include "Interfaces.h"
namespace XFX
{
/// <summary>
/// A collection of game components.
/// </summary>
class GameComponentCollection
{
protected:
void ClearItems();
void InsertItem(int index, IGameComponent* item);
void RemoveItem(int index);
void SetItem(int index, IGameComponent* item);
public:
GameComponentCollection();
};
}
#endif //_XFX_GAMECOMPONENTCOLLECTION_

View File

@ -0,0 +1,30 @@
/********************************************************
* GameComponentCollectionEventArgs.h *
* *
* XFX GameComponentCollectionEventArgs definition *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_GAMECOMPONENTCOLLECTIONEVENTARGS_
#define _XFX_GAMECOMPONENTCOLLECTIONEVENTARGS_
#include "Interfaces.h"
#include <SYstem/EventArgs.h>
namespace XFX
{
/// <summary>
/// Arguments used with events from the GameComponentCollection.
/// </summary>
class GameComponentCollectionEventArgs : EventArgs
{
private:
IGameComponent _gameComponent;
public:
IGameComponent GameComponent_();
GameComponentCollectionEventArgs(IGameComponent gameComponent);
};
}
#endif //_XFX_GAMECOMPONENTCOLLECTIONEVENTARGS_

View File

@ -0,0 +1,45 @@
/********************************************************
* GamePadCapabilities.h *
* *
* XFX GamePadCapabilities definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef GAMEPADCAPABILITIES_H
#define GAMEPADCAPABILITIES_H
#include "GamePadType.h"
namespace XFX
{
namespace Input
{
struct GamePadCapabilities
{
GamePadType GamePadType;
int HasAButton;
int HasBButton;
int HasBackButton;
int HasDPadDownButton;
int HasDPadLeftButton;
int HasDPadRightButton;
int HasDPadUpButton;
int HasLeftStickButton;
int HasLeftTrigger;
int HasLeftVibrationMotor;
int HasLeftXThumbStick;
int HasLeftYThumbStick;
int HasRightStickButton;
int HasRightTrigger;
int HasRightVibrationMotor;
int HasRightXThumbStick;
int HasRightYThumbStick;
int HasStartButton;
int HasWhiteButton;
int HasXButton;
int HasYButton;
int IsConnected;
};
}
}
#endif //GAMEPADCAPABILITIES_H

37
include/GamePadDPad.h Normal file
View File

@ -0,0 +1,37 @@
/********************************************************
* GamePadDPad.h *
* *
* XFX GamePadDPad definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef GAMEPADDPAD_H
#define GAMEPADDPAD_H
#include "ButtonState.h"
namespace XFX
{
namespace Input
{
struct GamePadDPad
{
ButtonState Down;
ButtonState Left;
ButtonState Right;
ButtonState Up;
int operator!=(const GamePadDPad &other)
{
return !((Down == other.Down) && (Left == other.Left) &&
(Right == other.Right) && (Up == other.Up));
}
int operator==(const GamePadDPad &other)
{
return ((Down == other.Down) && (Left == other.Left) &&
(Right == other.Right) && (Up == other.Up));
}
};
}
}
#endif //GAMEPADDPAD_H

View File

@ -0,0 +1,34 @@
/********************************************************
* GamePadThumbSticks.h *
* *
* XFX GamePadThumbSticks definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef GAMEPADTHUMBSTICKS_H
#define GAMEPADTHUMBSTICKS_H
#include "Vector2.h"
namespace XFX
{
namespace Input
{
struct GamePadThumbSticks
{
Vector2 Left;
Vector2 Right;
int GamePadThumbSticks::operator!=(const GamePadThumbSticks &other)
{
return !((Left == other.Left) && (Right == other.Right));
}
int GamePadThumbSticks::operator==(const GamePadThumbSticks &other)
{
return ((Left == other.Left) && (Right == other.Right));
}
};
}
}
#endif //GAMEPADTHUMBSTICKS_H

31
include/GamePadTriggers.h Normal file
View File

@ -0,0 +1,31 @@
/********************************************************
* GamePadTriggers.h *
* *
* XFX GamePadTriggers definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef GAMEPADTRIGGERS_H
#define GAMEPADTRIGGERS_H
namespace XFX
{
namespace Input
{
struct GamePadTriggers
{
float Left;
float Right;
int operator!=(const GamePadTriggers &other)
{
return !((Left == other.Left) && (Right == other.Right));
}
int operator==(const GamePadTriggers &other)
{
return ((Left == other.Left) && (Right == other.Right));
}
};
}
}
#endif //GAMEPADTRIGGERS_H

View File

@ -0,0 +1,28 @@
/********************************************************
* GameServiceContainer.h *
* *
* XFX GameServiceContainer definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_GAMESERVICECONTAINER_
#define _XFX_GAMESERVICECONTAINER_
namespace XFX
{
/// <Summary>
/// A collection of game services.
/// </summary>
class GameServiceContainer
{
public:
template <class T>
void AddService(T type, void* provider);
GameServiceContainer();
template <class T>
void* GetService(T type);
template <class T>
void RemoveService(T type);
};
}
#endif //_XFX_GAMESERVICECONTAINER_H

42
include/GameTime.h Normal file
View File

@ -0,0 +1,42 @@
/********************************************************
* GameTime.h *
* *
* XFX GameTime definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_GAMETIME_
#define _XFX_GAMETIME_
#include <System/TimeSpan.h>
using namespace System;
namespace XFX
{
/// <summary>
/// Snapshot of the game timing state expressed in values that can be used by variable-step (real time) or fixed-
/// step (game time) games.
/// </summary>
class GameTime
{
private:
TimeSpan _elapsedGameTime;
TimeSpan _elapsedRealTime;
bool _isRunningSlowly;
TimeSpan _totalGameTime;
TimeSpan _totalRealTime;
public:
TimeSpan ElapsedGameTime();
TimeSpan ElapsedRealTime();
bool IsRunningSlowly();
TimeSpan TotalGameTime();
TimeSpan TotalRealTime();
GameTime(TimeSpan totalRealTime, TimeSpan elapsedRealTime, TimeSpan totalGameTime, TimeSpan elapsedGameTime);
GameTime(TimeSpan totalRealTime, TimeSpan elapsedRealTime, TimeSpan totalGameTime, TimeSpan elapsedGameTime, bool isRunningSlowly);
GameTime();
};
}
#endif //_XFX_GAMETIME_

View File

@ -0,0 +1,104 @@
#ifndef _GAMERSERVICES_ENUMS_H_
#define _GAMERSERVICES_ENUMS_H_
namespace XFX
{
namespace GamerServices
{
/// <summary>
/// Indicates how sensitive this gamer prefers controller input to be.
/// </summary>
struct ControllerSensitivity
{
enum type
{
High,
Low,
Medium
};
};
/// <summary>
/// Indicates how difficult this gamer likes things to be.
/// </summary>
struct GameDifficulty
{
enum type
{
Easy,
Hard,
Normal
};
};
/// <summary>
/// This style of social gaming preferred by this Xbox Live member.
/// </summary>
struct GamerZone
{
enum type
{
Family,
Pro,
Recreation,
Underground,
Unknown
};
};
/// <summary>
/// Defines the different icons for a message box.
/// </summary>
struct MessageBoxIcon
{
enum type
{
Alert,
Error,
None,
Warning
};
};
/// <summary>
/// Determines where notifications appear on the screen.
/// </summary>
struct NotificationPosition
{
enum type
{
BottomCenter,
BottomLeft,
BottomRight,
Center,
CenterLeft,
CenterRight,
TopCenter,
TopLeft,
TopRight
};
};
/// <summary>
/// Indicates which camera angle this gamer prefers to use in racing games.
/// </summary>
struct RacingCameraAngle
{
enum type
{
Back,
Front,
Inside
};
};
typedef ControllerSensitivity::type ControllerSensitivity_t;
typedef GameDifficulty::type GameDifficulty_t;
typedef GamerZone::type GamerZone_t;
typedef MessageBoxIcon::type MessageBoxIcon_t;
typedef NotificationPosition::type NotificationPosition_t;
typedef RacingCameraAngle::type RacingCameraAngle_t;
}
}
#endif //_GAMERSERVICES_ENUMS_H_

View File

View File

@ -0,0 +1,30 @@
/********************************************************
* GamerServicesComponent.h *
* *
* XFX GamerServicesComponent class definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_GAMERSERVICES_GAMERSERVICESCOMPONENT_
#define _XFX_GAMERSERVICES_GAMERSERVICESCOMPONENT_
#include "../Game.h"
namespace XFX
{
namespace GamerServices
{
/// <summary>
/// Creates a new GamerServicesComponent.
/// </summary>
class GamerServicesComponent : GameComponent
{
public:
GamerServicesComponent(Game game);
void Initialize();
void Update(GameTime gameTime);
};
}
}
#endif //_XFX_GAMERSERVICES_GAMERSERVICESCOMPONENT_

View File

@ -0,0 +1,44 @@
#ifndef _GUIDE_H_
#define _GUIDE_H_
#include <System.h>
/********************************************************
* Guide.h *
* *
* XFX Guide definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#include <Storage/StorageDevice.h>
using namespace System;
using namespace XFX::Storage;
namespace XFX
{
namespace GamerServices
{
/// <summary>
/// Provides access to the Guide user interface.
/// </summary>
class Guide
{
private:
static int _isVisible = false;
public:
static int IsScreenSaverEnabled();
static int IsVisible();
static NotificationPosition notificationPosition;
static IAsyncResult BeginShowKeyboardInput(PlayerIndex_t player, String &title, String &description, String &defaultText, AsyncCallback &callback, object state);
static IAsyncResult BeginShowStorageDeviceSelector(int sizeInBytes, int directoryCount, AsyncCallback callback, object state);
static IAsyncResult BeginShowStorageDeviceSelector(AsyncCallback &callback, object state);
static IAsyncResult BeginShowStorageDeviceSelector(PlayerIndex_t player, int sizeInBytes, int directoryCount, AsyncCallback callback, object state);
static IAsyncResult BeginShowStorageDeviceSelector(PlayerIndex_t player, AsyncCallback callback, object state);
static String EndShowKeyboardInput(IAsyncResult result);
static StorageDevice EndShowStorageDeviceSelector(IAsyncResult result)
};
}
}
#endif //_GUIDE_H_

32
include/Graphics.h Normal file
View File

@ -0,0 +1,32 @@
/********************************************************
* Graphics.h *
* *
* XFX::Graphics namespace include file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _GRAPHICS_
#define _GRAPHICS_
//
//Data Types
//
#include "Graphics/BasicDirectionalLight.h"
#include "Graphics/BasicEffect.h"
#include "Graphics/ClipPlane.h"
#include "Graphics/Color.h"
#include "Graphics/DisplayMode.h"
#include "Graphics/GraphicsDevice.h"
#include "Graphics/Texture.h"
#include "Graphics/Texture2D.h"
#include "Graphics/VertexElement.h"
#include "Graphics/VertexPositionTexture.h"
//
//Enums
//
#include "Graphics/Enums.h"
//
//Interfaces
//
#include "Graphics/IGraphicsDeviceservice.h"
#endif //_GRAPHICS_

View File

@ -0,0 +1,30 @@
/********************************************************
* BasicDirectionalLight.h *
* *
* BasicDirectionalLight definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _BASICDIRECTIONALLIGHT_H_
#define _BASICDIRECTIONALLICHT_H_
#include <Vector3.h>
namespace XFX
{
namespace Graphics
{
/// <summary>
/// Provides methods for manipulating the directional lights used by the BasicEffect class.
/// </summary>
class BasicDirectionalLight
{
public:
Vector3 DiffuseColor;
Vector3 Direction;
int Enabled;
Vector3 SpecularColor;
};
}
}
#endif //_BASICDIRECTIONALLIGHT_H_

View File

@ -0,0 +1,60 @@
/********************************************************
* BasicEffect.h *
* *
* BasicEffect definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _BASICEFFECT_H_
#define _BASICEFFECT_H_
#include "BasicDirectionalLight.h"
#include "Effect.h"
//#include "GraphicsDevice.h"
#include <Matrix.h>
#include "Texture2D.h"
#include <Vector3.h>
namespace XFX
{
namespace Graphics
{
/// <summary>
/// Represents shader model 1.1 Effect that has optional support for vertex colors, texturing, and lighting.
/// </summary>
class BasicEffect : public Effect
{
protected:
BasicEffect(GraphicsDevice &device, BasicEffect &clone);
public:
float Alpha;
Vector3 AmbientLightColor;
Vector3 DiffuseColor;
BasicDirectionalLight DirectionalLight0();
BasicDirectionalLight DirectionalLight1();
BasicDirectionalLight DirectionalLight2();
Vector3 EmissiveColor;
Vector3 FogColor;
int FogEnabled;
float FogEnd;
float FogStart;
int LightingEnabled;
int PreferPerPixelLighting;
Matrix Projection;
Vector3 SpecularColor;
float SpecularPower;
Texture2D Texture;
int TextureEnabled;
int VertexColorEnabled;
Matrix View;
Matrix World;
BasicEffect(GraphicsDevice &device, EffectPool &effectPool);
Effect Clone(GraphicsDevice &device);
void EnableDefaultLighting();
};
}
}
#endif //_BASICEFFECT_H_

198
include/Graphics/Color.h Normal file
View File

@ -0,0 +1,198 @@
/********************************************************
* Color.h *
* *
* XFX Color definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_GRAPHICS_COLOR_
#define _XFX_GRAPHICS_COLOR_
#include <System/Types.h>
#include "PackedVector/IPackedVector.h"
using namespace System;
using namespace XFX::Graphics::PackedVector;
namespace XFX
{
struct Vector3;
struct Vector4;
namespace Graphics
{
/// <summary>
/// Represents a color using Red, Green, Blue, and Alpha values.
/// </summary>
struct Color : public IEquatable<Color>
{
private:
uint _packedValue;
uint RGBAtoARGB(uint value);
Color(uint packedValue);
static uint InitializeFromVector4(Vector4 vector);
static uint InitializeFromVector3(Vector3 vector);
public:
byte A();
static const Color AliceBlue;
static const Color AntiqueWhite;
static const Color Aqua;
static const Color AquaMarine;
static const Color Azure;
byte B();
static const Color Beige;
static const Color Bisque;
static const Color Black;
static const Color BlanchedAlmond;
static const Color Blue;
static const Color BlueViolet;
static const Color Brown;
static const Color BurlyWood;
static const Color CadetBlue;
static const Color Chartreuse;
static const Color Chocolate;
static const Color Coral;
static const Color CornflowerBlue;
static const Color Cornsilk;
static const Color Crimson;
static const Color Cyan;
static const Color DarkBlue;
static const Color DarkCyan;
static const Color DarkGoldenrod;
static const Color DarkGray;
static const Color DarkGreen;
static const Color DarkKhaki;
static const Color DarkMagenta;
static const Color DarkOliveGreen;
static const Color DarkOrange;
static const Color DarkOrchid;
static const Color DarkRed;
static const Color DarkSalmon;
static const Color DarkSeaGreen;
static const Color DarkSlateBlue;
static const Color DarkSlateGray;
static const Color DarkTurquoise;
static const Color DarkViolet;
static const Color DeepPink;
static const Color DeepSkyBlue;
static const Color DimGray;
static const Color DodgerBlue;
static const Color FireBrick;
static const Color FloralWhite;
static const Color ForestGreen;
static const Color Fuchsia;
byte G();
static const Color Gainsboro;
static const Color GhostWhite;
static const Color Gold;
static const Color Goldenrod;
static const Color Gray;
static const Color Green;
static const Color GreenYellow;
static const Color Honeydew;
static const Color HotPink;
static const Color IndianRed;
static const Color Indigo;
static const Color Ivory;
static const Color Khaki;
static const Color Lavender;
static const Color LavenderBlush;
static const Color LawnGreen;
static const Color LemonChiffon;
static const Color LightBlue;
static const Color LightCoral;
static const Color LightCyan;
static const Color LightGoldenrodYellow;
static const Color LightGray;
static const Color LightGreen;
static const Color LightPink;
static const Color LightSalmon;
static const Color LightSeaGreen;
static const Color LightSkyBlue;
static const Color LightSlateGray;
static const Color LightSteelBlue;
static const Color LightYellow;
static const Color Lime;
static const Color LimeGreen;
static const Color Linen;
static const Color Magenta;
static const Color Maroon;
static const Color MediumAquamarine;
static const Color MediumBlue;
static const Color MediumOrchid;
static const Color MediumPurple;
static const Color MediumSeaGreen;
static const Color MediumSlateBlue;
static const Color MediumSpringGreen;
static const Color MediumTurquoise;
static const Color MediumVioletRed;
static const Color MidnightBlue;
static const Color MintCream;
static const Color MistyRose;
static const Color Moccasin;
static const Color NavajoWhite;
static const Color Navy;
static const Color OldLace;
static const Color Olive;
static const Color OliveDrab;
static const Color Orange;
static const Color OrangeRed;
static const Color Orchid;
static const Color PaleGoldenrod;
static const Color PaleGreen;
static const Color PaleTurquoise;
static const Color PaleVioletRed;
static const Color PapayaWhip;
static const Color PeachPuff;
static const Color Peru;
static const Color Pink;
static const Color Plum;
static const Color PowderBlue;
static const Color Purple;
byte R();
static const Color Red;
static const Color RosyBrown;
static const Color RoyalBlue;
static const Color SaddleBrown;
static const Color Salmon;
static const Color SandyBrown;
static const Color SeaGreen;
static const Color SeaShell;
static const Color Sienna;
static const Color Silver;
static const Color SkyBlue;
static const Color SlateBlue;
static const Color SlateGray;
static const Color Snow;
static const Color SpringGreen;
static const Color SteelBlue;
static const Color Tan;
static const Color Teal;
static const Color Thistle;
static const Color Tomato;
static const Color Turquoise;
static const Color Violet;
static const Color Wheat;
static const Color White;
static const Color WhiteSmoke;
static const Color Yellow;
static const Color YellowGreen;
Color(Vector3 vector);
Color(Vector4 vector);
Color(byte r, byte g, byte b);
Color(byte r, byte g, byte b, byte a);
bool Equals(Color other);
int GetHashCode();
uint PackedValue();
Vector4 ToVector4();
Vector3 ToVector3();
bool operator!=(const Color other);
bool operator==(const Color other);
};
}
}
#endif //_COLOR_

View File

@ -0,0 +1,51 @@
#ifndef _DEPTHSTENCILBUFFER_
#define _DEPTHSTENCILBUFFER_
#include "../System.h"
#include "Enums.h"
using namespace System;
namespace XFX
{
namespace Graphics
{
class GraphicsDevice;
/// <summary>
/// Queries and prepares depth stencil buffers.
/// </summary>
class DepthStencilBuffer : IDisposable
{
private:
GraphicsDevice *_graphicsDevice;
int _width;
int _height;
DepthFormat_t _format;
int isDisposed;
int _multiSampleQuality;
MultiSampleType_t _multiSampleType;
protected:
virtual void Dispose(int __p1);
public:
DepthFormat_t Format();
GraphicsDevice GraphicsDevice_();
int IsDisposed();
int MultiSampleQuality();
MultiSampleType_t MultiSampleType_();
int Height();
int Width();
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();
virtual ~DepthStencilBuffer();
void Dispose();
};
}
}
#endif //_DEPTHSTENCILBUFFER_

View File

@ -0,0 +1,41 @@
/********************************************************
* DisplayMode.h *
* *
* XFX DisplayMode structure definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _DISPLAYMODE_
#define _DISPLAYMODE_
#include "Enums.h"
namespace XFX
{
struct Rectangle;
namespace Graphics
{
/// <summary>
/// Describes the display mode.
/// </summary>
struct DisplayMode
{
public:
float AspectRatio();
int Height;
SurfaceFormat_t Format;
int RefreshRate;
Rectangle TitleSafeArea();
int Width;
DisplayMode();
bool Equals(const DisplayMode other);
int GetHashCode();
bool operator!=(const DisplayMode other);
bool operator==(const DisplayMode other);
};
}
}
#endif //_DISPLAYMODE_

View File

@ -0,0 +1,19 @@
#ifndef _DISPLAYMODECOLLECTION_
#define _DISPLAYMODECOLLECTION_
#include "../System.h"
using namespace System;
namespace XFX
{
namespace Graphics
{
struct DisplayModeCollection
{
};
}
}
#endif //_DISPLAYMODECOLLECTION_

67
include/Graphics/Effect.h Normal file
View File

@ -0,0 +1,67 @@
#ifndef _EFFECT_H_
#define _EFFECT_H_
#include <System.h>
#include <System/IO/Stream.h>
#include "Enums.h"
#include "EffectFunctionCollection.h"
#include "EffectPool.h"
#include "EffectParameterCollection.h"
#include "EffectTechnique.h"
#include "EffectTechniqueCollection.h"
#include "GraphicsDevice.h"
using namespace System;
using namespace System::IO;
namespace XFX
{
namespace Graphics
{
/// <summary>
/// Used to set and query effects and choose techniques.
/// </summary>
class Effect : public IDisposable
{
private:
int _isDisposed;
protected:
~Effect();
Effect(GraphicsDevice &graphicsDevice, Effect &cloneSource);
void Dispose(int disposing);
public:
String Creator();
EffectTechnique CurrentTechnique;
EffectPool EffectPool_();
EffectFunctionCollection Functions();
GraphicsDevice GraphicsDevice_();
int IsDisposed();
EffectParameterCollection Parameters();
EffectTechniqueCollection Techniques();
Effect(GraphicsDevice &graphicsDevice, byte effectCode[], CompilerOptions_t options, EffectPool &pool);
Effect(GraphicsDevice &graphicsDevice, String &effectCodeFile, CompilerOptions_t options, EffectPool &pool);
Effect(GraphicsDevice &graphicsDevice, Stream &effectCodeFileStream, CompilerOptions_t options, EffectPool &pool);
Effect(GraphicsDevice &graphicsDevice, Stream &effectCodeFileStream, int numberBytes, CompilerOptions_t options, EffectPool &pool);
void Begin();
void Begin(SaveStateMode_t saveStateMode);
virtual Effect Clone(GraphicsDevice &device);
void CommitChanges();
static CompiledEffect CompileEffectFromFile(String &effectFile, CompilerMacro preprocessorDefines[], CompilerIncludeHandler &includeHandler, CompilerOptions_t options, TargetPlatform_t &platform);
static CompiledEffect CompileEffectFromFile(Stream &effectFileStream, int numberBytes, CompilerMacro preprocessorDefines[], CompilerIncludeHandler &includeHandler, CompilerOptions_t options, TargetPlatform_t platform);
static CompiledEffect CompileEffectFromFile(Stream effectFileStream, CompilerMacro preprocessorDefines[], CompilerIncludeHandler &includeHandler, CompilerOptions_t options, TargetPlatform_t platform);
static CompiledEffect CompileEffectFromSource(String effectFileSource, CompilerMacro preprocessorDefines[], CompilerIncludeHandler &includeHandler, CompilerOptions_t options, TargetPlatform_t platform);
static String Disassemble(Effect &effect, int enableColorCode);
String Disassemble(bool enableColorCode);
void Dispose();
void End();
String ToString();
};
}
}
#endif //_EFFECT_H_

773
include/Graphics/Enums.h Normal file
View File

@ -0,0 +1,773 @@
/********************************************************
* Enums.h *
* *
* XFX::Graphics enumeration definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _GRAPHICS_ENUMS_
#define _GRAPHICS_ENUMS_
//We place the enums inside structs so we can access them like this: Name::Value
//making it virtually the same as in C#.
//It also helps preventing pollution of the namespaces with constants and possible naming conflicts.
//I don't get why enums violate the scope principle of C++
namespace XFX
{
namespace Graphics
{
/// <summary>
/// Defines color blending factors.
/// </summary>
struct Blend
{
enum type
{
Zero = 1,
One = 2,
SourceColor = 3,
InversourceColor = 4,
SourceAlpha = 5,
InverseSourceAlpha = 6,
Destinationalpha = 7,
InverseDestinationAlpha = 8,
DestinationColor = 9,
InverseDestinationColor = 10,
SourceAlphaSaturation = 11,
BothSourceAlpha = 12,
BothInverseSourceAlpha = 13,
BlendFactor = 14,
InverseBlendFactor = 15
};
};
/// <summary>
/// Defines how to combine a source color with the destination color already on the render target for color blending.
/// </summary>
struct BlendFunction
{
enum type
{
Add = 1,
Subtract = 2,
ReverseSubtract = 3,
Min = 4,
Max = 5
};
};
/// <summary>
/// Specifies Special Usage of the buffer contents.
/// </summary>
struct BufferUsage
{
enum type
{
None = 0,
Points = 0x40,
WriteOnly = 8
};
};
/// <summary>
/// Specifies the buffer to use when calling GraphicsDevice.Clear.
/// </summary>
struct ClearOptions
{
enum type
{
Depth = 2,
Stencil = 4,
Target = 1
};
};
/// <summary>
/// Defines the color channels that can be chosen for a per-channel write to a render target color buffer.
/// </summary>
struct ColorWriteChannels
{
enum type
{
All = 15,
Alpha = 8,
Blue = 4,
Green = 2,
None = 0,
Red = 1
};
};
/// <summary>
/// Defines comparison functions that can be chosen for alpha, stencil, or depth-buffer tests.
/// </summary>
struct CompareFunction
{
enum type
{
Never = 1,
Less = 2,
Equal = 3,
LessEqual = 4,
Greater = 5,
NotEqual = 6,
GreaterEqual = 7,
Always = 8
};
};
/// <summary>
/// Identifies an include file as a local or system resource.
/// </summary>
struct CompilerIncludeHandlerType
{
enum type
{
Local,
System
};
};
/// <summary>
/// Defines optimization options that may be chosen for shader and effect code compilation.
/// </summary>
struct CompilerOptions
{
enum type
{
AvoidFlowControl,
Debug,
ForcePixelShaderSoftwareNoOptimizations,
ForceVertexShaderSoftwareNoOptimizations,
None,
NoPreShader,
NotCloneable,
PackMatrixColumnMajor,
PackMatrixRowMajor,
PartialPrecision,
PreferFlowControl,
SkipOptimization,
SkipValidation
};
};
/// <summary>
/// Defines the faces of a cube map in the TextureCube class type.
/// </summary>
struct CubeMapFace
{
enum type
{
NegativeX = 1,
NegativeY = 3,
NegativeZ = 5,
PositiveX = 0,
PositiveY = 2,
PositiveZ = 4
};
};
/// <summary>
/// Defines winding orders that may be used to identify back faces for culling.
/// </summary>
struct CullMode
{
enum type
{
None = 1,
CullClockwiseFace = 2,
CullCounterClockwiseFace = 3
};
};
/// <summary>
/// Defines the format of data in a depth buffer.
/// </summary>
struct DepthFormat
{
enum type
{
Depth15Stencil1 = 56,
Depth16 = 54,
Depth24 = 51,
Depth24Stencil8 = 48,
Depth24Stencil8Single = 49,
Depth24Stencil4 = 50,
Depth32 = 52,
Unknown = -1
};
};
/// <summary>
/// Specifies the type of device driver.
/// </summary>
struct DeviceType
{
enum type
{
Hardware = 1,
NullReference = 4,
Reference = 2
};
};
/// <summary>
/// Defines classes that can be used for effect parameters or shader constants.
/// </summary>
struct EffectParameterClass
{
enum type
{
MatrixColumns,
MatrixRows,
Object,
Scalar,
Struct,
Vector
};
};
/// <summary>
/// Describes options for filling the vertices and lines that define a primitive.
/// </summary>
struct FillMode
{
enum type
{
Point = 1,
Solid = 3,
WireFrame = 2
};
};
/// <summary>
/// Defines modes describing how to filter an image or mipmap when it is minified or magnified to fit a set of vertices.
/// </summary>
struct FilterOptions
{
enum type
{
Box = 5,
Dither = 524288,
DitherDiffusion = 1048576,
Linear = 3,
Mirror = 458752,
MirrorU = 65536,
MirrorV = 131072,
MirrorW = 262144,
None = 1,
Point = 2,
Srgb = 6291456,
SrgbIn = 2097152,
SrgbOut = 4194304,
Triangle = 4
};
};
/// <summary>
/// Defines constants that describe the fog mode.
/// </summary>
struct FogMode
{
enum type
{
Exponent = 1,
ExponentSquared = 2,
Linear = 3,
None = 0
};
};
/// <summary>
/// Describes the status of the device.
/// </summary>
struct GraphicsDeviceStatus
{
enum type
{
Lost = 1,
Normal = 0,
NotReset = 2
};
};
/// <summary>
/// Defines supported image file formats that may be used for textures.
/// </summary>
struct ImageFileFormat
{
enum type
{
Bmp = 0,
Dds = 4,
Dib = 6,
Hdr = 7,
Jpg = 1,
Pfm = 8,
Png = 3,
Ppm = 5,
Tga = 2
};
};
/// <summary>
/// Defines the size of an element of an index buffer.
/// </summary>
struct IndexElementSize
{
enum type
{
SixteenBits,
ThirtyTwoBits
};
};
/// <summary>
/// Defines the levels of full-scene multisampling that the game machine can apply.
/// </summary>
struct MultiSampleType
{
enum type
{
SixteenSamples = 16,
FifteenSamples = 15,
FourteenSamples = 14,
ThirteenSamples = 13,
TwelveSamples = 12,
ElevenSamples = 11,
TenSamples = 10,
NineSamples = 9,
EightSamples = 8,
SevenSamples = 7,
SixSamples = 6,
FiveSamples = 5,
FourSamples = 4,
ThreeSamples = 3,
TwoSamples = 2,
NonMaskable = 1,
None = 0
};
};
/// <summary>
/// Defines flags that describe the relationship between the adapter refresh rate and the rate at which GraphicsDevice.Present operations are completed.
/// </summary>
struct PresentInterval
{
enum type
{
Default = 0,
Four = 8,
Immediate = -2147483648,
One = 1,
Three = 4,
Two = 2
};
};
/// <summary>
/// Defines flags that control the behavior of the back buffer and depth buffer.
/// </summary>
struct PresentOptions
{
enum type
{
DeviceClip = 4,
DiscardDepthStencil = 2,
None = 0,
Video = 16
};
};
/// <summary>
/// Defines how data in a vertex stream is interpreted during a draw call.
/// </summary>
struct PrimitiveType
{
enum type
{
LineList = 2,
LineStrip = 3,
PointList = 1,
TriangleFan = 6,
TriangleList = 4,
TriangleStrip = 5
};
};
/// <summary>
/// Defines options for querying device resource formats.
/// </summary>
struct QueryUsages
{
enum type
{
Filter = 131072,
None = 0,
PostPixelShaderRendering = 524288,
SrgbRead = 65536,
SrgbWrite = 262144,
VertexTexture = 1048576,
WrapAndMip = 2097152
};
};
/// <summary>
/// Determines how render target data is used once a new render target is set.
/// </summary>
struct RenderTargetUsage
{
enum type
{
DiscardContents,
PlatformContents,
PreserveContents
};
};
/// <summary>
/// Defines resource types.
/// </summary>
struct ResourceType
{
enum type
{
DepthStencilBuffer = 1,
IndexBuffer = 7,
RenderTarget = 8,
Texture2D = 3,
Texture3D = 4,
Texture3DVolume = 2,
TextureCube = 5,
VertexBuffer = 6
};
};
/// <summary>
/// Defines options for saving the graphics device state before and after an effect technique is applied.
/// </summary>
struct SaveStateMode
{
enum type
{
None,
SaveState
};
};
/// <summary>
/// Describes whether existing buffer data will be overwritten or discarded during a SetData operation.
/// </summary>
struct SetDataOptions
{
enum type
{
Discard = 8192,
None = 0,
NoOverwrite = 4096
};
};
/// <summary>
/// Defines vertex and pixel shader versions.
/// </summary>
struct ShaderProfile
{
enum type
{
PS_1_1,
PS_1_2,
PS_1_3,
VS_1_1,
XPS_1_1, //Denotes XBOX specific shader configuration
XVS_1_1 //Denotes XBOX specific shader configuration
};
};
/// <summary>
/// Defines the data type of a shader register.
/// </summary>
struct ShaderRegisterSet
{
enum type
{
Boolean = 0,
Float = 2,
Int4 = 1,
Sampler = 3
};
};
/// <summary>
/// The following flags are used to specify sprite blending rendering options to the flags parameter in SpriteBatch.Begin:
/// </summary>
struct SpriteBlendMode
{
enum type
{
Additive = 2,
AlphaBlend = 1,
None = 0
};
};
/// <summary>
/// Defines sprite rotation options.
/// </summary>
struct SpriteEffects
{
enum type
{
FlipHorizontally = 1,
FlipVertically = 256,
None = 0
};
};
/// <summary>
/// Defines sprite sort-rendering options.
/// </summary>
struct SpriteSortMode
{
enum type
{
BackToFront = 3,
Deferred = 1,
FrontToBack = 4,
Immediate = 0,
Texture = 2
};
};
/// <summary>
/// Defines stencil buffer operations.
/// </summary>
struct StencilOperation
{
enum type
{
Decrement = 8,
DecrementSaturation = 5,
Increment = 7,
IncrementSaturation = 4,
Invert = 6,
Keep = 1,
Replace = 3,
Zero = 2
};
};
/// <summary>
/// Defines various types of surface formats.
/// </summary>
struct SurfaceFormat
{
enum type
{
Alpha8 = 15,
Bgr233 = 16,
Bgr24 = 17,
Bgr32 = 2,
Bgr444 = 13,
Bgr555 = 11,
Bgr565 = 9,
Bgra1010102 = 3,
Bgra2338 = 14,
Bgra4444 = 12,
Bgra5551 = 10,
Color = 1,
Depth15Stencil1 = 56,
Depth16 = 54,
Depth24 = 51,
Depth24Stencil4 = 50,
Depth24Stencil8 = 48,
Depth24Stencil8Single = 49,
Depth32 = 52,
Dxt1 = 28,
Dxt2 = 29,
Dxt3 = 30,
Dxt4 = 31,
Dxt5 = 32,
HalfSingle = 25,
HalfVector2 = 26,
HalfVector4 = 27,
Luminance16 = 34,
Luminance8 = 33,
LuminanceAlpha16 = 36,
LuminanceAlpha8 = 35,
Multi2Bgra32 = 47,
NormalizedAlpha1010102 = 41,
NormalizedByte2 = 18,
NormalizedByte2Computed = 42,
NormalizedByte4 = 19,
NormalizedLuminance16 = 39,
NormalizedLuminance32 = 40,
NormalizedShort2 = 20,
Normalizedshort4 = 21,
Palette8 = 37,
PaletteAlpha16 = 38,
Rg32 = 7,
Rgb32 = 5,
Rgba1010102 = 6,
Rgba32 = 4,
Rgba64 = 8,
Single = 22,
Unknown = -1,
Vector2 = 23,
Vector4 = 24,
VideoGrGb = 45,
VideoRgBg = 46,
VideoUyVy = 44,
VideoYuYv = 43
};
};
/// <summary>
/// Defines how the device front buffer and back buffer are to be swapped when GraphicsDevice.Present is called.
/// </summary>
struct SwapEffect
{
enum type
{
Copy = 3,
Default = 1,
Discard = 1,
Flip = 2
};
};
/// <summary>
/// Defines constants that describe supported texture-addressing modes.
/// </summary>
struct TextureAddressMode
{
enum type
{
Border = 4,
Clamp = 3,
Mirror = 2,
MirrorOnce = 5,
Wrap = 1
};
};
/// <summary>
/// Defines how a texture will be filtered as it is minified for each mipmap level.
/// </summary>
struct TextureFilter
{
enum type
{
Anisotropic = 3,
GaussianQuad = 7,
Linear = 2,
None = 0,
Point = 1,
PyramidalQuad = 6
};
};
/// <summary>
/// Specifies special usage of the texture data.
/// </summary>
struct TextureUsage
{
enum type
{
AutoGenerateMipMap,
Linear,
None,
Tiled
};
};
/// <summary>
/// Defines supported wrap coordinates.
/// </summary>
struct TextureWrapCoordinates
{
enum type
{
None = 0,
One = 2,
Three = 8,
Two = 4,
Zero = 1
};
};
/// <summary>
/// Defines vertex element formats.
/// </summary>
struct VertexElementFormat
{
enum type
{
Byte4,
Color,
HalfVector2,
HalfVector4,
Normalized101010,
NormalizedShort2,
NormalizedShort4,
Rg32,
Rgba32,
Rgba64,
Short2,
Short4,
Single,
UInt101010,
Unused,
Vector2,
Vector3,
Vector4
};
};
/// <summary>
/// Defines the tessellator processing method for a vertex element.
/// </summary>
struct VertexElementMethod
{
enum type
{
Default,
LookUp,
LookUpPresampled,
UV
};
};
/// <summary>
/// Defines usage for vertex elements.
/// </summary>
struct VertexElementUsage
{
enum type
{
Binormal,
BlendIndices,
BlendWeight,
Color,
Depth,
Fog,
Normal,
PointSize,
Position,
Sample,
Tangent,
TessellateFactor,
TextureCoordinate
};
};
//Lots of typedefs, but there was no other way to make these typesafe enum hacks look good.
typedef Blend::type Blend_t;
typedef BlendFunction::type BlendFunction_t;
typedef BufferUsage::type BufferUsage_t;
typedef ClearOptions::type ClearOptions_t;
typedef ColorWriteChannels::type ColorWriteChannels_t;
typedef CompareFunction::type CompareFunction_t;
typedef CompilerIncludeHandlerType::type CompilerIncludeHandlerType_t;
typedef CompilerOptions::type CompilerOptions_t;
typedef CubeMapFace::type CubeMapFace_t;
typedef CullMode::type CullMode_t;
typedef DepthFormat::type DepthFormat_t;
typedef DeviceType::type DeviceType_t;
typedef EffectParameterClass::type EffectParameterClass_t;
typedef FillMode::type FillMode_t;
typedef FilterOptions::type FilterOptions_t;
typedef FogMode::type FogMode_t;
typedef GraphicsDeviceStatus::type GraphicsDeviceStatus_t;
typedef ImageFileFormat::type ImageFileFormat_t;
typedef IndexElementSize::type IndexElementSize_t;
typedef MultiSampleType::type MultiSampleType_t;
typedef PresentInterval::type PresentInterval_t;
typedef PresentOptions::type PresentOptions_t;
typedef PrimitiveType::type PrimitiveType_t;
typedef QueryUsages::type QueryUsages_t;
typedef RenderTargetUsage::type RenderTargetUsage_t;
typedef ResourceType::type ResourceType_t;
typedef SaveStateMode::type SaveStateMode_t;
typedef SetDataOptions::type SetDataOptions_t;
typedef ShaderProfile::type ShaderProfile_t;
typedef ShaderRegisterSet::type ShaderRegisterSet_t;
typedef SpriteBlendMode::type SpriteBlendMode_t;
typedef SpriteEffects::type SpriteEffects_t;
typedef SpriteSortMode::type SpriteSortMode_t;
typedef StencilOperation::type StencilOperation_t;
typedef SurfaceFormat::type SurfaceFormat_t;
typedef SwapEffect::type SwapEffect_t;
typedef TextureAddressMode::type TextureAddressMode_t;
typedef TextureFilter::type TextureFilter_t;
typedef TextureUsage::type TextureUsage_t;
typedef TextureWrapCoordinates::type TextureWrapCoordinates_t;
typedef VertexElementFormat::type VertexElementFormat_t;
typedef VertexElementMethod::type VertexElementMethod_t;
typedef VertexElementUsage::type VertexElementUsage_t;
}
}
#endif //_GRAPHICS_ENUMS_

View File

@ -0,0 +1,64 @@
/********************************************************
* GraphicsAdapter.h *
* *
* XFX GraphicsAdapter definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _GRAPHICSADAPTER_
#define _GRAPHICSADAPTER_
#include <System/Types.h>
#include <System/Interfaces.h>
#include "DisplayMode.h"
#include "DisplayModeCollection.h"
#include "Enums.h"
using namespace System;
namespace XFX
{
namespace Graphics
{
/// <summary>
/// Provides methods to retrieve and manipulate graphics adapters.
/// </summary>
class GraphicsAdapter : public IDisposable
{
protected:
void Dispose(int __p1);
public:
DisplayMode CurrentDisplayMode();
char* Description();
int DeviceId();
char* DeviceName();
char* DriverDLL();
float DriverVersion();
bool IsDefaultAdapter();
int VendorId();
bool IsWideScreen();
DisplayModeCollection SupportedDisplayModes();
virtual ~GraphicsAdapter();
bool CheckDepthStencilMatch(DeviceType_t deviceType, SurfaceFormat_t adapterFormat, SurfaceFormat_t renderTargetFormat, DepthFormat_t depthStencilFormat);
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 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, int isFullScreen, MultiSampleType_t sampleType, out int qualityLevels);
bool CheckDeviceType(DeviceType_t deviceType, SurfaceFormat_t displayFormat, SurfaceFormat_t backBufferFormat, int isFullScreen);
void Dispose();
bool Equals(GraphicsAdapter &other);
int GetHashCode();
bool IsDeviceTypeAvailable(DeviceType_t deviceType);
bool operator!=(GraphicsAdapter &other);
bool operator==(GraphicsAdapter &other);
};
}
}
#endif //_GRAPHICSADAPTER_

View File

@ -0,0 +1,95 @@
/********************************************************
* GraphicsDevice.h *
* *
* XFX GraphicsDevice definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_GRAPHICS_GRAPHICSDEVICE_
#define _XFX_GRAPHICS_GRAPHICSDEVICE_
#include <System/Types.h>
#include "Color.h"
#include "DepthStencilBuffer.h"
#include "Enums.h"
#include "GraphicsAdapter.h"
#include "GraphicsDeviceCapabilities.h"
#include "PresentationParameters.h"
#include "TextureCollection.h"
#include "Viewport.h"
namespace XFX
{
struct Matrix;
struct Quaternion;
struct Rectangle;
struct Vector2;
struct Vector4;
namespace Graphics
{
class GammaRamp;
/// <summary>
/// Performs primitive-based rendering, creates resources, handles system-level
/// variables, adjusts gamma ramp levels, and creates shaders.
/// </summary>
class GraphicsDevice : public IDisposable
{
private:
GraphicsAdapter _adapter;
DepthStencilBuffer _depthStencilBuffer;
DeviceType_t _deviceType;
GraphicsDeviceCapabilities graphicsDeviceCapabilities;
bool isDisposed;
TextureCollection textures;
Color clearColor;
Viewport viewport;
protected:
virtual void Dispose(bool disposing);
public:
DepthStencilBuffer GetDepthStencilBuffer();
void SetDepthStencilBuffer(DepthStencilBuffer buffer);
TextureCollection Textures();
Viewport Viewport_();
void Viewport_(Viewport newValue);
#if ENABLE_XBOX
GraphicsDevice(GraphicsAdapter adapter, DeviceType_t deviceType, PresentationParameters presentationParameters);
#else
GraphicsDevice(GraphicsAdapter adapter, DeviceType_t deviceType, IntPtr renderWindowHandle, PresentationParameters presentationParameters);
#endif
GraphicsDevice();
virtual ~GraphicsDevice();
void Clear(Color color);
void Clear(ClearOptions_t options, Color color, float depth, int stencil);
void Clear(ClearOptions_t options, Vector4 color, float depth, int stencil);
void Clear(ClearOptions_t options, Color color, float depth, int stencil, Rectangle regions[]);
void Clear(ClearOptions_t options, Vector4 color, float depth, int stencil, Rectangle regions[]);
void Dispose();
void DrawIndexedPrimitives(PrimitiveType_t primitiveType, int baseVertex, int minVertexIndex, int numVertices, int startIndex, int primitiveCount);
void DrawPrimitives(PrimitiveType primitiveType, int startVertex, int primitiveCount);
template <class T>
void DrawUserIndexedPrimitives(PrimitiveType_t primitiveType, T vertexData[], int vertexOffset, int numVertices, int indexData[], int indexOffset, int primitiveCount);
template <class T>
void DrawUserIndexedPrimitives(PrimitiveType_t primitiveType, T vertexData[], int vertexOffset, int numVertices, short indexData[], int indexOffset, int primitiveCount);
template <class T>
void DrawUserPrimitives(PrimitiveType_t primitiveType, T vertexData[], int vertexOffset, int primitiveCount);
void EvictManagedResources();
GammaRamp GetGammaRamp();
int* GetPixelShaderBooleanConstant(int startRegister, int constantCount);
int* GetPixelShaderInt32Constant(int startRegister, int constantCount);
Matrix* GetPixelShaderMatrixArrayConstant(int startRegister, int constantCount);
Matrix GetPixelShaderMatrixConstant(int startRegister);
Quaternion* GetPixelShaderQuaternionArrayConstant(int startRegister, int constantCount);
Quaternion GetPixelShaderQuaternionConstant(int startRegister);
float* GetPixelShaderSingleConstant(int startRegister, int constantCount);
Vector2* GetPixelShaderVector2ArrayConstant(int startRegister, int constantCount);
Vector2 GetPixelShaderVector2Constant(int startRegister);
};
}
}
#endif //_XFX_GRAPHICS_GRAPHICSDEVICE_

View File

@ -0,0 +1,182 @@
/********************************************************
* GraphicsDeviceCapabilities.h *
* *
* XFX GraphicsDeviceCapabilities definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _GRAPHICSDEVICECAPABILITIES_
#define _GRAPHICSDEVICECAPABILITIES_
#include <System.h>
#include "Enums.h"
using namespace System;
namespace XFX
{
namespace Graphics
{
/// <summary>
/// Represents the capabilities of the hardware.
/// </summary>
class GraphicsDeviceCapabilities : IDisposable
{
protected:
void Dispose(bool disposing);
public:
struct BlendCaps;
struct CompareCaps;
struct CursorCaps;
struct DeclarationTypeCaps;
struct DeviceCaps;
struct DriverCaps;
struct FilterCaps;
int AdapterOrdinalInGroup();
CompareCaps AlphaCompareCapabilities();
FilterCaps CubeTextureFilterCapabilities();
CursorCaps CursorCapabilities();
DeclarationTypeCaps DeclarationTypeCapabilities();
CompareCaps DepthBufferCompareCapabilities();
BlendCaps DestinationBlendCapabilities();
DeviceCaps DeviceCapabilities();
DeviceType_t DeviceType_();
DriverCaps DriverCapabilities();
void Dispose();
int operator!=(GraphicsDeviceCapabilities other);
int operator==(GraphicsDeviceCapabilities other);
public:
/// <summary>
/// Represents the texture addressing capabilities for Texture structures.
/// </summary>
struct AddressCaps
{
bool SupportsBorder();
bool SupportsClamp();
bool SupportsIndependentUV();
bool SupportsMirror();
bool SupportsMirrorOnce();
bool SupportsWrap();
bool Equals(AddressCaps obj);
int GetHashCode();
char* ToString();
bool operator!=(AddressCaps other);
bool operator==(AddressCaps other);
};
/// <summary>
/// Represents the supported blend capabilities.
/// </summary>
struct BlendCaps
{
int SupportsBlendFactor();
int SupportsBothInverseSourceAlpha();
int SupportsBothSourceAlpha();
int SupportsDestinationAlpha();
bool Equals(BlendCaps obj);
int GetHashCode();
char* ToString();
int operator!=(BlendCaps other);
int operator==(BlendCaps other);
};
/// <summary>
/// Represents comparison capabilities.
/// </summary>
struct CompareCaps
{
bool SupportsAlways();
bool SupportsEqual();
bool SupportsGreater();
bool SupportsGreaterEqual();
bool SupportsLess();
bool SupportsLessEqual();
bool SupportsNever();
bool SupportsNotEqual();
bool Equals(CompareCaps obj);
int GetHashCode();
char* ToString();
bool operator!=(CompareCaps other);
bool operator==(CompareCaps other);
};
/// <summary>
/// Represents hardware support for cursors.
/// </summary>
struct CursorCaps
{
bool SupportsColor();
bool SupportsLowResolution();
bool Equals(CursorCaps obj);
int GetHashCode();
char* ToString();
bool operator!=(CursorCaps other);
bool operator==(CursorCaps other);
};
/// <summary>
/// Represents data types contained in a vertex declaration.
/// </summary>
struct DeclarationTypeCaps
{
bool SupportsByte4();
bool SupportsHalfVector2();
bool SupportsHalfVector4();
bool SupportsNormalized101010();
bool SupportsNormalizedShort2();
bool SupportsNormalizedShort4();
bool SupportsRg32();
bool SupportsRgba32();
bool SupportsRgba64();
bool SupportsUInt101010();
bool Equals(DeclarationTypeCaps obj);
int GetHashCode();
char* ToString();
bool operator!=(DeclarationTypeCaps other);
bool operator==(DeclarationTypeCaps other);
};
/// <summary>
/// Represents device-specific capabilities.
/// </summary>
struct DeviceCaps
{
bool CanDrawSystemToNonLocal();
bool CanRenderAfterFlip();
bool IsDirect3D9Driver();
bool SupportsDrawPrimitives2();
bool SupportsDrawPrimitives2Ex();
bool Equals(DeviceCaps obj);
int GetHashCode();
char* ToString();
bool operator!=(DeviceCaps other);
bool operator==(DeviceCaps other);
};
/// <summary>
/// Represents texture filter capabilities.
/// </summary>
struct FilterCaps
{
bool Equals(FilterCaps obj);
int GetHashCode();
char* ToString();
bool operator!=(FilterCaps other);
bool operator==(FilterCaps other);
};
};
}
}
#endif //_GRAPHICSDEVICECAPABILITIES_

View File

@ -0,0 +1,54 @@
/********************************************************
* GraphicsResource.h *
* *
* XFX GraphicsResource definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_GRAPHICS_GRAPHICSRESOURCE_
#define _XFX_GRAPHICS_GRAPHICSRESOURCE_
#include <System/Types.h>
#include <System/Delegates.h>
#include "Enums.h"
#include "GraphicsDevice.h"
using namespace System;
namespace XFX
{
namespace Graphics
{
/// <summary>
/// Queries and prepares resources.
/// </summary>
class GraphicsResource : public IDisposable
{
private:
bool isDisposed;
char* name;
ResourceType_t resourceType;
protected:
GraphicsDevice graphicsDevice;
virtual void Dispose(bool disposing)=0;
public:
virtual GraphicsDevice GraphicsDevice_();
bool IsDisposed();
char* Name();
void Name(char* value);
int Priority;
virtual ResourceType_t ResourceType_();
EventHandler Disposing;
virtual ~GraphicsResource();
GraphicsResource();
void Dispose();
};
}
}
#endif //_GRAPHICSRESOURCE_

View File

@ -0,0 +1,33 @@
/********************************************************
* IGraphicsDeviceService.h *
* *
* XFX IGraphicsDeviceService definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_GRAPHICS_IGRAPHICSDEVICESERVICE_
#define _XFX_GRAPHICS_IGRAPHICSDEVICESERVICE_
#include <System/Types.h>
#include "GraphicsDevice.h"
namespace XFX
{
namespace Graphics
{
/// <summary>
/// Defines a mechanism for retrieving GraphicsDevice objects.
/// </summary>
interface IGraphicsDeviceService
{
public:
EventHandler DeviceCreated;
EventHandler DeviceDisposing;
EventHandler DeviceReset;
EventHandler DeviceResetting;
GraphicsDevice GraphicsDevice_();
};
}
}
#endif //_XFX_GRAPHICS_IGRAPHICSDEVICESERVICE_

View File

@ -0,0 +1,33 @@
#ifndef _IPACKEDVECTOR_
#define _IPACKEDVECTOR_
#include <System.h>
#include "TPacked.h"
#include "Vector4.h"
using namespace XFX;
namespace XFX
{
namespace Graphics
{
namespace PackedVector
{
interface IPackedVector
{
public:
void PackFromVector4(Vector4 &vector);
Vector4 ToVector4();
};
template <class T>
interface IPackedVector<T> : IPackedVector
{
public:
TPacked PackedValue;
};
}
}
}
#endif //_IPACKEDVECTOR_

View File

@ -0,0 +1,44 @@
/********************************************************
* IPackedVector.h *
* *
* XFX IPackedVector definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _IPACKEDVECTOR_
#define _IPACKEDVECTOR_
#include "../../System.h"
namespace XFX
{
class Vector4;
namespace Graphics
{
namespace PackedVector
{
/// <summary>
///
/// </summary>
interface IPackedVector_
{
public:
virtual void PackFromVector4(Vector4 &vector) = 0;
virtual Vector4 ToVector4() = 0;
};
/// <summary>
///
/// </summary>
template<class TPacked>
interface IPackedVector : virtual public IPackedVector_
{
public:
virtual TPacked PackedValue() = 0;
virtual void PackedValue(TPacked value) = 0;
};
}
}
}
#endif //_IPACKEDVECTOR_

View File

@ -0,0 +1,65 @@
/********************************************************
* PresentationParameters.h *
* *
* XFX PresentationParameters definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _PRESENTATIONPARAMETERS_
#define _PRESENTATIONPARAMETERS_
#include "../System.h"
#include "Enums.h"
using namespace System;
namespace XFX
{
namespace Graphics
{
/// <summary>
/// Contains presentation parameters.
/// </summary>
class PresentationParameters : IDisposable
{
private:
int disposed;
protected:
virtual void Dispose(int disposing);
public:
DepthFormat_t AutoDepthStencilFormat;
int BackBufferCount;
SurfaceFormat_t BackBufferFormat;
int BackBufferHeight;
int BackBufferWidth;
static const int DefaultPresentRate;
#if !ENABLE_XBOX //Only valid on Linux
IntPtr DeviceWindowHandle;
#endif
int EnableAutoDepthStencil;
int FullScreenRefreshRateInHz;
int IsFullScreen;
int MultiSampleQuality;
MultiSampleType_t MultiSampleType_;
PresentInterval_t PresentationInterval;
PresentOptions_t PresentOptions_;
SwapEffect_t SwapEffect_;
virtual ~PresentationParameters();
PresentationParameters();
void Clear();
PresentationParameters Clone();
void Dispose();
int Equals(PresentationParameters &other);
int operator!=(PresentationParameters &other);
int operator==(PresentationParameters &other);
};
}
}
#endif //_PRESENTATIONPARAMETERS_

View File

@ -0,0 +1,65 @@
/********************************************************
* SpriteBatch.h *
* *
* XFX SpriteBatch definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _SPRITEBATCH_
#define _SPRITEBATCH_
#include "../System.h"
#include "Enums.h"
using namespace System;
namespace XFX
{
class Matrix;
class Rectangle;
class Vector2;
namespace Graphics
{
class Color;
class Sprite;
class SpriteFont;
class Texture2D;
class SpriteBatch : IDisposable
{
private:
GraphicsDevice *device;
int disposed;
static SpriteBlendMode_t spriteBlendMode;
void applyGraphicsDeviceSettings();
void flush();
void restoreRenderState();
protected:
virtual void Dispose(int disposing);
public:
~SpriteBatch();
SpriteBatch(GraphicsDevice &graphicsDevice);
void Begin();
void Begin(SpriteBlendMode_t blendMode, SpriteSortMode_t sortMode, SaveStateMode_t stateMode);
void Begin(SpriteBlendMode_t blendMode, SpriteSortMode_t sortMode, SaveStateMode_t stateMode, Matrix &transformMatrix);
void Dispose();
void Draw(Texture2D &texture, Rectangle &destinationRectangle, Color &color);
void Draw(Texture2D &texture, Rectangle &destinationRectangle, Rectangle &sourceRectangle, Color &color);
void Draw(Texture2D &texture, Vector2 &position, Color &color);
void Draw(Texture2D &texture, Vector2 &position, Rectangle &sourceRectangle, Color &color);
void Draw(Texture2D &texture, Vector2 &position, Rectangle &sourceRectangle, Color &color, float rotation, Vector2 origin, float scale, SpriteEffects_t effects, float layerDepth);
void Draw(Texture2D &texture, Vector2 &position, Rectangle &sourceRectangle, Color &color, float rotation, Vector2 &origin, Vector2 &scale, SpriteEffects_t effects, float layerDepth);
void Draw(Texture2D &texture, Rectangle &destinationRectangle, Rectangle &sourceRectangle, Color &color, float rotation, Vector2 &origin, SpriteEffects_t &effects, float layerDepth);
void DrawString(SpriteFont &spriteFont, char* text, Vector2 &position, Color &color);
void DrawString(SpriteFont &spriteFont, char* text, Vector2 &position, Color &color, float rotation, Vector2 &origin, float scale, SpriteEffects_t effects, float layerDepth);
void End();
};
}
}
#endif //_SPRITEBATCH_

View File

@ -0,0 +1,58 @@
/********************************************************
* Texture.h *
* *
* XFX Texture definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_GRAPHICS_TEXTURE_
#define _XFX_GRAPHICS_TEXTURE_
#include <System/Types.h>
#include <System/IO/Stream.h>
#include "GraphicsResource.h"
using namespace System::IO;
namespace XFX
{
namespace Graphics
{
struct TextureCreationParameters;
struct TextureInformation;
/// <summary>
/// Represents a texture resource.
/// </summary>
class Texture : GraphicsResource
{
private:
static ImageFileFormat_t ILimageformat2XNAimageformat(int ILFormat);
protected:
void Dispose(bool disposing);
public:
int LevelCount();
int LevelOfDetail;
static Texture FromFile(GraphicsDevice graphicsDevice, Stream textureStream);
static Texture FromFile(GraphicsDevice graphicsDevice, char* filename);
static Texture FromFile(GraphicsDevice graphicsDevice, Stream textureStream, int numberBytes);
static Texture FromFile(GraphicsDevice graphicsDevice, Stream textureStream, TextureCreationParameters creationParameters);
static Texture FromFile(GraphicsDevice graphicsDevice, char* filename, TextureCreationParameters creationParameters);
static Texture FromFile(GraphicsDevice graphicsDevice, Stream textureStream, int numberBytes, TextureCreationParameters creationParameters);
static Texture FromFile(GraphicsDevice graphicsDevice, char* filename, int width, int height, int depth);
void GenerateMipMaps(TextureFilter_t filterType);
static TextureCreationParameters GetCreationParameters(GraphicsDevice graphicsDevice, Stream textureStream);
static TextureCreationParameters GetCreationParameters(GraphicsDevice graphicsDevice, char* filename);
static TextureCreationParameters GetCreationParameters(GraphicsDevice graphicsDevice, Stream textureStream, int numberBytes);
static TextureInformation GetTextureInformation(Stream textureStream);
static TextureInformation GetTextureInformation(char* filename);
static TextureInformation GetTextureInformation(Stream textureStream, int numberBytes);
void Save(char* filename, ImageFileFormat_t format);
};
}
}
#endif //_XFX_GRAPHICS_TEXTURE_

View File

@ -0,0 +1,74 @@
/********************************************************
* Texture2D.h *
* *
* XFX Texture2D definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _TEXTURE2D_
#define _TEXTURE2D_
#include "Texture.h"
#include <System/IO/Stream.h>
using namespace System;
using namespace System::IO;
namespace XFX
{
class Rectangle;
namespace Graphics
{
class Texture2D : Texture
{
private:
GraphicsDevice device;
int _height; // The height of the texture before resizing it
bool _isDisposed; // True when the texture has been disposed
int _numberOfLevels; // The number of mip levels for the texture
TextureUsage_t _textureUsage;
SurfaceFormat_t _surfaceFormat; // The colour format of the texture
int _width; // the width of the texture before resizing it
int textureId; // The reference ID of the texture in OpenGL memory
int imageId;
Texture2D(GraphicsDevice graphicsDevice);
void Load(byte buffer[]);
protected:
void Dispose(bool disposing);
public:
SurfaceFormat_t Format();
int Height();
TextureUsage_t TextureUsage_();
int Width();
Texture2D(GraphicsDevice graphicsDevice, int width, int height);
Texture2D(GraphicsDevice graphicsDevice, int width, int height, int numberLevels, TextureUsage_t usage, SurfaceFormat_t format);
static Texture2D FromFile(GraphicsDevice graphicsDevice, Stream textureStream);
static Texture2D FromFile(GraphicsDevice graphicsDevice, Stream textureStream, TextureCreationParameters creationParameters);
static Texture2D FromFile(GraphicsDevice graphicsDevice, Stream textureStream, int numberBytes);
static Texture2D FromFile(GraphicsDevice graphicsDevice, Stream textureStream, int numberBytes, TextureCreationParameters creationParameters);
static Texture2D FromFile(GraphicsDevice graphicsDevice, char* filename);
static Texture2D FromFile(GraphicsDevice graphicsDevice, char* filename, TextureCreationParameters creationParameters);
static Texture2D FromFile(GraphicsDevice graphicsDevice, char* filename, int width, int height);
template <class T>
void GetData(T data[]);
template <class T>
void GetData(T data[], int startIndex, int elementCount);
template <class T>
void GetData(int level, Rectangle rect, T data[], int startIndex, int elementCount);
template <class T>
void SetData(T data[]);
template <class T>
void SetData(T data[], int startIndex, int elementCount, SetDataOptions_t options);
template <class T>
void SetData(int level, Rectangle rect, T data[], int startIndex, int elementCount, SetDataOptions_t options);
};
}
}
#endif //_TEXTURE2D_

View File

@ -0,0 +1,39 @@
/********************************************************
* TextureCollection.h *
* *
* XFX TextureCollection definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_GRAPHICS_TEXTURECOLLECTION_
#define _XFX_GRAPHICS_TEXTURECOLLECTION_
#include <System/Collections/Generic/List.h>
#include "Texture.h"
using namespace System::Collections::Generic;
namespace XFX
{
namespace Graphics
{
/// <summary>
///
/// </summary>
class TextureCollection
{
private:
bool disposed;
List<Texture> textures;
void Dispose();
void Dispose(bool disposing);
public:
TextureCollection();
~TextureCollection();
Texture operator[](int index);
};
}
}
#endif //_XFX_GRAPHICS_TEXTURECOLLECTION_

View File

@ -0,0 +1,48 @@
/********************************************************
* TextureCreationParameters.h *
* *
* XFX TextureCreationParameters definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _TEXTURECREATIONPARAMETERS_
#define _TEXTURECREATIONPARAMETERS_
#include "Color.h"
#include "Enums.h"
namespace XFX
{
namespace Graphics
{
/// <summary>
/// Describes the parameters to use when initializing a new instance of a texture.
/// </summary>
struct TextureCreationParameters
{
int Width;
int Height;
int Depth;
int MipLevels;
SurfaceFormat_t Format;
Color ColorKey;
FilterOptions_t Filter;
FilterOptions_t MipFilter;
static TextureCreationParameters Default;
TextureCreationParameters(int width, int height, int depth, int mipLevels, SurfaceFormat_t format,
TextureUsage_t textureUsage, Color colorKey, FilterOptions_t filter, FilterOptions_t mipFilter);
TextureCreationParameters(const TextureCreationParameters &obj);
TextureCreationParameters();
bool Equals(TextureCreationParameters other);
int GetHashCode();
char* ToString();
bool operator!=(TextureCreationParameters other);
bool operator==(TextureCreationParameters other);
bool operator =(TextureCreationParameters other);
};
}
}
#endif //_TEXTURECREATIONPARAMETERS_

View File

@ -0,0 +1,44 @@
/********************************************************
* TextureInformation.h *
* *
* XFX TextureInformation definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _TEXTUREINFORMATION_
#define _TEXTUREINFORMATION_
#include "Enums.h"
namespace XFX
{
namespace Graphics
{
/// <summary>
/// Encapsulates information describing texture resources.
/// </summary>
struct TextureInformation
{
int Depth;
SurfaceFormat_t Format;
int Height;
ImageFileFormat_t ImageFormat;
int MipLevels;
ResourceType_t ResourceType_;
int Width;
TextureInformation(int width, int height, int depth, int mipLevels, SurfaceFormat_t format);
TextureInformation(const TextureInformation &obj); //Copy Constructor
TextureInformation(); // Default Constructor
bool Equals(TextureInformation other);
int GetHashCode();
char* ToString();
bool operator!=(TextureInformation other);
bool operator==(TextureInformation other);
TextureInformation operator=(TextureInformation other);
};
}
}
#endif //_TEXTUREINFORMATION_

View File

@ -0,0 +1,41 @@
/********************************************************
* VertexElement.h *
* *
* XFX VertexElement definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _VERTEXELEMENT_
#define _VERTEXELEMENT_
#include <System.h>
#include <Graphics/Enums.h>
namespace XFX
{
namespace Graphics
{
/// <summary>
/// Defines input vertex data to the pipeline.
/// </summary>
class VertexElement
{
public:
short Offset;
short Stream;
BYTE UsageIndex;
VertexElementFormat_t VertexElementFormat_;
VertexElementMethod_t VertexElementMethod_;
VertexElementUsage_t VertexElementUsage_;
VertexElement(short stream, short offset, VertexElementFormat_t elementFormat, VertexElementMethod_t elementMethod, VertexElementUsage_t elementUsage, BYTE usageIndex);
int Equals(const VertexElement &other);
int GetHashCode();
int operator!=(const VertexElement &other);
int operator==(const VertexElement &other);
};
}
}
#endif //_VERTEXELEMENT_

View File

@ -0,0 +1,44 @@
/********************************************************
* VertexPositionNormalTexture.h *
* *
* XFX VertexPositionNormalTexture definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _VERTEXPOSITIONNORMALTEXTURE_
#define _VERTEXPOSITIONNORMALTEXTURE_
#include "VertexElement.h"
#include <Vector2.h>
#include <Vector3.h>
namespace XFX
{
namespace Graphics
{
/// <summary>
/// Describes a custom vertex format structure that contains position, normal data,
/// and one set of texture coordinates.
/// </summary>
class VertexPositionNormalTexture
{
public:
Vector3 Normal;
Vector3 Position;
Vector2 TextureCoordinate;
static const VertexElement VertexElements[];
static int SizeInBytes();
VertexPositionNormalTexture(Vector3 &position, Vector3 &normal, Vector2 &textureCoordinate);
int Equals(const VertexPositionNormalTexture &other);
int GetHashCode();
int operator!=(const VertexPositionNormalTexture &other);
int operator==(const VertexPositionNormalTexture &other);
};
}
}
#endif //_VERTEXPOSITIONNORMALTEXTURE_

View File

@ -0,0 +1,43 @@
/********************************************************
* VertexPositionTexture.h *
* *
* XFX VertexPositionTexture definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _VERTEXPOSITIONTEXTURE_
#define _VERTEXPOSITIONTEXTURE_
#include "VertexElement.h"
namespace XFX
{
class Vector2;
class Vector3;
namespace Graphics
{
/// <summary>
/// Describes a custom vertex format structure that contains position and one
/// set of texture coordinates.
/// </summary>
class VertexPositionTexture
{
public:
Vector3 Position;
Vector2 TextureCoordinate;
static const VertexElement VertexElements[];
static int SizeInBytes();
VertexPositionTexture(Vector3 &position, Vector2 &textureCoordinate);
int Equals(const VertexPositionTexture &other);
int GetHashCode();
int operator!=(const VertexPositionTexture &other);
int operator==(const VertexPositionTexture &other);
};
}
}
#endif //_VERTEXPOSITIONTEXTURE_

View File

@ -0,0 +1,36 @@
/********************************************************
* Viewport.h *
* *
* XFX Viewport definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
namespace XFX
{
struct Matrix;
struct Vector3;
namespace Graphics
{
/// <summary>
/// Defines the window dimensions of a render-target surface onto which a 3D volume projects.
/// </summary>
struct Viewport
{
private:
static bool WithinEpsilon(float a, float b);
public:
float AspectRatio();
int Height;
int MaxDepth;
int MinDepth;
int Width;
int X;
int Y;
Vector3 Project(Vector3 source, Matrix projection, Matrix view, Matrix world);
Vector3 Unproject(Vector3 source, Matrix projection, Matrix view, Matrix world);
};
}
}

View File

@ -0,0 +1,31 @@
/********************************************************
* GraphicsDeviceInformation.h *
* *
* XFX GraphicsDeviceInformation definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _GRAPHICSDEVICEINFORMATION_
#define _GRAPHICSDEVICEINFORMATION_
#include <Graphics/Enums.h>
#include <Graphics/PresentationParameters.h>
using namespace XFX::Graphics;
namespace XFX
{
/// <summary>
/// Holds the settings for creating a graphics device.
/// </summary>
class GraphicsDeviceInformation
{
public:
GraphicsAdapter Adapter;
DeviceType deviceType;
PresentationParameters presentationParameters;
GraphicsDeviceInformation Clone();
};
}
#endif //_GRAPHICSDEVICEINFORMATION_

View File

@ -0,0 +1,60 @@
/********************************************************
* GraphicsDeviceManager.h *
* *
* XFX GraphicsDeviceManager definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_GRAPHICSDEVICEMANAGER_
#define _XFX_GRAPHICSDEVICEMANAGER_
#include "Game.h"
#include "Graphics/GraphicsDevice.h"
#include "GraphicsDeviceInformation.h"
#include "Interfaces.h"
#include "Graphics/IGraphicsDeviceService.h"
#include "Graphics/Enums.h"
#include "System/Interfaces.h"
using namespace System;
using namespace XFX::Graphics;
namespace XFX
{
class GraphicsDeviceManager : public IGraphicsDeviceService, public IDisposable, public IGraphicsDeviceManager
{
private:
bool isFullScreen;
Game _game;
GraphicsDevice graphicsDevice;
protected:
virtual void Dispose(int disposing);
virtual int CanResetDevice(GraphicsDeviceInformation newDeviceInfo);
public:
GraphicsDevice GraphicsDevice_();
bool IsFullScreen();
float MinimumPixelShaderProfile;
float MinimumVertexShaderProfile;
int PreferMultiSampling;
SurfaceFormat_t PreferredBackBufferFormat;
int PreferredBackBufferWidth;
int PreferredBackBufferHeight;
DepthFormat_t PreferredDepthStencilFormat;
int SynchronizeWithVerticalRetrace;
static const int DefaultBackBufferWidth;
static const int DefaultBackBufferHeight;
static SurfaceFormat_t ValidAdapterFormats[];
static SurfaceFormat_t ValidBackBufferFormats[];
static const DeviceType_t ValidDeviceTypes[];
GraphicsDeviceManager(Game game);
void ApplyChanges();
void Dispose();
void ToggleFullscreen();
};
}
#endif //_XFX_GRAPHICSDEVICEMANAGER_

34
include/Input.h Normal file
View File

@ -0,0 +1,34 @@
/********************************************************
* Input.h *
* *
* XFX::Input namespace include file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _INPUT_
#define _INPUT_
extern "C"{
#include <hal/input.h>
}
//
//Data Types
//
#include "GamePad.h"
#include "GamePadButtons.h"
//#include "GamePadCapabilities.h"
#include "GamePadState.h"
#include "Keyboard.h"
#include "Mouse.h"
//
//Enums
//
//#include "Buttons.h"
#include "ButtonState.h"
#include "GamePadDeadZone.h"
#include "GamePadType.h"
//
//Interfaces
//
#endif //_INPUT_

111
include/Input/Enums.h Normal file
View File

@ -0,0 +1,111 @@
/********************************************************
* Enums.h *
* *
* XFX::Input enumeration definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_INPUT_ENUMS_
#define _XFX_INPUT_ENUMS_
namespace XFX
{
namespace Input
{
/// <summary>
/// Enumerates input device buttons.
/// </summary>
struct Buttons
{
enum type
{
A = 0,
B = 1,
Back = 0x20,
Black = 4,
DPadDown = 0x02,
DPadLeft = 0x04,
DPadRight = 0x08,
DPadUp = 0x01,
LeftStick = 0x40,
LeftThumbStickDown,
LeftThumbStickLeft,
LeftThumbStickRight,
LeftThumbStickUp,
LeftTrigger = 6,
RightStick = 0x80,
RightThumbStickDown,
RightThumbStickLeft,
RightThumbStickRight,
RightThumbStickUp,
RightTrigger = 7,
Start = 0x10,
White = 5,
X = 2,
Y = 3
};
};
/// <summary>
/// Identifies the state of a mouse button or Xbox Controller button.
/// </summary>
struct ButtonState
{
enum type
{
Pressed = 1,
Released = 0
};
};
/// <summary>
/// Specifies a type of dead zone processing to apply to Xbox controller analog sticks when calling GamePad::GetState.
/// </summary>
struct GamePadDeadZone
{
enum type
{
Circular,
IndependantAxes,
None
};
};
/// <summary>
/// Describes the type of a given Xbox controller.
/// </summary>
struct GamePadType
{
enum type
{
ArcadeStick,
DancePad,
DrumKit,
FlightStick,
GamePad,
Guitar,
Unknown,
Wheel
};
};
/// <summary>
/// Identifies the state of a keyboard key.
/// </summary>
struct KeyState
{
enum type
{
Down = 1,
Up = 0
};
};
typedef Buttons::type Buttons_t;
typedef ButtonState::type ButtonState_t;
typedef GamePadDeadZone::type GamePadDeadZone_t;
typedef GamePadType::type GamePadType_t;
typedef KeyState::type KeyState_t;
}
}
#endif //_XFX_INPUT_ENUMS_

32
include/Input/GamePad.h Normal file
View File

@ -0,0 +1,32 @@
/********************************************************
* GamePad.h *
* *
* XFX GamePad definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_INPUT_GAMEPAD_
#define _XFX_INPUT_GAMEPAD_
#include <Enums.h>
#include "Enums.h"
#include "GamePadState.h"
namespace XFX
{
namespace Input
{
/// <summary>
/// Allows retrieval of user interaction with an XBOX Controller
/// and setting of controller vibration motors.
/// </summary>
class GamePad
{
public:
static GamePadState GetState(PlayerIndex_t playerIndex);
static GamePadState GetState(PlayerIndex_t playerIndex, GamePadDeadZone_t deadZoneMode);
static int SetVibration(PlayerIndex_t playerIndex, float leftMotor, float rightMotor);
};
}
}
#endif //_XFX_INPUT_GAMEPAD_

View File

@ -0,0 +1,68 @@
/********************************************************
* GamePadButtons.h *
* *
* XFX GamePadButtons definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _GAMEPADBUTTONS_
#define _GAMEPADBUTTONS_
#include "Enums.h"
namespace XFX
{
namespace Input
{
struct GamePadButtons
{
ButtonState_t A;
ButtonState_t B;
ButtonState_t Back;
ButtonState_t Black;
ButtonState_t LeftStick;
ButtonState_t RightStick;
ButtonState_t Start;
ButtonState_t White;
ButtonState_t X;
ButtonState_t Y;
bool GamePadButtons::operator!=(const GamePadButtons &other)
{
return !((A == other.A) && (B == other.B) && (Back == other.Back) &&
(Black == other.Black) && (LeftStick == other.LeftStick) &&
(RightStick == other.RightStick) && (Start == other.Start) &&
(White == other.White) && (X == other.X) && (Y == other.Y));
}
bool GamePadButtons::operator==(const GamePadButtons &other)
{
return ((A == other.A) && (B == other.B) && (Back == other.Back) &&
(Black == other.Black) && (LeftStick == other.LeftStick) &&
(RightStick == other.RightStick) && (Start == other.Start) &&
(White == other.White) && (X == other.X) && (Y == other.Y));
}
};
struct GamePadDPad
{
ButtonState_t Down;
ButtonState_t Left;
ButtonState_t Right;
ButtonState_t Up;
bool GamePadDPad::operator!=(const GamePadDPad &other)
{
return !((Down == other.Down) && (Left == other.Left) &&
(Right == other.Right) && (Up == other.Up));
}
bool GamePadDPad::operator==(const GamePadDPad &other)
{
return ((Down == other.Down) && (Left == other.Left) &&
(Right == other.Right) && (Up == other.Up));
}
};
}
}
#endif //_GAMEPADBUTTONS_

View File

@ -0,0 +1,39 @@
/********************************************************
* GamePadState.h *
* *
* XFX GamePadState definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _GAMEPADSTATE_
#define _GAMEPADSTATE_
#include "GamePadButtons.h"
#include "GamePadThumbSticks.h"
#include "GamePadTriggers.h"
namespace XFX
{
namespace Input
{
/// <summary>
/// Represents specific information about the state of an Xbox 360 Controller, including the current state of buttons
/// and sticks.
/// </summary>
struct GamePadState
{
GamePadButtons Buttons;
GamePadDPad DPad;
bool IsConnected;
GamePadThumbSticks ThumbSticks;
GamePadTriggers Triggers;
bool IsButtonDown(Buttons_t button);
bool IsButtonUp(Buttons_t button);
operator==(GamePadState other);
operator!=(GamePadState other);
};
}
}
#endif //_GAMEPADSTATE_

41
include/Input/Keyboard.h Normal file
View File

@ -0,0 +1,41 @@
/********************************************************
* Keyboard.h *
* *
* XFX Keyboard definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_INPUT_KEYBOARD_
#define _XFX_INPUT_KEYBOARD_
#include "Enums.h"
#include "Keys.h"
namespace XFX
{
namespace Input
{
/// <summary>
/// Represents a state of keystrokes recorded by a keyboard input device.
/// </summary>
struct KeyboardState
{
KeyboardState();
KeyboardState(unsigned char keys[]);
unsigned char* GetPressedKeys();
bool IsKeyDown(unsigned char key);
bool IsKeyUp(unsigned char key);
};
/// <summary>
/// Allows retrieval of keystrokes from a keyboard input device.
/// </summary>
class Keyboard
{
public:
static KeyboardState GetState();
};
}
}
#endif //_XFX_INPUT_KEYBOARD_

48
include/Input/Mouse.h Normal file
View File

@ -0,0 +1,48 @@
/********************************************************
* Mouse.h *
* *
* XFX Mouse definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_INPUT_MOUSE_
#define _XFX_INPUT_MOUSE_
#include "Enums.h"
#include <System/Types.h>
using namespace System;
namespace XFX
{
namespace Input
{
/// <summary>
///
/// </summary>
struct MouseState
{
ButtonState_t LeftButton;
ButtonState_t MiddleButton;
ButtonState_t RightButton;
int X;
ButtonState_t XButton1;
ButtonState_t XButton2;
int Y;
bool operator!=(const MouseState other);
bool operator==(const MouseState other);
};
/// <summary>
/// Allows retrieval of position and button clicks from a mouse input device.
/// </summary>
class Mouse
{
public:
static MouseState GetState();
static void SetPosition(int x, int y);
};
}
}
#endif //_XFX_INPUT_MOUSE_

74
include/Interfaces.h Normal file
View File

@ -0,0 +1,74 @@
/********************************************************
* Interfaces.h *
* *
* XFX interfaces definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_INTERFACES_
#define _XFX_INTERFACES_
#include <System/Types.h>
namespace XFX
{
class GameTime;
/// <summary>
/// Defines the interface for a drawable game component.
/// </summary>
interface IDrawable
{
public:
virtual int DrawOrder()=0;
virtual bool Visible()=0;
virtual void Draw(GameTime gameTime)=0;
virtual ~IDrawable();
EventHandler DrawOrderChanged;
EventHandler VisibleChanged;
};
/// <summary>
/// Defines an interface for game components.
/// </summary>
interface IGameComponent
{
public:
virtual void Initialize()=0;
virtual ~IGameComponent();
};
/// <summary>
/// Defines the interface for an object that manages a Graphics.GraphicsDevice.
/// </summary>
interface IGraphicsDeviceManager
{
public:
virtual int BeginDraw()=0;
virtual void CreateDevice()=0;
virtual void EndDraw()=0;
virtual ~IGraphicsDeviceManager();
};
/// <summary>
/// Defines an interface for a game component that should be updated in Game.Update.
/// </summary>
interface IUpdateable
{
public:
virtual bool Enabled()=0;
virtual void Enabled(int value)=0;
virtual int UpdateOrder()=0;
virtual void UpdateOrder(int value)=0;
virtual ~IUpdateable();
virtual void Update(GameTime gameTime)=0;
EventHandler EnabledChanged;
EventHandler UpdateOrderChanged;
};
}
#endif //_XFX_INTERFACES_

250
include/Keys.h Normal file
View File

@ -0,0 +1,250 @@
/********************************************************
* Keys.h *
* *
* XFX Keyboard Keys definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef KEYS_H
#define KEYS_H
// Modifier key flag values
#define XKEYBOARD_LCONTROL_FLAG 0x01
#define XKEYBOARD_LSHIFT_FLAG 0x02
#define XKEYBOARD_LALT_FLAG 0x04
#define XKEYBOARD_LWINDOWS_FLAG 0x08
#define XKEYBOARD_RCONTROL_FLAG 0x10
#define XKEYBOARD_RSHIFT_FLAG 0x20
#define XKEYBOARD_RALT_FLAG 0x40
#define XKEYBOARD_RWINDOWS_FLAG 0x80
// usb keyboard usage values for key modifiers
#define USB_KEYBOARD_USAGE_LCONTROL 0xE0
#define USB_KEYBOARD_USAGE_LSHIFT 0xE1
#define USB_KEYBOARD_USAGE_LALT 0xE2
#define USB_KEYBOARD_USAGE_LWINDOWS 0xE3
#define USB_KEYBOARD_USAGE_RCONTROL 0xE4
#define USB_KEYBOARD_USAGE_RSHIFT 0xE5
#define USB_KEYBOARD_USAGE_RALT 0xE6
#define USB_KEYBOARD_USAGE_RWINDOWS 0xE7
// keyboard state flags - keyup, shift, ctrl, alt etc
#define XKEYBOARD_KEYUP 0x01
#define XKEYBOARD_SHIFT 0x02
#define XKEYBOARD_CONTROL 0x04
#define XKEYBOARD_ALT 0x08
// key code constants
#define XKEY_INVALID 0x00
#define XKEY_LBUTTON 0x01
#define XKEY_RBUTTON 0x02
#define XKEY_CANCEL 0x03
#define XKEY_MBUTTON 0x04
#define XKEY_XBUTTON1 0x05
#define XKEY_XBUTTON2 0x06
#define XKEY_BACKSPACE 0x08
#define XKEY_TAB 0x09
#define XKEY_CLEAR 0x0C
#define XKEY_RETURN 0x0D
#define XKEY_SHIFT 0x10
#define XKEY_CONTROL 0x11
#define XKEY_MENU 0x12
#define XKEY_PAUSE 0x13
#define XKEY_CAPSLOCK 0x14
#define XKEY_KANA 0x15
#define XKEY_JUNJA 0x17
#define XKEY_FINAL 0x18
#define XKEY_KANJI 0x19
#define XKEY_ESCAPE 0x1B
#define XKEY_CONVERT 0x1C
#define XKEY_NONCONVERT 0x1D
#define XKEY_ACCEPT 0x1E
#define XKEY_MODECHANGE 0x1F
#define XKEY_SPACE 0x20
#define XKEY_PRIOR 0x21
#define XKEY_NEXT 0x22
#define XKEY_END 0x23
#define XKEY_HOME 0x24
#define XKEY_LEFT 0x25
#define XKEY_UP 0x26
#define XKEY_RIGHT 0x27
#define XKEY_DOWN 0x28
#define XKEY_SELECT 0x29
#define XKEY_PRINT 0x2A
#define XKEY_EXECUTE 0x2B
#define XKEY_PRINTSCREEN 0x2C
#define XKEY_INSERT 0x2D
#define XKEY_DELETE 0x2E
#define XKEY_HELP 0x2F
#define XKEY_0 0x30
#define XKEY_1 0x31
#define XKEY_2 0x32
#define XKEY_3 0x33
#define XKEY_4 0x34
#define XKEY_5 0x35
#define XKEY_6 0x36
#define XKEY_7 0x37
#define XKEY_8 0x38
#define XKEY_9 0x39
#define XKEY_A 0x41
#define XKEY_B 0x42
#define XKEY_C 0x43
#define XKEY_D 0x44
#define XKEY_E 0x45
#define XKEY_F 0x46
#define XKEY_G 0x47
#define XKEY_H 0x48
#define XKEY_I 0x49
#define XKEY_J 0x4A
#define XKEY_K 0x4B
#define XKEY_L 0x4C
#define XKEY_M 0x4D
#define XKEY_N 0x4E
#define XKEY_O 0x4F
#define XKEY_P 0x50
#define XKEY_Q 0x51
#define XKEY_R 0x52
#define XKEY_S 0x53
#define XKEY_T 0x54
#define XKEY_U 0x55
#define XKEY_V 0x56
#define XKEY_W 0x57
#define XKEY_X 0x58
#define XKEY_Y 0x59
#define XKEY_Z 0x5A
#define XKEY_LWIN 0x5B
#define XKEY_RWIN 0x5C
#define XKEY_APPS 0x5D
#define XKEY_SLEEP 0x5F
#define XKEY_NUMPAD0 0x60
#define XKEY_NUMPAD1 0x61
#define XKEY_NUMPAD2 0x62
#define XKEY_NUMPAD3 0x63
#define XKEY_NUMPAD4 0x64
#define XKEY_NUMPAD5 0x65
#define XKEY_NUMPAD6 0x66
#define XKEY_NUMPAD7 0x67
#define XKEY_NUMPAD8 0x68
#define XKEY_NUMPAD9 0x69
#define XKEY_MULTIPLY 0x6A
#define XKEY_ADD 0x6B
#define XKEY_NUMPAD_ENTER 0x6C
#define XKEY_SUBTRACT 0x6D
#define XKEY_DECIMAL 0x6E
#define XKEY_DIVIDE 0x6F
#define XKEY_F1 0x70
#define XKEY_F2 0x71
#define XKEY_F3 0x72
#define XKEY_F4 0x73
#define XKEY_F5 0x74
#define XKEY_F6 0x75
#define XKEY_F7 0x76
#define XKEY_F8 0x77
#define XKEY_F9 0x78
#define XKEY_F10 0x79
#define XKEY_F11 0x7A
#define XKEY_F12 0x7B
#define XKEY_F13 0x7C
#define XKEY_F14 0x7D
#define XKEY_F15 0x7E
#define XKEY_F16 0x7F
#define XKEY_F17 0x80
#define XKEY_F18 0x81
#define XKEY_F19 0x82
#define XKEY_F20 0x83
#define XKEY_F21 0x84
#define XKEY_F22 0x85
#define XKEY_F23 0x86
#define XKEY_F24 0x87
#define XKEY_NUMLOCK 0x90
#define XKEY_SCROLL_LOCK 0x91
#define XKEY_NUMPADEQUALS 0x92
/*
* Fujitsu/OASYS kbd definitions
*/
#define XKEY_OEM_FJ_JISHO 0x92 // 'Dictionary' key
#define XKEY_OEM_FJ_MASSHOU 0x93 // 'Unregister word' key
#define XKEY_OEM_FJ_TOUROKU 0x94 // 'Register word' key
#define XKEY_OEM_FJ_LOYA 0x95 // 'Left OYAYUBI' key
#define XKEY_OEM_FJ_ROYA 0x96 // 'Right OYAYUBI' key
#define XKEY_LSHIFT 0xA0
#define XKEY_RSHIFT 0xA1
#define XKEY_LCONTROL 0xA2
#define XKEY_RCONTROL 0xA3
#define XKEY_LMENU 0xA4
#define XKEY_RMENU 0xA5
#define XKEY_BROWSER_BACK 0xA6
#define XKEY_BROWSER_FORWARD 0xA7
#define XKEY_BROWSER_REFRESH 0xA8
#define XKEY_BROWSER_STOP 0xA9
#define XKEY_BROWSER_SEARCH 0xAA
#define XKEY_BROWSER_FAVORITES 0xAB
#define XKEY_BROWSER_HOME 0xAC
#define XKEY_VOLUME_MUTE 0xAD
#define XKEY_VOLUME_DOWN 0xAE
#define XKEY_VOLUME_UP 0xAF
#define XKEY_MEDIA_NEXT_TRACK 0xB0
#define XKEY_MEDIA_PREV_TRACK 0xB1
#define XKEY_MEDIA_STOP 0xB2
#define XKEY_MEDIA_PLAY_PAUSE 0xB3
#define XKEY_LAUNCH_MAIL 0xB4
#define XKEY_LAUNCH_MEDIA_SELECT 0xB5
#define XKEY_LAUNCH_APP1 0xB6
#define XKEY_LAUNCH_APP2 0xB7
#define XKEY_SEMICOLON 0xBA
#define XKEY_EQUALS 0xBB
#define XKEY_COMMA 0xBC
#define XKEY_MINUS 0xBD
#define XKEY_PERIOD 0xBE
#define XKEY_SLASH 0xBF
#define XKEY_GRAVE 0xC0
#define XKEY_LBRACE 0xDB
#define XKEY_BACKSLASH 0xDC
#define XKEY_RBRACE 0xDD
#define XKEY_QUOTE 0xDE
#define XKEY_MISC 0xDF
#define XKEY_OEM_AX 0xE1
#define XKEY_OEM_102 0xE2
#define XKEY_ICO_HELP 0xE3
#define XKEY_ICO_00 0xE4
#define XKEY_PROCESSKEY 0xE5
#define XKEY_ICO_CLEAR 0xE6
#define XKEY_PACKET 0xE7
#define XKEY_OEM_RESET 0xE9
#define XKEY_OEM_JUMP 0xEA
#define XKEY_OEM_PA1 0xEB
#define XKEY_OEM_PA2 0xEC
#define XKEY_OEM_PA3 0xED
#define XKEY_OEM_WSCTRL 0xEE
#define XKEY_OEM_CUSEL 0xEF
#define XKEY_OEM_ATTN 0xF0
#define XKEY_OEM_FINISH 0xF1
#define XKEY_OEM_COPY 0xF2
#define XKEY_OEM_AUTO 0xF3
#define XKEY_OEM_ENLW 0xF4
#define XKEY_OEM_BACKTAB 0xF5
#define XKEY_ATTN 0xF6
#define XKEY_CRSEL 0xF7
#define XKEY_EXSEL 0xF8
#define XKEY_EREOF 0xF9
#define XKEY_PLAY 0xFA
#define XKEY_ZOOM 0xFB
#define XKEY_NONAME 0xFC
#define XKEY_PA1 0xFD
#define XKEY_OEM_CLEAR 0xFE
#endif //KEYS_H

43
include/MathHelper.h Normal file
View File

@ -0,0 +1,43 @@
/********************************************************
* MathHelper.h *
* *
* XFX MathHelper definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _SYSTEM_MATHHELPER_
#define _SYSTEM_MATHHELPER_
namespace XFX
{
/// <summary>
/// Contains commonly used precalculated values.
/// </summary>
class MathHelper
{
private:
MathHelper(); // Private constructor to prevent instantiation.
public:
static const float E;
static const float Log10E;
static const float Log2E;
static const float Pi;
static const float PiOver2;
static const float PiOver4;
static const float TwoPi;
static float Baricentric(float value1, float value2, float value3, float amount1, float amount2);
static float CatmullRom(float value1, float value2, float value3, float value4, float amount);
static float Clamp(float value, float min, float max);
static float Distance(float value1, float value2);
static float Hermite(float value1, float tangent1, float value2, float tangent2, float amount);
static float Lerp(float value1, float value2, float amount);
static float Max(float value1, float value2);
static float Min(float value1, float value2);
static float SmoothStep(float value1, float value2, float amount);
static float ToDegrees(float radians);
static float ToRadians(float degrees);
};
}
#endif //_SYSTEM_MATHHELPER_

144
include/Matrix.h Normal file
View File

@ -0,0 +1,144 @@
/********************************************************
* Matrix.h *
* *
* XFX Matrix definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_MATRIX_
#define _XFX_MATRIX_
#include <System/Types.h>
namespace XFX
{
struct Plane;
struct Quaternion;
struct Vector3;
/// <summary>
/// Defines a Matrix.
/// </summary>
struct Matrix
{
public:
float M11;
float M12;
float M13;
float M14;
float M21;
float M22;
float M23;
float M24;
float M31;
float M32;
float M33;
float M34;
float M41;
float M42;
float M43;
float M44;
Vector3 Backward();
void Backward(Vector3 vector);
Vector3 Down();
void Down(Vector3 vector);
Vector3 Forward();
void Forward(Vector3 vector);
static const Matrix Identity;
Vector3 Left();
void Left(Vector3 vector);
Vector3 Right();
void Right(Vector3 vector);
Vector3 Translation();
void Translation(Vector3 vector);
Vector3 Up();
void Up(Vector3 vector);
Matrix(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44);
Matrix(const Matrix& obj);
Matrix();
static Matrix Add(Matrix matrix1, Matrix matrix2);
static void Add(Matrix matrix1, Matrix matrix2, out Matrix result);
static Matrix CreateBillboard(Vector3 objectPosition, Vector3 cameraPosition, Vector3 cameraUpVector, Vector3* cameraForwardVector);
static void CreateBillboard(Vector3 objectPosition, Vector3 cameraPosition, Vector3 cameraUpVector, Vector3* cameraForwardVector, out Matrix result);
static Matrix CreateConstrainedBillboard(Vector3 objectPosition, Vector3 cameraPosition, Vector3 rotateAxis, Vector3* cameraForwardVector, Vector3* objectForwardVector);
static void CreateConstrainedBillboard(Vector3 objectPosition, Vector3 cameraPosition, Vector3 rotateAxis, Vector3* cameraForwardVector, Vector3* objectForwardVector, out Matrix result);
static Matrix CreateFromAxisAngle(Vector3 axis, float angle);
static void CreateFromAxisAngle(Vector3 axis, float angle, out Matrix result);
static Matrix CreateFromQuaternion(Quaternion rotation);
static void CreateFromQuaternion(Quaternion rotation, out Matrix result);
static Matrix CreateFromYawPitchRoll(float yaw, float pitch, float roll);
static void CreateFromYawPitchRoll(float yaw, float pitch, float roll, out Matrix result);
static Matrix CreateLookAt(Vector3 cameraPosition, Vector3 cameraTarget, Vector3 cameraUpVector);
static void CreateLookAt(Vector3 cameraPosition, Vector3 cameraTarget, Vector3 cameraUpVector, out Matrix result);
static Matrix CreateOrthographic(float width, float height, float zNearPlane, float zFarPlane);
static void CreateOrthographic(float width, float height, float zNearPlane, float zFarPlane, out Matrix result);
static Matrix CreateOrthographicOffCenter(float left, float right, float bottom, float top, float zNearPlane, float zFarPlane);
static void CreateOrthographicOffCenter(float left, float right, float bottom, float top, float zNearPlane, float zFarPlane, out Matrix result);
static Matrix CreatePerspective(float width, float height, float zNearPlane, float zFarPlane);
static void CreatePerspective(float width, float height, float zNearPlane, float zFarPlane, out Matrix result);
static Matrix CreatePerspectiveFieldOfView(float fieldOfView, float aspectRatio, float nearPlaneDistance, float farPlaneDistance);
static void CreatePerspectiveFieldOfView(float fieldOfView, float aspectRatio, float nearPlaneDistance, float farPlaneDistance, out Matrix result);
static Matrix CreatePerspectiveOffCenter(float left, float right, float bottom, float top, float nearPlaneDistance, float farPlaneDistance);
static void CreatePerspectiveOffCenter(float left, float right, float bottom, float top, float nearPlaneDistance, float farPlaneDistance, out Matrix result);
static Matrix CreateReflection(Plane value);
static void CreateReflection(Plane value, out Matrix result);
static Matrix CreateRotationX(float radians);
static void CreateRotationX(float radians, out Matrix result);
static Matrix CreateRotationY(float radians);
static void CreateRotationY(float radians, out Matrix result);
static Matrix CreateRotationZ(float radians);
static void CreateRotationZ(float radians, out Matrix result);
static Matrix CreateScale(float scale);
static void CreateScale(float scale, out Matrix result);
static Matrix CreateScale(float xScale, float yScale, float zScale);
static void CreateScale(float xScale, float yScale, float zScale, out Matrix result);
static Matrix CreateScale(Vector3 scales);
static void CreateScale(Vector3 scales, out Matrix result);
static Matrix CreateShadow(Vector3 lightDirection, Plane plane);
static void CreateShadow(Vector3 lightDirection, Plane plane, out Matrix result);
static Matrix CreateTranslation(float xPosition, float yPosition, float zPosition);
static void CreateTranslation(float xPosition, float yPosition, float zPosition, out Matrix result);
static Matrix CreateTranslation(Vector3 position);
static void CreateTranslation(Vector3 position, out Matrix result);
static Matrix CreateWorld(Vector3 position, Vector3 forward, Vector3 up);
static void CreateWorld(Vector3 position, Vector3 forward, Vector3 up, out Matrix result);
int Decompose(out Vector3 scale, out Quaternion rotation, out Vector3 translation);
float Determinant();
static Matrix Divide(Matrix matrix1, Matrix matrix2);
static void Divide(Matrix matrix1, Matrix matrix2, out Matrix result);
static Matrix Divide(Matrix matrix1, float divider);
static void Divide(Matrix matrix1, float divider, out Matrix result);
bool Equals(Matrix other);
int GetHashCode();
static Matrix Invert(Matrix matrix);
static void Invert(Matrix matrix, out Matrix result);
static Matrix Lerp(Matrix value1, Matrix value2, float amount);
static void Lerp(Matrix value1, Matrix value2, float amount, out Matrix result);
static Matrix Multiply(Matrix matrix1, Matrix matrix2);
static void Multiply(Matrix matrix1, Matrix matrix2, out Matrix result);
static Matrix Multiply(Matrix matrix1, float scaleFactor);
static void Multiply(Matrix matrix1, float scaleFactor, out Matrix result);
static Matrix Negate(Matrix matrix);
static void Negate(Matrix matrix, out Matrix result);
static Matrix Subtract(Matrix matrix1, Matrix matrix2);
static void Subtract(Matrix matrix1, Matrix matrix2, out Matrix result);
static Matrix Transform(Matrix value, Quaternion rotation);
static void Transform(Matrix value, Quaternion rotation, out Matrix result);
static Matrix Transpose(Matrix matrix);
static void Transpose(Matrix matrix, out Matrix result);
Matrix operator+(const Matrix other);
Matrix operator/(const Matrix other);
Matrix operator/(const float divider);
bool operator==(const Matrix other);
bool operator!=(const Matrix other);
Matrix operator*(const Matrix other);
Matrix operator*(const float scaleFactor);
Matrix operator-(const Matrix other);
Matrix operator-();
Matrix operator=(const Matrix other);
} ALIGNED;
}
#endif //_XFX_MATRIX_

58
include/Media/Enums.h Normal file
View File

@ -0,0 +1,58 @@
/********************************************************
* Enums.h *
* *
* XFX::Media enumeration definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _MEDIA_ENUMS_H_
#define _MEDIA_ENUMS_H_
namespace XFX
{
namespace Media
{
/// <summary>
/// Type of the media source.
/// </summary>
struct MediaSourceType
{
enum type
{
LocalDevice,
WindowsMediaConnect
};
};
/// <summary>
/// Media playback state (playing, paused, or stopped).
/// </summary>
struct MediaState
{
enum type
{
Paused,
Playing,
Stopped
};
};
/// <summary>
/// Type of sounds in a video
/// </summary>
struct VideoSoundtrackType
{
enum type
{
Dialog,
Music,
MusicAndDialog
};
};
typedef MediaSourceType::type MediaSourceType_t;
typedef MediaState::type MediaState_t;
typedef VideoSoundtrackType::type VideoSoundtrackType_t;
}
}
#endif //_MEDIA_ENUMS_H_

32
include/Media/Video.h Normal file
View File

@ -0,0 +1,32 @@
/********************************************************
* Video.h *
* *
* XFX Video definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _VIDEO_H_
#define _VIDEO_H_
#include <System.h>
#include "Enums.h"
namespace XFX
{
namespace Media
{
/// <summary>
/// Represents a video.
/// </summary>
class Video
{
public:
TimeSpan Duration();
float FramesPerSecond();
int Height();
VideoSoundtrackType_t videoSoundtrackType();
int Width();
};
}
}
#endif //_VIDEO_H_

View File

@ -0,0 +1,53 @@
/********************************************************
* VideoPlayer.h *
* *
* XFX VideoPlayer file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _VIDEOPLAYER_H_
#define _VIDEOPLAYER_H_
#include "../Graphics/Texture2D.h"
namespace XFX
{
class TimeSpan;
namespace Media
{
class Video;
/// <summary>
/// Provides methods and properties to playback, pause, resume, and stop video. VideoPlayer also exposes repeat, volume, and play position information.
/// </summary>
class VideoPlayer
{
private:
int isDisposed;
void Dispose(bool disposing);
protected:
~VideoPlayer();
public:
int IsDisposed();
int IsLooped;
int IsMuted;
TimeSpan PlayPosition();
MediaState_t State();
Video Video_();
float Volume;
VideoPlayer();
void Dispose();
Texture2D GetTexture();
void Pause();
void Play(Video &video);
void Resume();
void Stop();
};
}
}
#endif //_VIDEOPLAYER_H_

87
include/Net/Enums.h Normal file
View File

@ -0,0 +1,87 @@
/********************************************************
* Enums.h *
* *
* XFX::Net enumerations definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_NET_ENUMS_
#define _XFX_NET_ENUMS_
namespace XFX
{
namespace Net
{
/// <summary>
/// Defines the reason a session ended.
/// </summary>
struct NetworkSessionEndReason
{
enum type
{
ClientSignedOut,
HostEndedSession,
RemovedByHost,
Disconnected
};
};
/// <summary>
/// Contains additional data about a NetworkSessionJoinException.
/// </summary>
struct NetworkSessionJoinError
{
enum type
{
SessionNotFound,
SessionNotJoinable,
SessionFull
};
};
/// <summary>
/// Defines the different states of a multiplayer session.
/// </summary>
struct NetworkSessionState
{
enum type
{
Lobby,
Playing,
Ended
};
};
/// <summary>
/// Defines the different types of a multiplayer session.
/// </summary>
struct NetworkSessionType
{
enum type
{
Local,
SystemLink,
PlayerMatch,
Ranked
};
};
/// <summary>
/// Defines options for network packet transmission.
/// </summary>
struct SendDataOptions
{
enum type
{
InOrder = 2,
None = 0,
Reliable = 1,
ReliableInOrder = 3
};
};
typedef NetworkSessionEndReason::type NetworkSessionEndReason_t;
typedef NetworkSessionJoinError::type NetworkSessionJoinError_t;
typedef NetworkSessionState::type NetworkSessionState_t;
typedef NetworkSessionType::type NetworkSessionType_t;
typedef SendDataOptions::type SendDataOptions_t;
}
}
#endif //_XFX_NET_ENUMS_

View File

@ -0,0 +1,39 @@
#ifndef _XFX_NET_NETWORKEXCEPTION_
#define _XFX_NET_NETWORKEXCEPTION_
#include <System/Exception.h>
#include "Enums.h"
namespace XFX
{
namespace Net
{
/// <summary>
/// Thrown if there is a network communication failure.
/// </summary>
class NetworkException : Exception
{
public:
public NetworkException();
public NetworkException(char* message);
public NetworkException(char* message, Exception innerException);
};
/// <summary>
/// Thrown if an error was encountered while joining a session.
/// </summary>
class NetworkSessionJoinException : NetworkException
{
public:
public NetworkSessionJoinException();
public NetworkSessionJoinException(char* message);
public NetworkSessionJoinException(char* message, NetworkSessionJoinError joinError);
public NetworkSessionJoinException(char* message, Exception innerException);
public NetworkSessionJoinError JoinError(); //! get
public void JoinError(NetworkSessionJoinError joinError); //! set
};
}
}
#endif //_XFX_NET_NETWORKEXCEPTION_

65
include/Plane.h Normal file
View File

@ -0,0 +1,65 @@
/********************************************************
* Plane.h *
* *
* XFX Plane definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_PLANE_
#define _XFX_PLANE_
#include <System/Types.h>
#include "Enums.h"
#include "Vector3.h"
namespace XFX
{
struct BoundingBox;
struct BoundingSphere;
struct Matrix;
struct Quaternion;
struct Vector4;
/// <summary>
/// Defines a plane.
/// <summary>
struct Plane
{
public:
float D;
Vector3 Normal;
Plane(float a, float b, float c, float d);
Plane(Vector3 normal, float d);
Plane(Vector3 point1, Vector3 point2, Vector3 point3);
Plane(Vector4 value);
Plane(const Plane &obj);
Plane();
float Dot(Vector4 value);
void Dot(Vector4 value, out float result);
float DotCoordinate(Vector3 value);
void DotCoordinate(Vector3 value, out float result);
float DotNormal(Vector3 value);
void DotNormal(Vector3 value, out float result);
bool Equals(const Plane obj);
int GetHashCode();
PlaneIntersectionType_t Intersects(BoundingBox boundingbox);
void Intersects(BoundingBox boundingbox, out PlaneIntersectionType_t result);
PlaneIntersectionType_t Intersects(BoundingSphere sphere);
void Intersects(BoundingSphere sphere, out PlaneIntersectionType_t result);
void Normalize();
Plane Normalize(Plane plane);
void Normalize(Plane plane, out Plane result);
static Plane Transform(Plane plane, Matrix matrix);
static void Transform(Plane plane, Matrix matrix, out Plane result);
static Plane Transform(Plane plane, Quaternion quaternion);
static void Transform(Plane plane, Quaternion quaternion, out Plane result);
bool operator==(const Plane other);
bool operator!=(const Plane other);
Plane operator=(const Plane other);
};
}
#endif //_XFX_PLANE_

32
include/Point.h Normal file
View File

@ -0,0 +1,32 @@
/********************************************************
* Point.h *
* *
* XFX Point definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _POINT_
#define _POINT_
#include <System.h>
namespace XFX
{
class Point
{
public:
int X;
int Y;
static const Point Zero;
Point(int x, int y);
Point(const Point &obj);
Point();
int Equals(const Point &obj);
int operator==(const Point &other);
int operator!=(const Point &other);
Point &operator=(const Point &other);
};
}
#endif //_POINT_

76
include/Quaternion.h Normal file
View File

@ -0,0 +1,76 @@
/********************************************************
* Quaternion.h *
* *
* XFX Quaternion definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_QUATERNION_
#define _XFX_QUATERNION_
#include <System/Types.h>
namespace XFX
{
struct Matrix;
struct Vector3;
struct Quaternion
{
public:
float W, X, Y, Z;
static const Quaternion Identity;
Quaternion(float x, float y, float z, float w);
Quaternion(Vector3 vectorPart, float scalarPart);
Quaternion(const Quaternion &obj);
Quaternion();
static Quaternion Add(Quaternion quaternion1, Quaternion quaternion2);
static void Add(Quaternion quaternion1, Quaternion quaternion2, out Quaternion result);
static Quaternion Concatenate(Quaternion quaternion1, Quaternion quaternion2);
static void Concatenate(Quaternion quaternion1, Quaternion quaternion2, out Quaternion result);
void Conjugate();
static Quaternion Conjugate(Quaternion value);
static void Conjugate(Quaternion value, out Quaternion result);
static Quaternion CreateFromAxisAngle(Vector3 axis, float angle);
static void CreateFromAxisAngle(Vector3 axis, float angle, out Quaternion result);
static Quaternion CreateFromRotationMatrix(Matrix matrix);
static void CreateFromRotationMatrix(Matrix matrix, out Quaternion result);
static Quaternion CreateFromYawPitchRoll(float yaw, float pitch, float roll);
static void CreateFromYawPitchRoll(float yaw, float pitch, float roll, out Quaternion result);
static Quaternion Divide(Quaternion quaternion1, Quaternion quaternion2);
static void Divide(Quaternion quaternion1, Quaternion quaternion2, out Quaternion result);
static float Dot(Quaternion quaternion1, Quaternion quaternion2);
static void Dot(Quaternion quaternion1, Quaternion quaternion2, out float result);
bool Equals(Quaternion obj);
static Quaternion Inverse(Quaternion quaternion);
static void Inverse(Quaternion quaternion, out Quaternion result);
float Length();
float LengthSquared();
static Quaternion Lerp(Quaternion quaternion1, Quaternion quaternion2, float amount);
static void Lerp(Quaternion quaternion1, Quaternion quaternion2, float amount, out Quaternion result);
static Quaternion Multiply(Quaternion quaternion1, Quaternion quaternion2);
static void Multiply(Quaternion quaternion1, Quaternion quaternion2, out Quaternion result);
static Quaternion Multiply(Quaternion quaternion, float scaleFactor);
static void Multiply(Quaternion quaternion, float scaleFactor, out Quaternion result);
static Quaternion Negate(Quaternion quaternion);
static void Negate(Quaternion quaternion, out Quaternion result);
void Normalize();
static Quaternion Slerp(Quaternion quaternion1, Quaternion quaternion2, float amount);
static void Slerp(Quaternion quaternion1, Quaternion quaternion2, float amount, out Quaternion result);
static Quaternion Subtract(Quaternion quaternion1, Quaternion quaternion2);
static void Subtract(Quaternion quaternion1, Quaternion quaternion2, out Quaternion result);
const Quaternion operator+(const Quaternion other);
const Quaternion operator/(const Quaternion other);
bool operator==(const Quaternion other);
bool operator!=(const Quaternion other);
const Quaternion operator*(const Quaternion other);
const Quaternion operator*(const float scaleFactor);
const Quaternion operator-(const Quaternion other);
const Quaternion operator-();
Quaternion operator=(const Quaternion other);
} ALIGNED;
}
#endif //_XFX_QUATERNION_

47
include/Ray.h Normal file
View File

@ -0,0 +1,47 @@
/********************************************************
* Ray.h *
* *
* XFX Ray definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_RAY_
#define _XFX_RAY_
#include <System/Types.h>
namespace XFX
{
struct BoundingBox;
struct BoundingSphere;
struct Plane;
struct Vector3;
/// <summary>
/// Defines a ray.
/// </summary>
class Ray
{
public:
Vector3 Direction;
Vector3 Position;
Ray(Vector3 direction, Vector3 position);
Ray(const Ray &obj);
Ray();
bool Equals(Ray obj);
int GetHashCode();
float Intersects(BoundingBox boundingbox);
void Intersects(BoundingBox boundingbox, out float result);
float Intersects(BoundingSphere sphere);
void Intersects(BoundingSphere sphere, out float result);
float Intersects(Plane plane);
void Intersects(Plane plane, out float result);
bool operator==(const Ray other);
bool operator!=(const Ray other);
Ray operator=(const Ray other);
};
}
#endif //_RAY_

50
include/Rectangle.h Normal file
View File

@ -0,0 +1,50 @@
/********************************************************
* Rectangle.h *
* *
* XFX Rectangle definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_RECTANGLE_
#define _XFX_RECTANGLE_
#include <System/Types.h>
namespace XFX
{
struct Point;
struct Rectangle
{
public:
int Bottom();
int Left();
int Right();
int Top();
int X, Y;
static const Rectangle Empty;
int Width, Height;
Rectangle(int x,int y,int width,int height);
Rectangle(const Rectangle &obj);
Rectangle();
int Contains(int x, int y);
int Contains(Point pt);
void Contains(Point pt, out int result);
int Contains(Rectangle other);
void Contains(Rectangle other, out int result);
int Equals(const Rectangle obj);
int GetHashCode();
void Inflate(int horizontalAmount, int verticalAmount);
int Intersects(Rectangle other);
void Intersects(Rectangle other, out int result);
void Offset(int x, int y);
void Offset(Point pt);
int operator==(const Rectangle other);
int operator!=(const Rectangle other);
Rectangle &operator=(const Rectangle other);
};
}
#endif //_RECTANGLE_

13
include/Storage.h Normal file
View File

@ -0,0 +1,13 @@
/********************************************************
* Storage.h *
* *
* XFX::Storage namespace include file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef STORAGE_H
#define STORAGE_H
#include "StorageContainer.h"
#include "StorageDevice.h"
#endif //STORAGE_H

View File

@ -0,0 +1,47 @@
/********************************************************
* StorageContainer.h *
* *
* XFX StorageContainer definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_STORAGE_STORAGECONTAINER_
#define _XFX_STORAGE_STORAGECONTAINER_
#include <System/Delegates.h>
#include <System/IO/DirectoryInfo.h>
#include <../Enums.h>
namespace XFX
{
namespace Storage
{
class StorageDevice;
/// <summary>
/// Represents a logical collection of storage files.
/// </summary>
class StorageContainer : public IDisposable
{
private:
bool isDisposed;
DirectoryInfo containerFolder;
StorageDevice device;
EventHandler Disposing;
PlayerIndex_t playerIndex;
char* titleName;
~StorageContainer();
public:
bool IsDisposed();
char* Path();
StorageDevice StorageDevice_();
static char* TitleLocation();
char* TitleName();
void Delete();
void Dispose();
};
}
}
#endif //_XFX_STORAGE_STORAGECONTAINER_

View File

@ -0,0 +1,40 @@
/********************************************************
* StorageDevice.h *
* *
* XFX StorageDevice definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_STORAGE_STORAGEDEVICE_
#define _XFX_STORAGE_STORAGEDEVICE_
#include <System/Types.h>
#include "../Enums.h"
namespace XFX
{
namespace Storage
{
class StorageContainer;
/// <summary>
/// Represents a storage device for user data, such as a memory unit or hard drive.
/// </summary>
class StorageDevice
{
private:
PlayerIndex_t _playerIndex;
bool _playerSpecified;
StorageDevice(PlayerIndex_t playerIndex, bool playerSpecified);
public:
long long FreeSpace();
bool IsConnected();
long long TotalSpace();
StorageContainer OpenContainer(char* titleName);
}
}
}
#endif //_XFX_STORAGE_STORAGEDEVICE_

View File

@ -0,0 +1,29 @@
/********************************************************
* StorageDeviceNotConnectedException.h *
* *
* XFX StorageDeviceNotConnectedException definition *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _XFX_STORAGE_STORAGEDEVICENOTCONNECTEDEXCEPTION_
#define _XFX_STORAGE_STORAGEDEVICENOTCONNECTEDEXCEPTION_
#include <System/Exception.h>
namespace XFX
{
namespace Storage
{
/// <summary>
/// The exception that is thrown when the requested StorageDevice is not connected
/// </summary>
class StorageDeviceNotConnectedException : ExternalException
{
public:
StorageDeviceNotConnectedException();
StorageDeviceNotConnectedException(char* message);
StorageDeviceNotConnectedException(char* message, Exception innerException);
};
}
}
#endif //_XFX_STORAGE_STORAGEDEVICENOTCONNECTEDEXCEPTION_

30
include/System.h Normal file
View File

@ -0,0 +1,30 @@
/********************************************************
* System.h *
* *
* XFX System namespace include file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _SYSTEM_
#define _SYSTEM_
// Type definitions
#include "System/Types.h"
//
//Interfaces
//
#include "System/Interfaces.h"
//
//Classes
//
#include "System/Array.h"
#include "System/BitConverter.h"
#include "System/Buffer.h"
#include "System/DateTime.h"
#include "System/Exception.h" //Class-based Exception handling
#include "System/Math.h"
#include "System/Threading/Thread.h" //Experimental! Use at own risk!
#include "System/TimeSpan.h"
#include "System/TimeZone.h"
#endif //_SYSTEM_

27
include/System/Array.h Normal file
View File

@ -0,0 +1,27 @@
/********************************************************
* Array.h *
* *
* XFX Array class definition file *
* Contains array helper methods *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _SYSTEM_ARRAY_
#define _SYSTEM_ARRAY_
namespace System
{
class Array
{
public:
template <class T>
static void Clear(T array[], int index, int length);
template <class T>
static void Copy(T sourceArray[], int sourceIndex, T destinationArray[], int destinationIndex, int length);
template <class T>
static int IndexOf(T array[], T value, int startIndex, int count);
template <class T>
static int Length(T array[]);
};
}
#endif //_SYSTEM_ARRAY_

View File

@ -0,0 +1,47 @@
/********************************************************
* BitConverter.h *
* *
* XFX BitConverter definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _SYSTEM_BITCONVERTER_
#define _SYSTEM_BITCONVERTER_
#include "Types.h"
namespace System
{
/// <summary>
/// Converts base data types to an array of bytes, and an array of bytes to base data types.
/// </summary>
class BitConverter
{
private:
static byte *GetBytes(byte *ptr, int count);
static bool AmIBigOrLittleEndian();
static bool SwappedWordsInDouble();
BitConverter(); //! private constructor to prevent instantiation
public:
static const bool IsLittleEndian;
static byte *GetBytes(bool value);
static byte *GetBytes(char value);
static byte *GetBytes(double value);
static byte *GetBytes(short value);
static byte *GetBytes(int value);
static byte *GetBytes(Int64 value);
static byte *GetBytes(float value);
static byte *GetBytes(UInt16 value);
static byte *GetBytes(UInt32 value);
static byte *GetBytes(UInt64 value);
static bool ToBoolean(byte value[], int startIndex);
static char ToChar(byte value[], int startIndex);
static double ToDouble(byte value[], int startIndex);
static Int16 ToInt16(byte value[], int startIndex);
static Int32 ToInt32(byte value[], int startIndex);
};
}
#endif //_SYSTEM_BITCONVERTER_

31
include/System/Buffer.h Normal file
View File

@ -0,0 +1,31 @@
/********************************************************
* Buffer.h *
* *
* XFX Buffer class definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _SYSTEM_BUFFER_
#define _SYSTEM_BUFFER_
#include "Types.h"
namespace System
{
/// <summary>
/// Manipulates arrays of primitive types.
/// </summary>
class Buffer
{
public:
template <class T>
static void BlockCopy(T src[], int srcOffset, T dst[], int dstOffset, int count);
template <class T>
static int ByteLength(T array[]);
template <class T>
static byte GetByte(T array[], int index);
template <class T>
static void SetByte(T array[], int index, byte value);
};
}
#endif //_SYSTEM_BUFFER_

View File

@ -0,0 +1,34 @@
#ifndef _SYSTEM_COLLECTIONS_GENERIC_COMPARER_
#define _SYSTEM_COLLECTIONS_GENERIC_COMPARER_
#include <System/Types.h>
#include "Interfaces.h"
namespace System
{
namespace Collections
{
namespace Generic
{
/// <summary>
/// Provides a base class for implementations of the System.Collections.Generic.IComparer<T1> generic interface.
/// </summary>
class Comparer : public IComparer<T>
{
private:
static Comparer<T> defaultComparer;
static Comparer<T> CreateComparer();
protected:
Comparer();
public:
static Comparer<T> Default();
virtual int Compare(T x, T y)=0;
};
}
}
}
#endif //_SYSTEM_COLLECTIONS_GENERIC_COMPARER_

View File

@ -0,0 +1,123 @@
/********************************************************
* Dictionary.h *
* *
* XFX Generic Dictionary class definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _SYSTEM_COLLECTIONS_GENERIC_DICTIONARY_
#define _SYSTEM_COLLECTIONS_GENERIC_DICTIONARY_
#include "Interfaces.h"
#include "KeyValuePair.h"
namespace System
{
namespace Collections
{
namespace Generic
{
/// <summary>
/// Represents a collection of keys and values.
/// </summary>
template <class TKey, class TValue>
class Dictionary : public IDictionary<TKey, TValue>, public ICollection<KeyValuePair<TKey, TValue> >
{
private:
template <class UKey, class UValue>
struct Entry
{
int hashCode;
int next;
UKey key;
UValue value;
};
private:
int buckets[];
static const char* ComparerName;
IEqualityComparer<TKey> comparer;
int count;
Entry<TKey, TValue> entries[];
int freeCount;
int freeList;
static const char* HashSizeName;
static const char* KeyValuePairsName;
int version;
static const char* VersionName;
void Add(KeyValuePair<TKey, TValue> keyValuePair);
bool Contains(KeyValuePair<TKey, TValue> keyValuePair);
void CopyTo(KeyValuePair<TKey, TValue> array[], int index);
int FindEntry(TKey key);
bool Remove(KeyValuePair<TKey, TValue> keyValuePair);
void Initialize(int capacity);
void Insert(TKey key, TValue value, bool add);
void Resize();
public:
/// <summary>
/// Represents the collection of keys in a Dictionary<,>.
/// </summary>
template <class UKey, class UValue>
class KeyCollection : public ICollection<UKey>, public IEnumerable<UKey>
{
private:
Dictionary<UKey, UValue> *_dictionary;
public:
int Count();
KeyCollection(Dictionary<UKey, UValue> dictionary);
void Add(UKey item);
void Clear();
bool Contains(UKey item);
void CopyTo(UKey array[], int index);
bool Remove(UKey item);
};
/// <summary>
/// Represents the collection of values in a Dictionary<,>.
/// </summary>
template <class UKey, class UValue>
class ValueCollection : public ICollection<UValue>, public IEnumerable<UValue>
{
private:
Dictionary<UKey, UValue> *_dictionary;
public:
int Count();
ValueCollection(Dictionary<TKey, TValue> dictionary);
void Add(UValue item);
void Clear();
bool Contains(UValue item);
void CopyTo(UValue array[], int index);
bool Remove(UValue item);
};
public:
IEqualityComparer<TKey> Comparer();
int Count();
KeyCollection<TKey, TValue> Keys();
ValueCollection<TKey, TValue> Values();
TValue operator[](TKey key);
Dictionary();
Dictionary(IDictionary<TKey, TValue> dictionary);
Dictionary(int capacity);
~Dictionary();
void Add(TKey key, TValue value);
void Clear();
bool ContainsKey(TKey key);
bool ContainsValue(TValue value);
bool Remove(TKey key);
bool TryGetValue(TKey key, out TValue value);
};
}
}
}
#endif //_SYSTEM_COLLECTIONS_GENERIC_DICTIONARY_

View File

@ -0,0 +1,28 @@
#ifndef _SYSTEM_COLLECTIONS_GENERIC_EQUALITYCOMPARER_
#define _SYSTEM_COLLECTIONS_GENERIC_EQUALITYCOMPARER_
namespace System
{
namespace Collections
{
namespace Generic
{
template <class T>
class EqualityComparer : IEqualityComparer<T>
{
private:
static EqualityComparer<T> defaultComparer;
public:
static EqualityComparer<T> Default();
bool Equals(T x, T y);
int GetHashCode(T obj);
};
}
}
}
#endif //_SYSTEM_COLLECTIONS_GENERIC_EQUALITYCOMPARER_

View File

@ -0,0 +1,111 @@
/********************************************************
* Interfaces.h *
* *
* XFX Generic Interfaces definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _SYSTEM_COLLECTIONS_GENERIC_INTERFACES_
#define _SYSTEM_COLLECTIONS_GENERIC_INTERFACES_
#include <System/Types.h>
namespace System
{
namespace Collections
{
namespace Generic
{
/// <summary>
/// Defines methods to manipulate generic collections.
/// </summary>
template <class T>
interface ICollection
{
public:
virtual void Add(T item)=0;
virtual void Clear()=0;
virtual bool Contains(T item)=0;
virtual void CopyTo(T array[], int arrayIndex)=0;
virtual bool Remove(T item)=0;
virtual int Count()=0;
virtual bool IsReadOnly();
};
/// <summary>
/// Defines a method that a type implements to compare two objects.
/// </summary>
template <class T>
interface IComparer
{
public:
virtual int Compare(T x, T y)=0;
};
/// <summary>
/// Represents a generic collection of key/value pairs.
/// </summary>
template <class TKey, class TValue>
interface IDictionary
{
public:
virtual void Add(TKey key, TValue value)=0;
virtual bool ContainsKey(TKey key)=0;
virtual bool Remove(TKey key)=0;
virtual bool TryGetValue(TKey key, out TValue value)=0;
virtual ICollection<TKey> Keys()=0;
virtual ICollection<TValue> Values()=0;
};
/// <summary>
/// Supports a simple iteration over a generic collection.
/// </summary>
template <class T>
interface IEnumerator
{
public:
virtual T Current()=0;
};
/// <summary>
/// Exposes the enumerator, which supports a simple iteration over a collection of a specified type.
/// </summary>
template <class T>
interface IEnumerable
{
public:
virtual IEnumerator<T> GetEnumerator()=0;
};
/// <summary>
/// Defines methods to support the comparison of objects for equality.
/// </summary>
template <class T>
interface IEqualityComparer
{
public:
virtual bool Equals(T x, T y);
virtual int GetHashCode(T obj);
};
/// <summary>
/// Represents a collection of objects that can be individually accessed by index.
/// </summary>
template <class T>
interface IList : public ICollection<T>
{
public:
virtual int IndexOf(T item)=0;
virtual void Insert(int index, T item)=0;
virtual void RemoveAt(int index)=0;
virtual T operator[](int index)=0;
virtual ~IList();
};
}
}
}
#endif //_SYSTEM_COLLECTIONS_GENERIC_INTERFACES_

View File

@ -0,0 +1,33 @@
/********************************************************
* KeyNotFoundException.h *
* *
* XFX KeyNotFoundException class definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _SYSTEM_COLLECTIONS_GENERIC_KEYNOTFOUNDEXCEPTION_
#define _SYSTEM_COLLECTIONS_GENERIC_KEYNOTFOUNDEXCEPTION_
#include <System/Exception.h>
namespace System
{
namespace Collections
{
namespace Generic
{
/// <summary>
/// The exception that is thrown when the key specified for accessing an element in a collection does not match any
/// key in the collection.
/// </summary>
class KeyNotFoundException : public SystemException
{
public:
KeyNotFoundException();
KeyNotFoundException(char* message);
KeyNotFoundException(char* message, Exception innerException);
};
}
}
}
#endif //_SYSTEM_COLLECTIONS_GENERIC_KEYNOTFOUNDEXCEPTION_

View File

@ -0,0 +1,37 @@
/********************************************************
* KeyValuePair.h *
* *
* XFX KeyValuePair definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _SYSTEM_COLLECTIONS_GENERIC_KEYVALUEPAIR_
#define _SYSTEM_COLLECTIONS_GENERIC_KEYVALUEPAIR_
namespace System
{
namespace Collections
{
namespace Generic
{
/// <summary>
/// Defines a key/value pair that can be set or retrieved.
/// </summary>
template <class TKey, class TValue>
struct KeyValuePair
{
private:
TKey _key;
TValue _value;
public:
TKey Key();
TValue Value();
KeyValuePair(TKey key, TValue value);
KeyValuePair(const KeyValuePair &obj); //! Copy constructor
};
}
}
}
#endif //_SYSTEM_COLLECTIONS_GENERIC_KEYVALUEPAIR_

View File

@ -0,0 +1,72 @@
/********************************************************
* List.h *
* *
* XFX Generic List definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _SYSTEM_COLLECTIONS_GENERIC_LIST_
#define _SYSTEM_COLLECTIONS_GENERIC_LIST_
#include <System/Types.h>
#include "Interfaces.h"
namespace System
{
namespace Collections
{
namespace Generic
{
/// <summary>
/// Represents a strongly typed list of objects that can be accessed by index. Provides methods to search, sort, and manipulate lists.
/// </summary>
template <class T>
class List : public IList<T>
{
private:
static const int _defaultCapacity = 4;
static T _emptyArray[];
T _items[];
int _size;
int _version;
void EnsureCapacity(int min);
public:
int Count();
int Capacity(); // get
void Capacity(int newCap); // set
List();
List(int capacity);
~List();
void Add(T item); //Adds an element to the end of the list
int BinarySearch(T item);
int BinarySearch(T item, IComparer<T> comparer);
int BinarySearch(int index, int count, T item, IComparer<T> comparer);
void Clear(); //Removes all elements from the list
bool Contains(T item);
void CopyTo(T array[], int arrayIndex);
int First(); //Goes to the first element in the list
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);
void Insert(int index, T item);
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 Change(const T newElem); //changes the current element
bool Remove(T item); //Removes current element
void RemoveAt(int index);
void RemoveRange(int index, int count);
void Reverse();
void Reverse(int index, int count);
T *ToArray();
void TrimExcess();
T operator[](int index);
};
}
}
}
#endif //_SYSTEM_COLLECTIONS_GENERIC_LIST_

View File

@ -0,0 +1,24 @@
#ifndef _ILIST_
#define _ILIST_
#include "../System.h"
using namespace System;
namespace System
{
namespace Collections
{
interface IList : virtual ICollection, virtual IEnumerable
{
public:
virtual int IsFixedSize();
virtual int IsReadOnly();
virtual void Clear();
virtual void RemoveAt();
};
}
}
#endif //_ILIST_

View File

@ -0,0 +1,12 @@
#ifndef _SYSTEM_COLLECTIONS_INTERFACES_
#define _SYSTEM_COLLECTIONS_INTERFACES_
namespace System
{
namespace Collections
{
}
}
#endif //_SYSTEM_COLLECTIONS_INTERFACES_

Some files were not shown because too many files have changed in this diff Show More