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

added README

Updated XFX::Input namespace classes
Updated XFX::Net namespace classes
Updated System::IO namespace classes
Updated .gitignore to ignore buildlog.htm variants
This commit is contained in:
Tom Lint 2013-05-30 13:55:10 +02:00
parent 9b2110649e
commit 0fa3659fb4
16 changed files with 130 additions and 105 deletions

2
.gitignore vendored
View File

@ -46,7 +46,7 @@ local.properties
[Rr]elease/ [Rr]elease/
*_i.c *_i.c
*_p.c *_p.c
[Bb]uildlog.htm [Bb]uild[Ll]og.htm
*.ilk *.ilk
*.meta *.meta
*.o *.o

11
README.md Normal file
View File

@ -0,0 +1,11 @@
# XFXFramework
## C++ implementation of XNA For XBOX
XFX, or [XNA](http://en.wikipedia.org/wiki/Microsoft_XNA) for [XBOX](http://en.wikipedia.org/wiki/Xbox_(console)) is an implementation of [XNA](http://en.wikipedia.org/wiki/Microsoft_XNA), written in C++ for Microsofts [XBOX](http://en.wikipedia.org/wiki/Xbox_(console)) console.
It's written on top of [OpenXDK](http://sourceforge.net/projects/openxdk/), the open source, free, legal XBOX Development Kit.
XFX is an attempt to bring development for the original [XBOX](http://en.wikipedia.org/wiki/Xbox_(console)) console to the masses by wrapping all low-level code in the familiar XNA classes.
Being written in C++ allows XFX to be lightweight and as close to the hardware as possible.
Compiling XFX requires at least OpenXDK version 0.7

View File

@ -2,6 +2,9 @@
Microsoft Visual Studio Solution File, Format Version 11.00 Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010 # Visual Studio 2010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{888801DD-E68C-4BDE-8B21-890076EF7A59}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{888801DD-E68C-4BDE-8B21-890076EF7A59}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libXFX", "src\libXFX\libXFX.vcxproj", "{379FFCFD-88FA-46D6-A686-CAE8F58652FC}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libXFX", "src\libXFX\libXFX.vcxproj", "{379FFCFD-88FA-46D6-A686-CAE8F58652FC}"
EndProject EndProject

View File

@ -27,8 +27,8 @@ namespace XFX
ButtonState_t XButton2; ButtonState_t XButton2;
int Y; int Y;
bool operator!=(const MouseState other); bool operator!=(const MouseState& other) const;
bool operator==(const MouseState other); bool operator==(const MouseState& other) const;
}; };
// Allows retrieval of position and button clicks from a mouse input device. // Allows retrieval of position and button clicks from a mouse input device.

View File

@ -16,12 +16,12 @@ namespace XFX
namespace Net namespace Net
{ {
// Provides common functionality for efficiently reading incoming network packets. // Provides common functionality for efficiently reading incoming network packets.
class PacketReader : public BinaryReader, public virtual Object class PacketReader : public BinaryReader, public Object
{ {
public: public:
int Length(); int Length();
int Position(); int getPosition();
void Position(int newValue); void setPosition(int newValue);
PacketReader(); PacketReader();
PacketReader(int capacity); PacketReader(int capacity);
@ -30,7 +30,7 @@ namespace XFX
Quaternion ReadQuaternion(); Quaternion ReadQuaternion();
Vector2 ReadVector2(); Vector2 ReadVector2();
Vector3 ReadVector3(); Vector3 ReadVector3();
Vector4 ReadVEctor4(); Vector4 ReadVector4();
}; };
} }
} }

View File

@ -9,7 +9,7 @@ namespace System
namespace IO namespace IO
{ {
// Creates a stream whose backing store is memory. // Creates a stream whose backing store is memory.
class MemoryStream : public Stream, public virtual Object class MemoryStream : public Stream
{ {
private: private:
byte* _buffer; byte* _buffer;
@ -48,6 +48,7 @@ namespace System
void Flush(); void Flush();
virtual byte* GetBuffer(); virtual byte* GetBuffer();
int GetType() const;
int Read(byte buffer[], int offset, int count); int Read(byte buffer[], int offset, int count);
int ReadByte(); int ReadByte();
long long Seek(long long offset, SeekOrigin_t loc); long long Seek(long long offset, SeekOrigin_t loc);

View File

@ -24,7 +24,7 @@ namespace System
char CoreNewLine[]; char CoreNewLine[];
TextWriter(); TextWriter();
TextWriter(const IFormatProvider* provider); TextWriter(IFormatProvider * const provider);
TextWriter(const TextWriter &obj); TextWriter(const TextWriter &obj);
virtual void Dispose(bool disposing); virtual void Dispose(bool disposing);

View File

@ -121,9 +121,9 @@ namespace XFX
{ {
} }
bool GamePadState::Equals(const Object* obj) const bool GamePadState::Equals(Object const * const obj) const
{ {
return is(obj, this) ? this->Equals(*(GamePadState*)obj) : false; return is(obj, this) ? *this == *(GamePadState *)obj : false;
} }
bool GamePadState::Equals(const GamePadState obj) const bool GamePadState::Equals(const GamePadState obj) const
@ -138,6 +138,7 @@ namespace XFX
int GamePadState::GetType() const int GamePadState::GetType() const
{ {
// TODO: implement
} }
bool GamePadState::IsButtonDown(const Buttons_t button) const bool GamePadState::IsButtonDown(const Buttons_t button) const
@ -203,7 +204,7 @@ namespace XFX
const char* GamePadState::ToString() const const char* GamePadState::ToString() const
{ {
return String::Format("{{IsConnected:%b}}", IsConnected); return String::Format("{IsConnected:%b}", IsConnected);
} }
bool GamePadState::operator ==(const GamePadState& right) const bool GamePadState::operator ==(const GamePadState& right) const
@ -248,9 +249,9 @@ namespace XFX
{ {
} }
bool GamePadButtons::Equals(const Object* obj) const bool GamePadButtons::Equals(Object const * const obj) const
{ {
return is(obj, this) ? this->Equals(*(GamePadButtons*)obj) : false; return is(obj, this) ? *this == *(GamePadButtons *)obj : false;
} }
bool GamePadButtons::Equals(const GamePadButtons other) const bool GamePadButtons::Equals(const GamePadButtons other) const
@ -266,6 +267,7 @@ namespace XFX
int GamePadButtons::GetType() const int GamePadButtons::GetType() const
{ {
// TODO: implement
} }
const char* GamePadButtons::ToString() const const char* GamePadButtons::ToString() const
@ -316,7 +318,7 @@ namespace XFX
str = "None"; str = "None";
} }
return String::Format("{{Buttons:%s}}", str.ToString()); return String::Format("{Buttons:%s}", str.ToString());
} }
bool GamePadButtons::operator!=(const GamePadButtons& other) const bool GamePadButtons::operator!=(const GamePadButtons& other) const
@ -350,9 +352,9 @@ namespace XFX
{ {
} }
bool GamePadDPad::Equals(const Object* obj) const bool GamePadDPad::Equals(Object const * const obj) const
{ {
return is(obj, this) ? this->Equals(*(GamePadDPad*)obj) : false; return is(obj, this) ? *this == *(GamePadDPad *)obj : false;
} }
bool GamePadDPad::Equals(const GamePadDPad obj) const bool GamePadDPad::Equals(const GamePadDPad obj) const
@ -367,6 +369,7 @@ namespace XFX
int GamePadDPad::GetType() const int GamePadDPad::GetType() const
{ {
// TODO: implement
} }
const char* GamePadDPad::ToString() const const char* GamePadDPad::ToString() const
@ -393,7 +396,7 @@ namespace XFX
str = "None"; str = "None";
} }
return String::Format("{{DPad:%s}}", str.ToString()); return String::Format("{DPad:%s}", str.ToString());
} }
bool GamePadDPad::operator !=(const GamePadDPad& right) const bool GamePadDPad::operator !=(const GamePadDPad& right) const
@ -423,9 +426,9 @@ namespace XFX
{ {
} }
bool GamePadThumbSticks::Equals(const Object* obj) const bool GamePadThumbSticks::Equals(Object const * const obj) const
{ {
return is(obj, this) ? this->Equals(*(GamePadThumbSticks*)obj) : false; return is(obj, this) ? *this == *(GamePadThumbSticks *)obj : false;
} }
bool GamePadThumbSticks::Equals(const GamePadThumbSticks obj) const bool GamePadThumbSticks::Equals(const GamePadThumbSticks obj) const
@ -440,11 +443,12 @@ namespace XFX
int GamePadThumbSticks::GetType() const int GamePadThumbSticks::GetType() const
{ {
// TODO: implement
} }
const char* GamePadThumbSticks::ToString() const const char* GamePadThumbSticks::ToString() const
{ {
return String::Format("{{Left:%s Right%s}}", Left.ToString(), Right.ToString()); return String::Format("{Left:%s Right%s}", Left.ToString(), Right.ToString());
} }
bool GamePadThumbSticks::operator!=(const GamePadThumbSticks& other) const bool GamePadThumbSticks::operator!=(const GamePadThumbSticks& other) const
@ -472,9 +476,9 @@ namespace XFX
{ {
} }
bool GamePadTriggers::Equals(const Object* obj) const bool GamePadTriggers::Equals(Object const * const obj) const
{ {
return is(obj, this) ? this->Equals(*(GamePadTriggers*)obj) : false; return is(obj, this) ? *this == *(GamePadTriggers *)obj : false;
} }
bool GamePadTriggers::Equals(const GamePadTriggers obj) const bool GamePadTriggers::Equals(const GamePadTriggers obj) const
@ -489,11 +493,12 @@ namespace XFX
int GamePadTriggers::GetType() const int GamePadTriggers::GetType() const
{ {
// TODO: implement
} }
const char* GamePadTriggers::ToString() const const char* GamePadTriggers::ToString() const
{ {
return String::Format("{{Left:%f Right:%f}}", Left, Right); return String::Format("{Left:%f Right:%f}", Left, Right);
} }
bool GamePadTriggers::operator!=(const GamePadTriggers& other) const bool GamePadTriggers::operator!=(const GamePadTriggers& other) const

View File

@ -59,6 +59,11 @@ namespace XFX
IAsyncResult* Guide::BeginShowMessageBox(const PlayerIndex_t player, String& title, String& text, IEnumerable<String>* buttons, const int focusButton, const MessageBoxIcon_t icon, AsyncCallback callback, Object* state) IAsyncResult* Guide::BeginShowMessageBox(const PlayerIndex_t player, String& title, String& text, IEnumerable<String>* buttons, const int focusButton, const MessageBoxIcon_t icon, AsyncCallback callback, Object* state)
{ {
if (String::IsNullOrEmpty(title))
title = String::Empty;
sassert(buttons != NULL, String::Format("buttons: %s", FrameworkResources::ArgumentNull_Generic));
// just return null to stop warning until this thing's coded // just return null to stop warning until this thing's coded
return null; return null;
} }
@ -103,7 +108,7 @@ namespace XFX
{ {
StorageDeviceAsyncResult* result = (StorageDeviceAsyncResult*)asyncResult; StorageDeviceAsyncResult* result = (StorageDeviceAsyncResult*)asyncResult;
sassert(result, String::Format("result; %s", FrameworkResources::ArgumentNull_Generic)); sassert(result, String::Format("asyncResult; %s", FrameworkResources::ArgumentNull_Generic));
return StorageDevice(0, (PlayerIndex_t)result->playerIndex); return StorageDevice(0, (PlayerIndex_t)result->playerIndex);
} }

View File

@ -1,4 +1,4 @@
// Copyright (C) 2010-2012, Halofreak_1990 // Copyright (C) 2010-2012, XFX Team
// All rights reserved. // All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
@ -41,17 +41,17 @@ namespace XFX
{ {
XKEYBOARD_STROKE Stroke; XKEYBOARD_STROKE Stroke;
//It's a waste of memory to create a new KeyboardState each time the input states are updated. // It's a waste of memory to create a new KeyboardState each time the input states are updated.
//Therefore, we create a static one and update it each time an update is requested. // Therefore, we create a static one and update it each time an update is requested.
static KeyboardState result; static KeyboardState result;
//Initializes the KeyboardState class // Initializes the KeyboardState class
KeyboardState::KeyboardState() KeyboardState::KeyboardState()
{ {
KeyboardState(null); KeyboardState(null);
} }
//Initializes the KeyboardState class with the specified keys pressed // Initializes the KeyboardState class with the specified keys pressed
KeyboardState::KeyboardState(Keys_t keys[]) KeyboardState::KeyboardState(Keys_t keys[])
{ {
if (keys == null) if (keys == null)
@ -70,7 +70,7 @@ namespace XFX
return (Keys_t*)pressedKeys; return (Keys_t*)pressedKeys;
} }
//Returns whether the specified key is currently pressed // Returns whether the specified key is currently pressed
bool KeyboardState::IsKeyDown(Keys_t key) bool KeyboardState::IsKeyDown(Keys_t key)
{ {
if(XInputGetKeystroke(&Stroke) == 0) if(XInputGetKeystroke(&Stroke) == 0)
@ -85,7 +85,7 @@ namespace XFX
return -1; return -1;
} }
//Returns whether the specified key is NOT pressed // Returns whether the specified key is NOT pressed
bool KeyboardState::IsKeyUp(Keys_t key) bool KeyboardState::IsKeyUp(Keys_t key)
{ {
if(XInputGetKeystroke(&Stroke) == 0) if(XInputGetKeystroke(&Stroke) == 0)
@ -96,11 +96,11 @@ namespace XFX
} }
return false; return false;
} }
//The keyboard was not connected...bail out. // The keyboard was not connected...bail out.
return -1; return -1;
} }
//Gets the state of the keyboard // Gets the state of the keyboard
KeyboardState Keyboard::GetState() KeyboardState Keyboard::GetState()
{ {
return result; return result;

View File

@ -44,14 +44,14 @@ namespace XFX
static MouseState result; static MouseState result;
/* MouseState Operators */ /* MouseState Operators */
bool MouseState::operator!=(const MouseState other) bool MouseState::operator!=(const MouseState& other) const
{ {
return !((LeftButton == other.LeftButton) && (MiddleButton == other.MiddleButton) && return !((LeftButton == other.LeftButton) && (MiddleButton == other.MiddleButton) &&
(RightButton == other.RightButton) && (X == other.X) && (XButton1 == other.XButton1) && (RightButton == other.RightButton) && (X == other.X) && (XButton1 == other.XButton1) &&
(XButton2 == other.XButton2) && (Y == other.Y)); (XButton2 == other.XButton2) && (Y == other.Y));
} }
bool MouseState::operator==(const MouseState other) bool MouseState::operator==(const MouseState& other) const
{ {
return ((LeftButton == other.LeftButton) && (MiddleButton == other.MiddleButton) && return ((LeftButton == other.LeftButton) && (MiddleButton == other.MiddleButton) &&
(RightButton == other.RightButton) && (X == other.X) && (XButton1 == other.XButton1) && (RightButton == other.RightButton) && (X == other.X) && (XButton1 == other.XButton1) &&
@ -61,10 +61,10 @@ namespace XFX
MouseState Mouse::GetState() MouseState Mouse::GetState()
{ {
result.X +=XMOUSE_current.x; result.X += XMOUSE_current.x;
result.Y +=XMOUSE_current.y; result.Y += XMOUSE_current.y;
XMOUSE_current.x=0; XMOUSE_current.x = 0;
XMOUSE_current.y=0; XMOUSE_current.y = 0;
if((XMOUSE_current.buttons & XMOUSE_BUTTON_1)) if((XMOUSE_current.buttons & XMOUSE_BUTTON_1))
result.LeftButton = ButtonState::Pressed; result.LeftButton = ButtonState::Pressed;

View File

@ -25,6 +25,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE. // POSSIBILITY OF SUCH DAMAGE.
#include <System/IO/MemoryStream.h>
#include <Net/PacketReader.h> #include <Net/PacketReader.h>
#include <Matrix.h> #include <Matrix.h>
#include <Quaternion.h> #include <Quaternion.h>
@ -41,23 +42,23 @@ namespace XFX
return (int)BaseStream()->Length(); return (int)BaseStream()->Length();
} }
int PacketReader::Position() int PacketReader::getPosition()
{ {
return (int)BaseStream()->Position; return (int)BaseStream()->Position;
} }
int PacketReader::Position(int newValue) void PacketReader::setPosition(int newValue)
{ {
BaseStream()->Position = newValue; BaseStream()->Position = newValue;
} }
PacketReader::PacketReader() PacketReader::PacketReader()
: BinaryReader(MemoryStream(0)) : BinaryReader(new MemoryStream(0))
{ {
} }
PacketReader::PacketReader(int capacity) PacketReader::PacketReader(int capacity)
: BinaryReader(MemoryStream(capacity)) : BinaryReader(new MemoryStream(capacity))
{ {
} }
@ -85,39 +86,39 @@ namespace XFX
Quaternion PacketReader::ReadQuaternion() Quaternion PacketReader::ReadQuaternion()
{ {
Quaternion quaternion; return Quaternion(
quaternion.X = ReadSingle(); ReadSingle(),
quaternion.Y = ReadSingle(); ReadSingle(),
quaternion.Z = ReadSingle(); ReadSingle(),
quaternion.W = ReadSingle(); ReadSingle()
return quaternion; );
} }
Vector2 PacketReader::ReadVector2() Vector2 PacketReader::ReadVector2()
{ {
Vector2 vector2; return Vector2(
vector2.X = ReadSingle(); ReadSingle(),
vector2.Y = ReadSingle(); ReadSingle()
return vector2; );
} }
Vector3 PacketReader::ReadVector3() Vector3 PacketReader::ReadVector3()
{ {
Vector3 vector3; return Vector3(
vector3.X = ReadSingle(); ReadSingle(),
vector3.Y = ReadSingle(); ReadSingle(),
vector3.Z = ReadSingle(); ReadSingle()
return vector3; );
} }
Vector4 PacketReader::ReadVector4() Vector4 PacketReader::ReadVector4()
{ {
Vector4 vector4; return Vector4(
vector4.X = ReadSingle(); ReadSingle(),
vector4.Y = ReadSingle(); ReadSingle(),
vector4.Z = ReadSingle(); ReadSingle(),
vector4.W = ReadSingle(); ReadSingle()
return vector4; );
} }
} }
} }

View File

@ -40,76 +40,76 @@ namespace XFX
{ {
int PacketWriter::Length() int PacketWriter::Length()
{ {
return (int)BaseStream.Length; return (int)BaseStream()->Length();
} }
int PacketWriter::Position() int PacketWriter::Position()
{ {
return (int)BaseStream.Position; return (int)BaseStream()->Position;
} }
void PacketWriter::Position(int newValue) void PacketWriter::Position(int newValue)
{ {
BaseStream.Position = newValue); BaseStream()->Position = newValue;
} }
PacketWriter::PacketWriter() PacketWriter::PacketWriter()
: BinaryWriter(MemoryStream(0)) : BinaryWriter(new MemoryStream(0))
{ {
} }
PacketWriter::PacketWriter(int capacity) PacketWriter::PacketWriter(int capacity)
: BinaryWriter(MemoryStream(capacity)) : BinaryWriter(new MemoryStream(capacity))
{ {
} }
void PacketWriter::Write(Matrix value) void PacketWriter::Write(Matrix value)
{ {
Write(value.M11); BinaryWriter::Write(value.M11);
Write(value.M12); BinaryWriter::Write(value.M12);
Write(value.M13); BinaryWriter::Write(value.M13);
Write(value.M14); BinaryWriter::Write(value.M14);
Write(value.M21); BinaryWriter::Write(value.M21);
Write(value.M22); BinaryWriter::Write(value.M22);
Write(value.M23); BinaryWriter::Write(value.M23);
Write(value.M24); BinaryWriter::Write(value.M24);
Write(value.M31); BinaryWriter::Write(value.M31);
Write(value.M32); BinaryWriter::Write(value.M32);
Write(value.M33); BinaryWriter::Write(value.M33);
Write(value.M34); BinaryWriter::Write(value.M34);
Write(value.M41); BinaryWriter::Write(value.M41);
Write(value.M42); BinaryWriter::Write(value.M42);
Write(value.M43); BinaryWriter::Write(value.M43);
Write(value.M44); BinaryWriter::Write(value.M44);
} }
void PacketWriter::Write(Quaternion value) void PacketWriter::Write(Quaternion value)
{ {
Write(value.X); BinaryWriter::Write(value.X);
Write(value.Y); BinaryWriter::Write(value.Y);
Write(value.Z); BinaryWriter::Write(value.Z);
Write(value.W); BinaryWriter::Write(value.W);
} }
void PacketWriter::Write(Vector2 value) void PacketWriter::Write(Vector2 value)
{ {
Write(value.X); BinaryWriter::Write(value.X);
Write(value.Y); BinaryWriter::Write(value.Y);
} }
void PacketWriter::Write(Vector3 value) void PacketWriter::Write(Vector3 value)
{ {
Write(value.X); BinaryWriter::Write(value.X);
Write(value.Y); BinaryWriter::Write(value.Y);
Write(value.Z); BinaryWriter::Write(value.Z);
} }
void PacketWriter::Write(Vector4 value) void PacketWriter::Write(Vector4 value)
{ {
Write(value.X); BinaryWriter::Write(value.X);
Write(value.Y); BinaryWriter::Write(value.Y);
Write(value.Z); BinaryWriter::Write(value.Z);
Write(value.W); BinaryWriter::Write(value.W);
} }
} }
} }

View File

@ -70,7 +70,7 @@ namespace XFX
{ {
} }
void VideoPlayer::Play(Video* video) void VideoPlayer::Play(Video * const video)
{ {
} }

View File

@ -81,7 +81,7 @@ namespace System
DirectoryInfo* DirectoryInfo::GetDirectories(const String& searchPattern) DirectoryInfo* DirectoryInfo::GetDirectories(const String& searchPattern)
{ {
sassert(searchPattern != null, String::Format("searchPattern; %s", FrameworkResources::ArgumentNull_Generic)); sassert(!String::IsNullOrEmpty(searchPattern), String::Format("searchPattern; %s", FrameworkResources::ArgumentNull_Generic));
List<DirectoryInfo> infos = List<DirectoryInfo>(); List<DirectoryInfo> infos = List<DirectoryInfo>();

View File

@ -34,13 +34,13 @@ namespace System
const char* TextWriter::InitialNewLine = "\r\n"; const char* TextWriter::InitialNewLine = "\r\n";
TextWriter::TextWriter() TextWriter::TextWriter()
{ {
CoreNewLine = new char[] { '\r', '\n' }; CoreNewLine = { '\r', '\n' };
InternalFormatProvider = null; InternalFormatProvider = null;
} }
TextWriter::TextWriter(IFormatProvider* provider) TextWriter::TextWriter(IFormatProvider * const provider)
{ {
CoreNewLine = new char[] { '\r', '\n' }; CoreNewLine = { '\r', '\n' };
InternalFormatProvider = provider; InternalFormatProvider = provider;
} }
@ -61,7 +61,6 @@ namespace System
{ {
Write(buffer, 0, Array::Length(buffer)); Write(buffer, 0, Array::Length(buffer));
} }
} }
} }
} }