1. What Is Slimdx
  2. Slimdx Runtime Do I Need
Slimdx
Author: Mike.Popoloski
Date: Wed Apr 1 18:04:16 2009
New Revision: 1004
Added:
trunk/source/directinput/CustomDevice.cpp
trunk/source/directinput/CustomDevice.h
trunk/source/directinput/Keyboard.cpp
trunk/source/directinput/Keyboard.h
trunk/source/directinput/Mouse.cpp
trunk/source/directinput/Mouse.h
Removed:
trunk/source/directinput/BufferedData.cpp
trunk/source/directinput/BufferedData.h
Modified:
trunk/build/SlimDX.vcproj
trunk/samples/DirectInput/Joystick/MainForm.cs
trunk/samples/DirectInput/Keyboard/Keyboard.csproj
trunk/samples/DirectInput/Keyboard/MainForm.Designer.cs
trunk/samples/DirectInput/Keyboard/MainForm.cs
trunk/samples/DirectInput/Keyboard/Program.cs
trunk/samples/DirectInput/Keyboard/Properties/Resources.Designer.cs
trunk/samples/DirectInput/Keyboard/Properties/Settings.Designer.cs
trunk/samples/DirectInput/Mouse/MainForm.Designer.cs
trunk/samples/DirectInput/Mouse/MainForm.cs
trunk/samples/DirectInput/Mouse/Mouse.csproj
trunk/samples/DirectInput/Mouse/Program.cs
trunk/samples/DirectInput/Mouse/Properties/Resources.Designer.cs
trunk/samples/DirectInput/Mouse/Properties/Settings.Designer.cs
trunk/source/directinput/Callbacks.cpp
trunk/source/directinput/Device.cpp
trunk/source/directinput/Device.h
trunk/source/directinput/DeviceInstance.h
trunk/source/directinput/DeviceObjectInstance.h
trunk/source/directinput/DirectInput.cpp
trunk/source/directinput/DirectInput.h
trunk/source/directinput/DirectInputException.cpp
trunk/source/directinput/DirectInputException.h
trunk/source/directinput/Guids.h
trunk/source/directinput/KeyboardState.h
Log:
Refactoring DirectInput Device handling.
Modified: trunk/build/SlimDX.vcproj
--- trunk/build/SlimDX.vcproj (original)
+++ trunk/build/SlimDX.vcproj Wed Apr 1 18:04:16 2009
@@ -3893,6 +3893,14 @@
>
</File>
<File
+ RelativePath='..sourcedirectinputCustomDevice.cpp'
+ >
+ </File>
+ <File
+ RelativePath='..sourcedirectinputCustomDevice.h'
+ >
+ </File>
+ <File
RelativePath='..sourcedirectinputDevice.cpp'
>
<FileConfiguration
@@ -3954,6 +3962,22 @@
RelativePath='..sourcedirectinputDevice.h'
>
</File>
+ <File
+ RelativePath='..sourcedirectinputKeyboard.cpp'
+ >
+ </File>
+ <File
+ RelativePath='..sourcedirectinputKeyboard.h'
+ >
+ </File>
+ <File
+ RelativePath='..sourcedirectinputMouse.cpp'
+ >
+ </File>
+ <File
+ RelativePath='..sourcedirectinputMouse.h'
+ >
+ </File>
</Filter>
<Filter
Name='Exceptions'
@@ -3996,16 +4020,8 @@
</File>
</Filter>
<Filter
- Name='BufferedData'
+ Name='Attributes'
>
- <File
- RelativePath='..sourcedirectinputBufferedData.cpp'
- >
- </File>
- <File
- RelativePath='..sourcedirectinputBufferedData.h'
- >
- </File>
<File
RelativePath='..sourcedirectinputDataFormatAttribute.h'
>
Modified: trunk/samples/DirectInput/Joystick/MainForm.cs
--- trunk/samples/DirectInput/Joystick/MainForm.cs (original)
+++ trunk/samples/DirectInput/Joystick/MainForm.cs Wed Apr 1 18:04:16 2009
@@ -30,7 +30,7 @@
{
public partial class MainForm : Form
{
- Device<JoystickState> joystick;
+ CustomDevice<JoystickState> joystick;
JoystickState state = new JoystickState();
int numPOVs;
@@ -47,7 +47,7 @@
// create the device
try
{
- joystick = new Device<JoystickState>(dinput,
device.InstanceGuid);
+ joystick = new CustomDevice<JoystickState>(dinput,
device.InstanceGuid);
joystick.SetCooperativeLevel(this,
CooperativeLevel.Exclusive | CooperativeLevel.Foreground);
break;
}
@@ -62,7 +62,7 @@
return;
}
- foreach (DeviceObjectInstance deviceObject in
joystick.GetDeviceObjects())
+ foreach (DeviceObjectInstance deviceObject in
joystick.GetObjects())
{
if ((deviceObject.ObjectType & ObjectDeviceType.Axis) != 0)
joystick.GetObjectPropertiesById((int)deviceObject.ObjectType).SetRange(-1000,
1000);
Modified: trunk/samples/DirectInput/Keyboard/Keyboard.csproj
--- trunk/samples/DirectInput/Keyboard/Keyboard.csproj (original)
+++ trunk/samples/DirectInput/Keyboard/Keyboard.csproj Wed Apr 1 18:04:16
2009
@@ -7,7 +7,7 @@
<ProjectGuid>{61CABE39-9826-4EC2-B8BB-42C83FA6F444}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Keyboard</RootNamespace>
+ <RootNamespace>KeyboardTest</RootNamespace>
<AssemblyName>Keyboard</AssemblyName>
<FileUpgradeFlags>
</FileUpgradeFlags>
Modified: trunk/samples/DirectInput/Keyboard/MainForm.Designer.cs
--- trunk/samples/DirectInput/Keyboard/MainForm.Designer.cs (original)
+++ trunk/samples/DirectInput/Keyboard/MainForm.Designer.cs Wed Apr 1
18:04:16 2009
@@ -1,4 +1,4 @@
-namespace Keyboard
+namespace KeyboardTest
{
partial class MainForm
{
Modified: trunk/samples/DirectInput/Keyboard/MainForm.cs
--- trunk/samples/DirectInput/Keyboard/MainForm.cs (original)
+++ trunk/samples/DirectInput/Keyboard/MainForm.cs Wed Apr 1 18:04:16 2009
@@ -26,11 +26,11 @@
using SlimDX.DirectInput;
using System.Collections.Generic;
-namespace Keyboard
+namespace KeyboardTest
{
public partial class MainForm : Form
{
- Device<KeyboardState> keyboard;
+ Keyboard keyboard;
void CreateDevice()
{
@@ -56,7 +56,7 @@
// create the device
try
{
- keyboard = new Device<KeyboardState>(dinput,
SystemGuid.Keyboard);
+ keyboard = new Keyboard(dinput);
keyboard.SetCooperativeLevel(this, cooperativeLevel);
}
catch (DirectInputException e)
@@ -109,14 +109,14 @@
if (keyboard.Poll().IsFailure)
return;
- IEnumerable<BufferedData<KeyboardState>> bufferedData =
keyboard.GetBufferedData();
+ IEnumerable<KeyboardState> bufferedData =
keyboard.GetBufferedData();
if (Result.Last.IsFailure)
return;
StringBuilder data = new StringBuilder();
- foreach (BufferedData<KeyboardState> packet in bufferedData)
+ foreach (KeyboardState packet in bufferedData)
{
- foreach (Key key in packet.Data.PressedKeys)
+ foreach (Key key in packet.PressedKeys)
data.Append(Enum.GetName(typeof(Key), key) + ' ');
}
Modified: trunk/samples/DirectInput/Keyboard/Program.cs
--- trunk/samples/DirectInput/Keyboard/Program.cs (original)
+++ trunk/samples/DirectInput/Keyboard/Program.cs Wed Apr 1 18:04:16 2009
@@ -22,7 +22,7 @@
using System;
using System.Windows.Forms;
-namespace Keyboard
+namespace KeyboardTest
{
static class Program
{
Modified:
trunk/samples/DirectInput/Keyboard/Properties/Resources.Designer.cs
--- trunk/samples/DirectInput/Keyboard/Properties/Resources.Designer.cs
(original)
+++ trunk/samples/DirectInput/Keyboard/Properties/Resources.Designer.cs Wed
Apr 1 18:04:16 2009
@@ -1,14 +1,14 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:2.0.50727.1433
+// Runtime Version:2.0.50727.3074
//
// Changes to this file may cause incorrect behavior and will be lost
if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
-namespace Keyboard.Properties {
+namespace KeyboardTest.Properties {
using System;
@@ -39,7 +39,7 @@
internal static global::System.Resources.ResourceManager
ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new
global::System.Resources.ResourceManager('Keyboard.Properties.Resources',
typeof(Resources).Assembly);
+ global::System.Resources.ResourceManager temp = new
global::System.Resources.ResourceManager('KeyboardTest.Properties.Resources',
typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
Modified: trunk/samples/DirectInput/Keyboard/Properties/Settings.Designer.cs
--- trunk/samples/DirectInput/Keyboard/Properties/Settings.Designer.cs
(original)
+++ trunk/samples/DirectInput/Keyboard/Properties/Settings.Designer.cs Wed
Apr 1 18:04:16 2009
@@ -1,14 +1,14 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:2.0.50727.1433
+// Runtime Version:2.0.50727.3074
//
// Changes to this file may cause incorrect behavior and will be lost
if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
-namespace Keyboard.Properties {
+namespace KeyboardTest.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
Modified: trunk/samples/DirectInput/Mouse/MainForm.Designer.cs
--- trunk/samples/DirectInput/Mouse/MainForm.Designer.cs (original)
+++ trunk/samples/DirectInput/Mouse/MainForm.Designer.cs Wed Apr 1
18:04:16 2009
@@ -1,4 +1,4 @@
-namespace Mouse
+namespace MouseTest
{
partial class MainForm
{
Modified: trunk/samples/DirectInput/Mouse/MainForm.cs
--- trunk/samples/DirectInput/Mouse/MainForm.cs (original)
+++ trunk/samples/DirectInput/Mouse/MainForm.cs Wed Apr 1 18:04:16 2009
@@ -27,11 +27,11 @@
using SlimDX.DirectInput;
using System.Collections.Generic;
-namespace Mouse
+namespace MouseTest
{
public partial class MainForm : Form
{
- Device<MouseState> mouse;
+ Mouse mouse;
void CreateDevice()
{
@@ -54,7 +54,7 @@
// create the device
try
{
- mouse = new Device<MouseState>(dinput, SystemGuid.Mouse);
+ mouse = new Mouse(dinput);
mouse.SetCooperativeLevel(this, cooperativeLevel);
}
catch (DirectInputException e)
@@ -116,18 +116,18 @@
if (mouse.Poll().IsFailure)
return;
- IEnumerable<BufferedData<MouseState>> bufferedData =
mouse.GetBufferedData();
+ IEnumerable<MouseState> bufferedData = mouse.GetBufferedData();
if (Result.Last.IsFailure || bufferedData null)
return;
StringBuilder data = new StringBuilder();
MouseState result = new MouseState();
- foreach (BufferedData<MouseState> packet in bufferedData)
+ foreach (MouseState packet in bufferedData)
{
- result.X += packet.Data.X;
- result.Y += packet.Data.Y;
- result.Z += packet.Data.Z;
+ result.X += packet.X;
+ result.Y += packet.Y;
+ result.Z += packet.Z;
}
data.AppendFormat(CultureInfo.CurrentCulture, '(X={0} Y={1}
Z={2})', result.X, result.Y, result.Z);
@@ -136,7 +136,7 @@
data.Append(' B');
data.Append(i);
data.Append('=');
- if(bufferedData.GetEnumerator().Current.Data.IsPressed(i))
+ if(bufferedData.GetEnumerator().Current.IsPressed(i))
data.Append('1');
else
data.Append('0');
Modified: trunk/samples/DirectInput/Mouse/Mouse.csproj
--- trunk/samples/DirectInput/Mouse/Mouse.csproj (original)
+++ trunk/samples/DirectInput/Mouse/Mouse.csproj Wed Apr 1 18:04:16 2009
@@ -7,7 +7,7 @@
<ProjectGuid>{D192F71B-2768-4035-98CD-D7B82C99EB84}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Mouse</RootNamespace>
+ <RootNamespace>MouseTest</RootNamespace>
<AssemblyName>Mouse</AssemblyName>
<FileUpgradeFlags>
</FileUpgradeFlags>
Modified: trunk/samples/DirectInput/Mouse/Program.cs
--- trunk/samples/DirectInput/Mouse/Program.cs (original)
+++ trunk/samples/DirectInput/Mouse/Program.cs Wed Apr 1 18:04:16 2009
@@ -22,7 +22,7 @@
using System;
using System.Windows.Forms;
-namespace Mouse
+namespace MouseTest
{
static class Program
{
Modified: trunk/samples/DirectInput/Mouse/Properties/Resources.Designer.cs
--- trunk/samples/DirectInput/Mouse/Properties/Resources.Designer.cs
(original)
+++ trunk/samples/DirectInput/Mouse/Properties/Resources.Designer.cs Wed
Apr 1 18:04:16 2009
@@ -1,14 +1,14 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:2.0.50727.1433
+// Runtime Version:2.0.50727.3074
//
// Changes to this file may cause incorrect behavior and will be lost
if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
-namespace Mouse.Properties {
+namespace MouseTest.Properties {
using System;
@@ -39,7 +39,7 @@
internal static global::System.Resources.ResourceManager
ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new
global::System.Resources.ResourceManager('Mouse.Properties.Resources',
typeof(Resources).Assembly);
+ global::System.Resources.ResourceManager temp = new
global::System.Resources.ResourceManager('MouseTest.Properties.Resources',
typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
Modified: trunk/samples/DirectInput/Mouse/Properties/Settings.Designer.cs
--- trunk/samples/DirectInput/Mouse/Properties/Settings.Designer.cs
(original)
+++ trunk/samples/DirectInput/Mouse/Properties/Settings.Designer.cs Wed
Apr 1 18:04:16 2009
@@ -1,14 +1,14 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:2.0.50727.1433
+// Runtime Version:2.0.50727.3074
//
// Changes to this file may cause incorrect behavior and will be lost
if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
-namespace Mouse.Properties {
+namespace MouseTest.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
Modified: trunk/source/directinput/Callbacks.cpp
--- trunk/source/directinput/Callbacks.cpp (original)
+++ trunk/source/directinput/Callbacks.cpp Wed Apr 1 18:04:16 2009
@@ -44,8 +44,8 @@
BOOL CALLBACK EnumerateObjects( LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID
pvRef )
{
- CollectionShim<DeviceObjectInstance^>* shim =
static_cast<CollectionShim<DeviceObjectInstance^>*>( pvRef );
- shim->GetItems()->Add( gcnew DeviceObjectInstance( *lpddoi ) );
+ CollectionShim<DeviceObjectInstance>* shim =
static_cast<CollectionShim<DeviceObjectInstance>*>( pvRef );
+ shim->GetItems()->Add( DeviceObjectInstance( *lpddoi ) );
return DIENUM_CONTINUE;
}
Added: trunk/source/directinput/CustomDevice.cpp
--- (empty file)
+++ trunk/source/directinput/CustomDevice.cpp Wed Apr 1 18:04:16 2009
@@ -0,0 +1,227 @@
+/*
+* Copyright (c) 2007-2009 SlimDX Group
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
copy
+* of this software and associated documentation files (the 'Software'), to
deal
+* in the Software without restriction, including without limitation the
rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+*/
+#include 'stdafx.h'
+#include <windows.h>
+#include <dinput.h>
+#include <vector>
+
+#include '../ComObject.h'
+#include '../Utilities.h'
+
+#include 'DirectInput.h'
+#include 'DirectInputException.h'
+
+#include 'DataFormatAttribute.h'
+#include 'DataObjectAttribute.h'
+#include 'CustomDevice.h'
+
+using namespace System;
+using namespace System::Collections::Generic;
+using namespace System::Reflection;
+using namespace System::Runtime::InteropServices;
+using namespace System::Windows::Forms;
+
+namespace SlimDX
+{
+namespace DirectInput
+{
+ generic<typename DataFormat>
+ CustomDevice<DataFormat>::CustomDevice( IDirectInputDevice8* device,
ComObject^ owner )
+ {
+ Construct( device, owner );
+ }
+
+ generic<typename DataFormat>
+ CustomDevice<DataFormat>::CustomDevice( IntPtr device )
+ {
+ Construct( device, NativeInterface );
+ }
+
+ generic<typename DataFormat>
+ CustomDevice<DataFormat>::CustomDevice( DirectInput^ directInput, Guid
subsystem ) : Device( directInput, subsystem )
+ {
+ Type^ type = DataFormat::typeid;
+ array<DataFormatAttribute^>^ formatAttributes =
safe_cast<array<DataFormatAttribute^>^>( type->GetCustomAttributes(
+ DataFormatAttribute::typeid, false ) );
+
+ if( formatAttributes->Length != 1 )
+ throw gcnew InvalidOperationException( 'The data format must be marked
with one and only one DataFormat attribute.' );
+ DataFormatAttribute^ formatAttribute = formatAttributes[0];
+
+ List<DataObjectAttribute^>^ objectAttributes = gcnew
List<DataObjectAttribute^>();
+ array<FieldInfo^>^ fields = type->GetFields();
+ for each( FieldInfo^ field in fields )
+ {
+ array<DataObjectAttribute^>^ attributes =
safe_cast<array<DataObjectAttribute^>^>( field->GetCustomAttributes(
+ DataObjectAttribute::typeid, false ) );
+ if( attributes->Length 1 )
+ {
+ attributes[0]->Offset = Marshal::OffsetOf( type, field->Name
).ToInt32();
+ objectAttributes->Add( attributes[0] );
+ }
+ }
+
+ if( objectAttributes->Count < 1 )
+ throw gcnew InvalidOperationException( 'The data format must have at
least one field marked with the DataObject attribute.' );
+
+ DIDATAFORMAT format;
+ format.dwSize = sizeof( DIDATAFORMAT );
+ format.dwObjSize = sizeof( DIOBJECTDATAFORMAT );
+ format.dwFlags = static_cast<DWORD>( formatAttribute->Flags );
+ format.dwDataSize = static_cast<DWORD>( sizeof( type ) );
+ format.dwNumObjs = objectAttributes->Count;
+
+ std::vector<DIOBJECTDATAFORMAT> objectFormats( objectAttributes->Count );
+ for( int i = 0; i < objectAttributes->Count; i++ )
+ {
+ // Manual Allocation: handled properly
+ // we clean up just below. No methods in between throw exceptions
+ GUID *guid = new GUID( Utilities::ConvertManagedGuid(
objectAttributes[i]->SourceGuid ) );
+ objectFormats[i].dwFlags = static_cast<DWORD>(
objectAttributes[i]->Flags );
+ objectFormats[i].dwType = static_cast<DWORD>( objectAttributes[i]->Type
);
+ objectFormats[i].pguid = guid;
+ if( objectAttributes[i]->InstanceNumber -1 )
+ objectFormats[i].dwType |= DIDFT_ANYINSTANCE;
+ else
+ objectFormats[i].dwType |= DIDFT_MAKEINSTANCE(
objectAttributes[i]->InstanceNumber );
+ objectFormats[i].dwOfs = objectAttributes[i]->Offset;
+ }
+
+ format.rgodf = &objectFormats[0];
+ HRESULT hr = InternalPointer->SetDataFormat( &format );
+
+ for( int i = 0; i < objectAttributes->Count; i++ )
+ delete objectFormats[i].pguid;
+
+ if( RECORD_DINPUT( hr ).IsFailure )
+ throw gcnew DirectInputException( Result::Last );
+ }
+
+ generic<typename DataFormat>
+ CustomDevice<DataFormat>^ CustomDevice<DataFormat>::FromPointer(
IDirectInputDevice8W* pointer, ComObject^ owner, ComObjectFlags flags )
+ {
+ if( pointer 0 )
+ return nullptr;
+
+ CustomDevice<DataFormat>^ tableEntry =
safe_cast<CustomDevice<DataFormat>^>( ObjectTable::Find(
static_cast<IntPtr>( pointer ) ) );
+ if( tableEntry != nullptr )
+ {
+ if( static_cast<int>( flags & ComObjectFlags::IsAncillary ) 0 )
+ pointer->Release();
+ return tableEntry;
+ }
+
+ CustomDevice<DataFormat>^ result = gcnew CustomDevice<DataFormat>(
pointer, owner );
+ result->SetFlags( flags );
+ return result;
+ }
+
+ generic<typename DataFormat>
+ CustomDevice<DataFormat>^ CustomDevice<DataFormat>::FromPointer( IntPtr
pointer )
+ {
+ if( pointer IntPtr::Zero )
+ throw gcnew ArgumentNullException( 'pointer' );
+
+ CustomDevice<DataFormat>^ tableEntry =
safe_cast<CustomDevice<DataFormat>^>( ObjectTable::Find(
static_cast<IntPtr>( pointer ) ) );
+ if( tableEntry != nullptr )
+ {
+ return tableEntry;
+ }
+
+ return gcnew CustomDevice<DataFormat>( pointer );
+ }
+
+ generic<typename DataFormat>
+ IList<DataFormat>^ CustomDevice<DataFormat>::GetBufferedData()
+ {
+ DWORD size = INFINITE;
+ HRESULT hr = InternalPointer->GetDeviceData( sizeof( DIDEVICEOBJECTDATA
), NULL, &size, DIGDD_PEEK );
+ if( RecordError( hr ).IsFailure )
+ return nullptr;
+
+ List<DataFormat>^ list = gcnew List<DataFormat>( size );
+ if( size 0 )
+ return list;
+
+ std::vector<DIDEVICEOBJECTDATA> data( size );
+ hr = InternalPointer->GetDeviceData( sizeof( DIDEVICEOBJECTDATA ),
&data[0], &size, 0 );
+ if( RecordError( hr ).IsFailure )
+ return nullptr;
+
+ if( size 0 )
+ return list;
+
+ Type^ type = DataFormat::typeid;
+ array<FieldInfo^>^ fields = type->GetFields();
+
+ for( unsigned int i = 0; i < size; i++ )
+ {
+ DataFormat dataPacket = safe_cast<DataFormat>(
Activator::CreateInstance( type ) );
+ for each( FieldInfo^ field in fields )
+ {
+ if( static_cast<unsigned int>( Marshal::OffsetOf( type, field->Name
).ToInt32() ) data[i].dwOfs )
+ {
+ field->SetValue( dataPacket, data[i].dwData );
+ break;
+ }
+ }
+
+ list->Add( dataPacket );
+ }
+
+ return list;
+ }
+
+ generic<typename DataFormat>
+ Result CustomDevice<DataFormat>::GetCurrentState( DataFormat% data )
+ {
+ Type^ type = DataFormat::typeid;
+ size_t typeSize = sizeof( type );
+ std::vector<BYTE> bytes( typeSize );
+
+ HRESULT hr = InternalPointer->GetDeviceState( static_cast<DWORD>(
typeSize ), &bytes[0] );
+ if( RecordError( hr ).IsFailure )
+ return Result::Last;
+
+ IntPtr pointerData( &bytes[0] );
+ GCHandle handle = GCHandle::Alloc( data, GCHandleType::Pinned );
+ memcpy( handle.AddrOfPinnedObject().ToPointer(),
pointerData.ToPointer(), typeSize );
+ handle.Free();
+
+ return Result::Last;
+ }
+
+ generic<typename DataFormat>
+ DataFormat CustomDevice<DataFormat>::GetCurrentState()
+ {
+ DataFormat result = Activator::CreateInstance<DataFormat>();
+ GetCurrentState( result );
+ return result;
+ }
+
+ generic<typename DataFormat>
+ ObjectProperties^ CustomDevice<DataFormat>::GetObjectPropertiesByName(
String^ name )
+ {
+ return gcnew ObjectProperties( InternalPointer, name, DataFormat::typeid
);
+ }
+}
+}
Added: trunk/source/directinput/CustomDevice.h
--- (empty file)
+++ trunk/source/directinput/CustomDevice.h Wed Apr 1 18:04:16 2009
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2007-2009 SlimDX Group
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
copy
+* of this software and associated documentation files (the 'Software'), to
deal
+* in the Software without restriction, including without limitation the
rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+*/
+#pragma once
+
+#include 'Device.h'
+
+namespace SlimDX
+{
+ namespace DirectInput
+ {
+ generic<typename DataFormat>
+ public ref class CustomDevice : public Device
+ {
+ COMOBJECT_CUSTOM(IDirectInputDevice8, CustomDevice);
+
+ public:
+ /// <summary>
+ /// Initializes a new instance of the <see cref='Device'/> class.
+ /// </summary>
+ /// <param name='subsystem'>The subsystem identifier.</param>
+ [System::Security::Permissions::SecurityPermission(
System::Security::Permissions::SecurityAction::LinkDemand,
Flags=System::Security::Permissions::SecurityPermissionFlag::UnmanagedCode
)]
+ CustomDevice( DirectInput^ directInput, System::Guid subsystem );
+
+ /// <summary>
+ /// Retrieves the current device state.
+ /// </summary>
+ /// <returns>The current device state.</returns>
+ DataFormat GetCurrentState();
+
+ /// <summary>
+ /// Retrieves the current device state.
+ /// </summary>
+ /// <returns>A <see cref='SlimDX::Result'/> object describing the
result of the operation.</returns>
+ [System::Security::Permissions::SecurityPermission(
System::Security::Permissions::SecurityAction::LinkDemand,
Flags=System::Security::Permissions::SecurityPermissionFlag::UnmanagedCode
)]
+ Result GetCurrentState( DataFormat% data );
+
+ /// <summary>
+ /// Retrieves buffered data from the device.
+ /// </summary>
+ /// <returns>A collection of buffered input events.</returns>
+ System::Collections::Generic::IList<DataFormat>^ GetBufferedData();
+
+ /// <summary>
+ /// Gets properties about a single object on an input device.
+ /// </summary>
+ /// <param name='name'>The name of the object whose properties are to
be retrieved.</param>
+ /// <returns>The properties of the desired object.</returns>
+ ObjectProperties^ GetObjectPropertiesByName( System::String^ name );
+
+ };
+ }
+}
No newline at end of file
Modified: trunk/source/directinput/Device.cpp
--- trunk/source/directinput/Device.cpp (original)
+++ trunk/source/directinput/Device.cpp Wed Apr 1 18:04:16 2009
@@ -1,4 +1,3 @@
-#include 'stdafx.h'
/*
* Copyright (c) 2007-2009 SlimDX Group
*
@@ -20,6 +19,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#include 'stdafx.h'
#include <windows.h>
#include <dinput.h>
#include <vector>
@@ -32,339 +32,85 @@
#include 'DirectInputException.h'
#include 'Device.h'
-#include 'KeyboardState.h'
-#include 'JoystickState.h'
-#include 'MouseState.h'
#include 'Callbacks.h'
using namespace System;
using namespace System::Collections::Generic;
-using namespace System::Reflection;
-using namespace System::Runtime::InteropServices;
using namespace System::Windows::Forms;
namespace SlimDX
{
namespace DirectInput
{
- Result RecordError( HRESULT hr )
- {
- if( hr DIERR_OTHERAPPHASPRIO || hr DIERR_INPUTLOST )
- return Result::Record<DirectInputException^>( hr, false, nullptr,
nullptr );
- else
- return RECORD_DINPUT( hr );
- }
-
- generic<typename DataFormat>
- Device<DataFormat>::Device( IDirectInputDevice8W* device, ComObject^
owner )
- {
- Construct(device, owner);
-
- properties = gcnew DeviceProperties( InternalPointer );
- }
-
- generic<typename DataFormat>
- Device<DataFormat>::Device( IntPtr device )
+ Device::Device( DirectInput^ directInput, Guid subsystem )
{
- Construct( device, NativeInterface );
- properties = gcnew DeviceProperties( InternalPointer );
- }
-
- generic<typename DataFormat>
- Device<DataFormat>::Device( DirectInput^ directInput, Guid subsystem )
- {
- IDirectInputDevice8W* device;
+ IDirectInputDevice8* device;
HRESULT hr = directInput->InternalPointer->CreateDevice(
Utilities::ConvertManagedGuid( subsystem ), &device, NULL );
if( RECORD_DINPUT( hr ).IsFailure )
throw gcnew DirectInputException( Result::Last );
- Construct(device);
-
- Type^ type = DataFormat::typeid;
- if( type KeyboardState::typeid )
- hr = InternalPointer->SetDataFormat( &c_dfDIKeyboard );
- else if( type MouseState::typeid )
- hr = InternalPointer->SetDataFormat( &c_dfDIMouse2 );
- else if( type JoystickState::typeid )
- hr = InternalPointer->SetDataFormat( &c_dfDIJoystick2 );
- else
- {
- array<DataFormatAttribute^>^ formatAttributes =
safe_cast<array<DataFormatAttribute^>^>( type->GetCustomAttributes(
- DataFormatAttribute::typeid, false ) );
-
- if( formatAttributes->Length != 1 )
- throw gcnew InvalidOperationException( 'The data format must be marked
with one and only one DataFormat attribute.' );
- DataFormatAttribute^ formatAttribute = formatAttributes[0];
-
- List<DataObjectAttribute^>^ objectAttributes = gcnew
List<DataObjectAttribute^>();
- array<FieldInfo^>^ fields = type->GetFields();
- for each( FieldInfo^ field in fields )
- {
- array<DataObjectAttribute^>^ attributes =
safe_cast<array<DataObjectAttribute^>^>( field->GetCustomAttributes(
- DataObjectAttribute::typeid, false ) );
- if( attributes->Length 1 )
- {
- attributes[0]->Offset = Marshal::OffsetOf( type, field->Name
).ToInt32();
- objectAttributes->Add( attributes[0] );
- }
- }
-
- if( objectAttributes->Count < 1 )
- throw gcnew InvalidOperationException( 'The data format must have at
least one field marked with the DataObject attribute.' );
-
- DIDATAFORMAT format;
- format.dwSize = sizeof( DIDATAFORMAT );
- format.dwObjSize = sizeof( DIOBJECTDATAFORMAT );
- format.dwFlags = static_cast<DWORD>( formatAttribute->Flags );
- format.dwDataSize = static_cast<DWORD>( sizeof( type ) );
- format.dwNumObjs = objectAttributes->Count;
-
- std::vector<DIOBJECTDATAFORMAT> objectFormats( objectAttributes->Count
);
- for( int i = 0; i < objectAttributes->Count; i++ )
- {
- // Manual Allocation: handled properly
- // we clean up just below. No methods in between throw exceptions
- GUID *guid = new GUID( Utilities::ConvertManagedGuid(
objectAttributes[i]->SourceGuid ) );
- objectFormats[i].dwFlags = static_cast<DWORD>(
objectAttributes[i]->Flags );
- objectFormats[i].dwType = static_cast<DWORD>(
objectAttributes[i]->Type );
- objectFormats[i].pguid = guid;
- if( objectAttributes[i]->InstanceNumber -1 )
- objectFormats[i].dwType |= DIDFT_ANYINSTANCE;
- else
- objectFormats[i].dwType |= DIDFT_MAKEINSTANCE(
objectAttributes[i]->InstanceNumber );
- objectFormats[i].dwOfs = objectAttributes[i]->Offset;
- }
-
- format.rgodf = &objectFormats[0];
- hr = InternalPointer->SetDataFormat( &format );
-
- for( int i = 0; i < objectAttributes->Count; i++ )
- delete objectFormats[i].pguid;
- }
-
- if( RECORD_DINPUT( hr ).IsFailure )
- throw gcnew DirectInputException( Result::Last );
-
- properties = gcnew DeviceProperties( InternalPointer );
+ Construct( device );
}
- generic<typename DataFormat>
- Device<DataFormat>^ Device<DataFormat>::FromPointer(
IDirectInputDevice8W* pointer, ComObject^ owner, ComObjectFlags flags )
- {
- if( pointer 0 )
- return nullptr;
-
- Device^ tableEntry = safe_cast<Device^>( ObjectTable::Find(
static_cast<IntPtr>( pointer ) ) );
- if( tableEntry != nullptr )
- {
- if( static_cast<int>( flags & ComObjectFlags::IsAncillary ) 0 )
- pointer->Release();
- return tableEntry;
- }
-
- Device^ result = gcnew Device( pointer, owner );
- result->SetFlags( flags );
- return result;
- }
-
- generic<typename DataFormat>
- Device<DataFormat>^ Device<DataFormat>::FromPointer( IntPtr pointer )
- {
- if( pointer IntPtr::Zero )
- throw gcnew ArgumentNullException( 'pointer' );
-
- Device^ tableEntry = safe_cast<Device^>( ObjectTable::Find(
static_cast<IntPtr>( pointer ) ) );
- if( tableEntry != nullptr )
- {
- return tableEntry;
- }
-
- return gcnew Device( pointer );
- }
-
- generic<typename DataFormat>
- Result Device<DataFormat>::SetCooperativeLevel( IntPtr handle,
CooperativeLevel flags )
+ Result Device::SetCooperativeLevel( IntPtr handle, CooperativeLevel flags
)
{
HRESULT hr = InternalPointer->SetCooperativeLevel( static_cast<HWND>(
handle.ToPointer() ), static_cast<DWORD>( flags ) );
return RECORD_DINPUT( hr );
}
- generic<typename DataFormat>
- Result Device<DataFormat>::SetCooperativeLevel( Control^ control,
CooperativeLevel flags )
+ Result Device::SetCooperativeLevel( Control^ control, CooperativeLevel
flags )
{
return SetCooperativeLevel( control->Handle, flags );
}
- generic<typename DataFormat>
- Result Device<DataFormat>::Acquire()
+ Result Device::Acquire()
{
HRESULT hr = InternalPointer->Acquire();
return RecordError( hr );
}
- generic<typename DataFormat>
- Result Device<DataFormat>::Unacquire()
+ Result Device::Unacquire()
{
HRESULT hr = InternalPointer->Unacquire();
return RecordError( hr );
}
- generic<typename DataFormat>
- Result Device<DataFormat>::Poll()
+ Result Device::Poll()
{
HRESULT hr = InternalPointer->Poll();
return RecordError( hr );
}
- generic<typename DataFormat>
- Result Device<DataFormat>::RunControlPanel()
+ Result Device::RunControlPanel()
{
HRESULT hr = InternalPointer->RunControlPanel( NULL, 0 );
return RECORD_DINPUT( hr );
}
- generic<typename DataFormat>
- Result Device<DataFormat>::RunControlPanel( Control^ parent )
+ Result Device::RunControlPanel( Control^ parent )
{
HRESULT hr = InternalPointer->RunControlPanel( static_cast<HWND>(
parent->Handle.ToPointer() ), 0 );
return RECORD_DINPUT( hr );
}
- generic<typename DataFormat>
- IEnumerable<BufferedData<DataFormat>^>^
Device<DataFormat>::GetBufferedData()
- {
- DWORD size = INFINITE;
- HRESULT hr = InternalPointer->GetDeviceData( sizeof( DIDEVICEOBJECTDATA
), NULL, &size, DIGDD_PEEK );
- if( RecordError( hr ).IsFailure )
- return nullptr;
-
- List<BufferedData<DataFormat>^>^ list = gcnew
List<BufferedData<DataFormat>^>( size );
-
- if( size 0 )
- return list;
-
- std::vector<DIDEVICEOBJECTDATA> data( size );
- hr = InternalPointer->GetDeviceData( sizeof( DIDEVICEOBJECTDATA ),
&data[0], &size, 0 );
- if( RecordError( hr ).IsFailure )
- return nullptr;
-
- if( size 0 )
- return list;
-
- for( unsigned int i = 0; i < size; i++ )
- {
- BufferedData<DataFormat>^ bufferedData = gcnew
BufferedData<DataFormat>( data[i] );
- list->Add( bufferedData );
- }
-
- return list;
- }
-
- generic<typename DataFormat>
- Result Device<DataFormat>::GetCurrentState( DataFormat% data )
- {
- Type^ type = DataFormat::typeid;
-
- if( type KeyboardState::typeid )
- {
- BYTE keys[256];
- HRESULT hr = InternalPointer->GetDeviceState( sizeof( BYTE ) * 256,
keys );
- if( RecordError( hr ).IsFailure )
- return Result::Last;
-
- KeyboardState^ state = safe_cast<KeyboardState^>( data );
- state->UpdateKeys( keys, 256 );
- }
- else if( type MouseState::typeid )
- {
- DIMOUSESTATE2 state;
- HRESULT hr = InternalPointer->GetDeviceState( sizeof( DIMOUSESTATE2 ),
&state );
- if( RecordError( hr ).IsFailure )
- return Result::Last;
-
- MouseState^ result = safe_cast<MouseState^>( data );
- result->AssignState(state);
- }
- else if( type JoystickState::typeid )
- {
- DIJOYSTATE2 joystate;
- HRESULT hr = InternalPointer->GetDeviceState( sizeof( DIJOYSTATE2 ),
&joystate );
- if( RecordError( hr ).IsFailure )
- return Result::Last;
-
- JoystickState^ state = safe_cast<JoystickState^>( data );
- state->AssignState(joystate);
- }
- else
- {
- size_t typeSize = sizeof(type);
- std::vector<BYTE> bytes(typeSize);
- HRESULT hr = InternalPointer->GetDeviceState(
static_cast<DWORD>(sizeof(BYTE) * typeSize), &bytes[0] );
- if( RecordError( hr ).IsFailure )
- return Result::Last;
-
- IntPtr pointerData( &bytes[0] );
- GCHandle handle = GCHandle::Alloc( data, GCHandleType::Pinned );
- memcpy( handle.AddrOfPinnedObject().ToPointer(),
pointerData.ToPointer(), typeSize );
- handle.Free();
- }
-
- return Result::Last;
- }
-
- generic<typename DataFormat>
- DataFormat Device<DataFormat>::GetCurrentState()
- {
- DataFormat result = Activator::CreateInstance<DataFormat>();
- GetCurrentState( result );
- return result;
- }
-
- generic<typename DataFormat>
- ObjectProperties^ Device<DataFormat>::GetObjectPropertiesById( int
objectId )
- {
- return gcnew ObjectProperties( InternalPointer, objectId, false );
- }
-
- generic<typename DataFormat>
- ObjectProperties^ Device<DataFormat>::GetObjectPropertiesByUsage( int
usageCode )
- {
- return gcnew ObjectProperties( InternalPointer, usageCode, true );
- }
-
- generic<typename DataFormat>
- ObjectProperties^ Device<DataFormat>::GetObjectPropertiesByName( String^
name )
- {
- return gcnew ObjectProperties( InternalPointer, name, DataFormat::typeid
);
- }
-
- generic<typename DataFormat>
- DeviceProperties^ Device<DataFormat>::Properties::get()
- {
- return properties;
- }
-
- generic<typename DataFormat>
- Capabilities^ Device<DataFormat>::Caps::get()
+ SlimDX::DirectInput::Capabilities^ Device::Capabilities::get()
{
if( caps != nullptr )
return caps;
DIDEVCAPS c;
- c.dwSize = sizeof(DIDEVCAPS);
+ c.dwSize = sizeof( DIDEVCAPS );
HRESULT hr = InternalPointer->GetCapabilities( &c );
if( RECORD_DINPUT( hr ).IsFailure )
caps = nullptr;
- caps = gcnew Capabilities( c );
-
+ caps = gcnew SlimDX::DirectInput::Capabilities( c );
return caps;
}
- generic<typename DataFormat>
- DeviceInstance^ Device<DataFormat>::DeviceInformation::get()
+ DeviceInstance^ Device::Information::get()
{
if( information != nullptr )
return information;
@@ -381,17 +127,15 @@
return information;
}
- generic<typename DataFormat>
- IEnumerable<DeviceObjectInstance^>^ Device<DataFormat>::GetDeviceObjects()
+ IList<DeviceObjectInstance>^ Device::GetObjects()
{
- return GetDeviceObjects( ObjectDeviceType::All );
+ return GetObjects( ObjectDeviceType::All );
}
- generic<typename DataFormat>
- IEnumerable<DeviceObjectInstance^>^ Device<DataFormat>::GetDeviceObjects(
ObjectDeviceType objectType )
+ IList<DeviceObjectInstance>^ Device::GetObjects( ObjectDeviceType
objectType )
{
- List<DeviceObjectInstance^>^ results = gcnew
List<DeviceObjectInstance^>();
- CollectionShim<DeviceObjectInstance^> shim( results );
+ List<DeviceObjectInstance>^ results = gcnew List<DeviceObjectInstance>();
+ CollectionShim<DeviceObjectInstance> shim( results );
HRESULT hr = InternalPointer->EnumObjects(
static_cast<LPDIENUMDEVICEOBJECTSCALLBACK>( EnumerateObjects ), &shim,
static_cast<DWORD>( objectType ) );
if( RECORD_DINPUT( hr ).IsFailure )
@@ -400,8 +144,17 @@
return results;
}
- generic<typename DataFormat>
- array<Byte>^ Device<DataFormat>::Escape( int command, array<Byte>^ data,
int outputSize )
+ ObjectProperties^ Device::GetObjectPropertiesById( int objectId )
+ {
+ return gcnew ObjectProperties( InternalPointer, objectId, false );
+ }
+
+ ObjectProperties^ Device::GetObjectPropertiesByUsage( int usageCode )
+ {
+ return gcnew ObjectProperties( InternalPointer, usageCode, true );
+ }
+
+ array<Byte>^ Device::Escape( int command, array<Byte>^ data, int
outputSize )
{
array<Byte>^ output = gcnew array<Byte>( outputSize );
@@ -421,6 +174,14 @@
return nullptr;
return output;
+ }
+
+ DeviceProperties^ Device::Properties::get()
+ {
+ if( properties nullptr )
+ properties = gcnew DeviceProperties( InternalPointer );
+
+ return properties;
}
}
}
Modified: trunk/source/directinput/Device.h
--- trunk/source/directinput/Device.h (original)
+++ trunk/source/directinput/Device.h Wed Apr 1 18:04:16 2009
@@ -22,48 +22,31 @@
#pragma once
#include 'Enums.h'
-#include 'DataFormatAttribute.h'
-#include 'DataObjectAttribute.h'
#include 'DeviceInstance.h'
-#include 'Capabilities.h'
-#include 'BufferedData.h'
-#include 'Guids.h'
+#include 'DeviceObjectInstance.h'
#include 'DeviceProperties.h'
#include 'ObjectProperties.h'
-#include 'DeviceObjectInstance.h'
+#include 'Capabilities.h'
+#include 'DirectInput.h'
namespace SlimDX
{
- value class Result;
-
namespace DirectInput
{
- ref class DirectInput;
-
- /// <summary>
- /// Used to gain and release access to Microsoft DirectInput devices,
manage device
- /// properties and information, set behavior, perform initialization,
create and
- /// play force-feedback effects, and open a device's control panel.
- /// </summary>
- /// <typeparam name='DataFormat'>The desired data format of the
device.</typeparam>
- generic<typename DataFormat>
- public ref class Device : public ComObject
+ public ref class Device abstract : public ComObject
{
- COMOBJECT_CUSTOM(IDirectInputDevice8W, Device);
+ COMOBJECT_BASE(IDirectInputDevice8);
private:
- DeviceProperties^ properties;
Capabilities^ caps;
DeviceInstance^ information;
+ DeviceProperties^ properties;
- public:
- /// <summary>
- /// Initializes a new instance of the <see cref='Device'/> class.
- /// </summary>
- /// <param name='subsystem'>The subsystem identifier.</param>
- [System::Security::Permissions::SecurityPermission(
System::Security::Permissions::SecurityAction::LinkDemand,
Flags=System::Security::Permissions::SecurityPermissionFlag::UnmanagedCode
)]
+ protected:
+ Device() { }
Device( DirectInput^ directInput, System::Guid subsystem );
+ public:
/// <summary>
/// Obtains access to the input device.
/// </summary>
@@ -110,36 +93,23 @@
Result RunControlPanel( System::Windows::Forms::Control^ parent );
/// <summary>
- /// Retrieves the current device state.
- /// </summary>
- /// <returns>The current device state.</returns>
- DataFormat GetCurrentState();
-
- /// <summary>
- /// Retrieves the current device state.
+ /// Retrieves data from polled objects on a DirectInput device.
/// </summary>
/// <returns>A <see cref='SlimDX::Result'/> object describing the
result of the operation.</returns>
- [System::Security::Permissions::SecurityPermission(
System::Security::Permissions::SecurityAction::LinkDemand,
Flags=System::Security::Permissions::SecurityPermissionFlag::UnmanagedCode
)]
- Result GetCurrentState( DataFormat% data );
-
- /// <summary>
- /// Retrieves buffered data from the device.
- /// </summary>
- /// <returns>A collection of buffered input events.</returns>
- System::Collections::Generic::IEnumerable<BufferedData<DataFormat>^>^
GetBufferedData();
+ Result Poll();
/// <summary>
- /// Retrieves data from polled objects on a DirectInput device.
+ /// Retrieves a collection of objects on the device.
/// </summary>
- /// <returns>A <see cref='SlimDX::Result'/> object describing the
result of the operation.</returns>
- Result Poll();
+ /// <param name='objectType'>A filter for the returned device objects
collection.</param>
+ /// <returns>A collection of device objects matching the specified
filter.</returns>
+ System::Collections::Generic::IList<DeviceObjectInstance>^ GetObjects(
ObjectDeviceType objectType );
/// <summary>
- /// Gets properties about a single object on an input device.
+ /// Retrieves a collection of objects on the device.
/// </summary>
- /// <param name='name'>The name of the object whose properties are to
be retrieved.</param>
- /// <returns>The properties of the desired object.</returns>
- ObjectProperties^ GetObjectPropertiesByName( System::String^ name );
+ /// <returns>A collection of all device objects on the device.</returns>
+ System::Collections::Generic::IList<DeviceObjectInstance>^ GetObjects();
/// <summary>
/// Gets properties about a single object on an input device.
@@ -156,19 +126,6 @@
ObjectProperties^ GetObjectPropertiesById( int objectId );
/// <summary>
- /// Retrieves ...

What Is Slimdx

DirectX/XNA MVP, GameDev.Net moderator, SlimDX creator, and I guess I'm a student for the time being, too.-Points. SlimDX is an open-source API to DirectX programming under.NET Framework. SlimDX can be used from any language under the.NET runtime (due to the CLR). SlimDX can be used to develop multimedia and interactive applications (e.g. SlimDX is a free open source framework that enables developers to easily build DirectX applications using. Download SlimDX Runtime.NET x86 (January 2012) by SlimDX Group SlimDX is a free open source framework that enables developers to easily build DirectX applications using.NET technologies such as C#, VB.NET, and IronPython. More Software of 'SlimDX Group' SlimTune Profiler - SlimTune is a free profiler and performance analysis/tuning tool for. SlimDX Redistributable (March 2009) - SlimDX is a free open source framework that enables developers to easily build DirectX applications using.

Slimdx Runtime Do I Need

My priority for a SlimDX update is Windows 8 support. That means Metro/WinRT as well as ARM compatibility. I also think this is a useful point at which to shed old APIs. D3D 11/DXGI, D2D, DWrite, XAudio, and XInput are the only major APIs to carry forward I think, along with the misc Windows, RawInput, D3DCompiler, etc stuff we've got. This also seems like the time to make any architectural revisions. I know there's been discussion of going to a native style explicit AddRef/Release model and a number of other things, but I don't know if there's any actual summary of what's been planned/changed in the current experimental development. My understanding is that the prototype is based around the same basic approach driving SharpDX, parsing DX headers and generating CLI bindings directly for C# code with better performance than what C++/CLI can do. It looks like SharpDX code-gen has substantially improved in recent months, andI would like to know what it is exactly that we're planning on doing differently/better than he has. I'm not interested in doing our own just because of ego/personality clashes.