From da04155fddec59b74b8bb65ff7e6d95f6c8c9007 Mon Sep 17 00:00:00 2001 From: chrisf Date: Thu, 4 Oct 2007 18:40:42 +0000 Subject: [PATCH] git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1748 993157c7-ee19-0410-b2c4-bb4e9862e678 --- BluntDx/AssemblyInfo.cpp | 18 -- BluntDx/BluntDx.vcproj | 274 ------------------- BluntDx/BluntDx.vcproj.ODD-SOCKS.chrisf.user | 65 ----- BluntDx/Direct3D.cpp | 39 --- BluntDx/DirectInput.cpp | 37 --- BluntDx/Effect.h | 165 ----------- BluntDx/Enumerations.h | 28 -- BluntDx/FontHelper.h | 56 ---- BluntDx/GraphicsDevice.h | 195 ------------- BluntDx/ImageInformation.h | 36 --- BluntDx/InputDevice.h | 153 ----------- BluntDx/InputManager.h | 30 -- BluntDx/JoystickState.h | 159 ----------- BluntDx/KeyboardState.h | 77 ------ BluntDx/Mesh.h | 66 ----- BluntDx/MouseState.h | 67 ----- BluntDx/SpriteHelper.h | 64 ----- BluntDx/Texture.h | 49 ---- BluntDx/Utilities.h | 15 - BluntDx/VertexBuffer.h | 161 ----------- OpenRa.Game/Actor.cs | 2 +- OpenRa.Game/ConstructionYard.cs | 2 +- OpenRa.Game/Game.cs | 4 +- OpenRa.Game/HardwarePalette.cs | 2 +- OpenRa.Game/MainWindow.cs | 2 +- OpenRa.Game/OpenRa.Game.csproj | 4 +- OpenRa.Game/Refinery.cs | 2 +- OpenRa.Game/Renderer.cs | 2 +- OpenRa.Game/Sequence.cs | 2 +- OpenRa.Game/Sheet.cs | 2 +- OpenRa.Game/SheetBuilder.cs | 1 - OpenRa.Game/Sidebar.cs | 2 +- OpenRa.Game/SpriteRenderer.cs | 2 +- OpenRa.Game/TerrainRenderer.cs | 3 +- OpenRa.Game/TreeCache.cs | 3 +- OpenRa.Game/UnitSheetBuilder.cs | 3 +- OpenRa.Game/Util.cs | 1 - OpenRa.Game/Vertex.cs | 2 +- OpenRa.Game/World.cs | 2 +- OpenRa.sln | 15 - 40 files changed, 21 insertions(+), 1791 deletions(-) delete mode 100644 BluntDx/AssemblyInfo.cpp delete mode 100644 BluntDx/BluntDx.vcproj delete mode 100644 BluntDx/BluntDx.vcproj.ODD-SOCKS.chrisf.user delete mode 100644 BluntDx/Direct3D.cpp delete mode 100644 BluntDx/DirectInput.cpp delete mode 100644 BluntDx/Effect.h delete mode 100644 BluntDx/Enumerations.h delete mode 100644 BluntDx/FontHelper.h delete mode 100644 BluntDx/GraphicsDevice.h delete mode 100644 BluntDx/ImageInformation.h delete mode 100644 BluntDx/InputDevice.h delete mode 100644 BluntDx/InputManager.h delete mode 100644 BluntDx/JoystickState.h delete mode 100644 BluntDx/KeyboardState.h delete mode 100644 BluntDx/Mesh.h delete mode 100644 BluntDx/MouseState.h delete mode 100644 BluntDx/SpriteHelper.h delete mode 100644 BluntDx/Texture.h delete mode 100644 BluntDx/Utilities.h delete mode 100644 BluntDx/VertexBuffer.h diff --git a/BluntDx/AssemblyInfo.cpp b/BluntDx/AssemblyInfo.cpp deleted file mode 100644 index 8d857b81b9..0000000000 --- a/BluntDx/AssemblyInfo.cpp +++ /dev/null @@ -1,18 +0,0 @@ -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::CompilerServices; -using namespace System::Runtime::InteropServices; -using namespace System::Security::Permissions; - -[assembly:AssemblyTitleAttribute("BluntDx")]; -[assembly:AssemblyDescriptionAttribute("BluntDirectX Lightweight MDX Replacement")]; -[assembly:AssemblyConfigurationAttribute("")]; -[assembly:AssemblyCompanyAttribute("C Forbes & Associates")]; -[assembly:AssemblyProductAttribute("BluntDx")]; -[assembly:AssemblyCopyrightAttribute("Copyright (c) C Forbes & Associates 2006")]; -[assembly:AssemblyTrademarkAttribute("")]; -[assembly:AssemblyCultureAttribute("")]; -[assembly:AssemblyVersionAttribute("1.0.*")]; -[assembly:ComVisible(false)]; -[assembly:CLSCompliantAttribute(true)]; -[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)]; diff --git a/BluntDx/BluntDx.vcproj b/BluntDx/BluntDx.vcproj deleted file mode 100644 index 47e66c6b2e..0000000000 --- a/BluntDx/BluntDx.vcproj +++ /dev/null @@ -1,274 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/BluntDx/BluntDx.vcproj.ODD-SOCKS.chrisf.user b/BluntDx/BluntDx.vcproj.ODD-SOCKS.chrisf.user deleted file mode 100644 index 4285de7e4d..0000000000 --- a/BluntDx/BluntDx.vcproj.ODD-SOCKS.chrisf.user +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - diff --git a/BluntDx/Direct3D.cpp b/BluntDx/Direct3D.cpp deleted file mode 100644 index a2ae5c5b44..0000000000 --- a/BluntDx/Direct3D.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#pragma comment(lib, "d3d9.lib") -#pragma comment(lib, "d3dx9.lib") -#pragma comment(lib, "user32.lib") -#pragma comment(lib, "gdi32.lib") - -#pragma unmanaged - -#define WIN32_LEAN_AND_MEAN -#define _WIN32_WINNT 0x0500 - -#include -#include -#include - -#pragma managed - -#include - -#pragma once - -#using "System.Drawing.dll" -#using "System.Windows.Forms.dll" - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::IO; -using namespace System::Drawing; - -#include "Utilities.h" - -#include "Enumerations.h" -#include "GraphicsDevice.h" -#include "ImageInformation.h" -#include "Texture.h" -#include "SpriteHelper.h" -#include "FontHelper.h" -#include "Mesh.h" -#include "Effect.h" -#include "VertexBuffer.h" \ No newline at end of file diff --git a/BluntDx/DirectInput.cpp b/BluntDx/DirectInput.cpp deleted file mode 100644 index ed9034f51d..0000000000 --- a/BluntDx/DirectInput.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#pragma comment(lib, "dxguid.lib") -#pragma comment(lib, "dinput8.lib") -#pragma comment(lib, "user32.lib") -#pragma comment(lib, "gdi32.lib") - -#pragma unmanaged - -#define WIN32_LEAN_AND_MEAN -#define _WIN32_WINNT 0x0500 - -#define INITGUID -#define DIRECTINPUT_VERSION 0x0800 - -#include -#include - -#pragma managed - -#include - -#pragma once - -#using "System.Drawing.dll" -#using "System.Windows.Forms.dll" - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::IO; -using namespace System::Drawing; - -#include "Utilities.h" - -#include "InputManager.h" -#include "KeyboardState.h" -#include "MouseState.h" -#include "JoystickState.h" -#include "InputDevice.h" \ No newline at end of file diff --git a/BluntDx/Effect.h b/BluntDx/Effect.h deleted file mode 100644 index 1e9e2c004f..0000000000 --- a/BluntDx/Effect.h +++ /dev/null @@ -1,165 +0,0 @@ -#pragma once - -using namespace System::Collections::Generic; -using namespace IjwFramework::Collections; -using namespace IjwFramework::Delegates; - -namespace BluntDirectX { namespace Direct3D -{ - public enum class ShaderQuality - { - Low, - Medium, - High, - }; - - public ref class Shader - { - private: - static ID3DXEffectPool* effectPool; - - static Shader() - { - ID3DXEffectPool* e; - D3DXCreateEffectPool( &e ); - effectPool = e; - } - - ShaderQuality shaderQuality; - - IntPtr GetHandle( String^ symbol ) - { - array^ chars = System::Text::Encoding::ASCII->GetBytes(symbol); - pin_ptr p = &chars[0]; - IntPtr result = IntPtr((void*)effect->GetParameterByName(NULL, (char*)p)); - return result; - } - - internal: - ID3DXEffect* effect; - Cache^ parameters; - - public: - Shader(GraphicsDevice^ device, Stream^ data) - { - parameters = gcnew Cache( gcnew Provider(this, &Shader::GetHandle)); - - ID3DXEffect* e; - ID3DXBuffer* compilationErrors; - HRESULT hr; - - data->Position = 0; - array^ bytes = gcnew array((int)data->Length); - data->Read( bytes, 0, (int)data->Length ); - - pin_ptr pdata = &bytes[0]; - - if (FAILED( hr = D3DXCreateEffect( device->device, pdata, (UINT)data->Length, NULL, NULL, - D3DXSHADER_PACKMATRIX_COLUMNMAJOR | D3DXSHADER_USE_LEGACY_D3DX9_31_DLL, effectPool, &e, &compilationErrors ) )) - { - String^ errors = gcnew String((char*)compilationErrors->GetBufferPointer()); - compilationErrors->Release(); - - throw gcnew InvalidOperationException( String::Format( - "Failed compiling shader; HRESULT={0}, Errors:\n{1}", - hr, errors )); - } - - effect = e; - Quality = ShaderQuality::High; - } - - ~Shader() - { - safe_release( effect ); - } - - property ShaderQuality Quality - { - ShaderQuality get() { return shaderQuality; } - void set( ShaderQuality s ) - { - if (shaderQuality == s) - return; - - shaderQuality = s; - switch(s) - { - case ShaderQuality::High: - if (SUCCEEDED(effect->SetTechnique( "high_quality" ))) - break; - case ShaderQuality::Medium: - if (SUCCEEDED(effect->SetTechnique( "med_quality" ))) - break; - case ShaderQuality::Low: - if (SUCCEEDED(effect->SetTechnique( "low_quality" ))) - break; - default: - throw gcnew Exception( "Invalid shader quality" ); - } - } - }; - - void Commit() - { - effect->CommitChanges(); - } - - void Render( IjwFramework::Delegates::Action^ action ) - { - unsigned int passes; - effect->Begin( &passes, D3DXFX_DONOTSAVESTATE | D3DXFX_DONOTSAVESHADERSTATE ); - - for( unsigned int i = 0; i < passes; i++ ) - { - effect->BeginPass( i ); - action(); - effect->EndPass(); - } - - effect->End(); - } - - generic< typename T> where T : value class - void SetValue( String^ name, T value ) - { - IntPtr handle = parameters[name]; - pin_ptr pvalue = &value; - effect->SetValue( (D3DXHANDLE)handle.ToPointer(), pvalue, sizeof(T) ); - } - - void SetValue( String^ name, Texture^ texture ) - { - IntPtr handle = parameters[name]; - effect->SetTexture( (D3DXHANDLE)handle.ToPointer(), texture->texture ); - } - - property array>^ ShaderResources - { - array>^ get() - { - List>^ resources = gcnew List>(); - int id = 0; - D3DXHANDLE parameter; - - while( parameter = effect->GetParameter( NULL, id++ ) ) - { - D3DXHANDLE annotation; - - if (!(annotation = effect->GetAnnotationByName( parameter, "src" ))) - continue; - - char* value; - HRESULT hr; - - if (FAILED(hr = effect->GetString( annotation, (LPCSTR*)&value ))) - ThrowHelper::Hr(hr); - - resources->Add( KeyValuePair( IntPtr( (void*)parameter ), gcnew String(value) ) ); - } - - return resources->ToArray(); - } - } - }; -}} \ No newline at end of file diff --git a/BluntDx/Enumerations.h b/BluntDx/Enumerations.h deleted file mode 100644 index 494d296c0d..0000000000 --- a/BluntDx/Enumerations.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once - -namespace BluntDirectX { namespace Direct3D -{ - [Flags] - public enum class Surfaces - { - None = 0, - Color = D3DCLEAR_TARGET, - Depth = D3DCLEAR_ZBUFFER, - }; - - [Flags] - public enum class VertexFormat - { - None = 0, - Position = D3DFVF_XYZ, - Normal = D3DFVF_NORMAL, - Texture = D3DFVF_TEX1, - Texture2 = D3DFVF_TEX2, - }; - - public enum class PrimitiveType - { - PointList = D3DPT_POINTLIST, - TriangleList = D3DPT_TRIANGLELIST, - }; -}} \ No newline at end of file diff --git a/BluntDx/FontHelper.h b/BluntDx/FontHelper.h deleted file mode 100644 index 5cf3b275d6..0000000000 --- a/BluntDx/FontHelper.h +++ /dev/null @@ -1,56 +0,0 @@ -#pragma once - -namespace BluntDirectX { namespace Direct3D -{ - public ref class FontHelper - { - private: - static int MakeLogicalFontHeight( int emSize ) - { - int result; - HDC hdc = GetDC(NULL); - result = -MulDiv( emSize, GetDeviceCaps( hdc, LOGPIXELSY ), 72 ); - ReleaseDC( NULL, hdc ); - - return result; - } - - internal: - ID3DXFont* font; - - public: - FontHelper( GraphicsDevice^ device, String^ face, int emSize, bool bold ) - { - HRESULT hr; - ID3DXFont* f; - - pin_ptr uface = PtrToStringChars(face); - - int height = MakeLogicalFontHeight( emSize ); - - if (FAILED( - hr = D3DXCreateFont( device->device, height, 0, bold ? FW_BOLD : FW_NORMAL, 1, false, - DEFAULT_CHARSET, OUT_STRING_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE, - uface, &f))) - ThrowHelper::Hr(hr); - - font = f; - } - - void Draw( SpriteHelper^ sprite, String^ text, int x, int y, int color ) - { - pin_ptr utext = PtrToStringChars(text); - RECT r = {x, y, x+1, y+1}; - font->DrawText( sprite->sprite, utext, -1, &r, DT_LEFT | DT_NOCLIP, color ); - } - - Size MeasureText( SpriteHelper^ sprite, String^ text ) - { - pin_ptr utext = PtrToStringChars(text); - RECT r = {0,0,1,1}; - int height = font->DrawText( sprite->sprite, utext, -1, &r, DT_LEFT | DT_CALCRECT, 0 ); - - return Size( r.right - r.left, height ); - } - }; -}} \ No newline at end of file diff --git a/BluntDx/GraphicsDevice.h b/BluntDx/GraphicsDevice.h deleted file mode 100644 index a59c8964e6..0000000000 --- a/BluntDx/GraphicsDevice.h +++ /dev/null @@ -1,195 +0,0 @@ -#pragma once - -namespace BluntDirectX { namespace Direct3D -{ - generic< typename T > - public value class Range - { - T start, end; - public: - Range( T start, T end ) - : start( start ), end( end ) - { - } - - property T Start { T get() { return start; } } - property T End { T get() { return end; } } - }; - - public ref class GraphicsDevice - { - private: - GraphicsDevice( IDirect3DDevice9* device, bool hasHardwareVp ) : device( device ), hardwareVp( hasHardwareVp ) - { - IDirect3DSurface9* s; - device->GetRenderTarget(0, &s); - defaultSurface = s; - } - - bool hardwareVp; - - internal: - IDirect3DDevice9* device; - IDirect3DSurface9* defaultSurface; - - void SetRenderTarget( IDirect3DSurface9* surface ) - { - if (surface == nullptr) - surface = defaultSurface; - - device->SetRenderTarget( 0, surface ); - } - - public: - void BindDefaultRenderTarget() - { - SetRenderTarget( nullptr ); - } - - void BindSurface( IntPtr p ) - { - SetRenderTarget( (IDirect3DSurface9*) p.ToPointer() ); - } - - IntPtr GetDefaultSurface() - { - return IntPtr(defaultSurface); - } - - void Begin() - { - device->BeginScene(); - } - - void End() - { - device->EndScene(); - } - - ~GraphicsDevice() - { - safe_release( device ); - } - - void Clear( int color, Surfaces surfaces ) - { - device->Clear( 0, NULL, (DWORD)surfaces, (D3DCOLOR)color, 1.0f, 0 ); - } - - void Present() - { - device->Present(NULL,NULL,NULL,NULL); - } - - property bool HasHardwareVP - { - bool get() { return hardwareVp; } - } - - static GraphicsDevice^ CreateRenderless() - { - IDirect3D9* d3d = Direct3DCreate9( D3D_SDK_VERSION ); - D3DPRESENT_PARAMETERS pp; - memset( &pp, 0, sizeof(pp) ); - - pp.BackBufferCount = 1; - pp.BackBufferFormat = D3DFMT_UNKNOWN; - pp.BackBufferWidth = pp.BackBufferHeight = 1; - pp.SwapEffect = D3DSWAPEFFECT_COPY; - pp.Windowed = true; - - IDirect3DDevice9* dev; - HRESULT hr; - - if (FAILED(hr = d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_NULLREF, GetConsoleWindow(), - D3DCREATE_HARDWARE_VERTEXPROCESSING, &pp, &dev))) - ThrowHelper::Hr(hr); - - return gcnew GraphicsDevice( dev, true ); - } - - static GraphicsDevice^ Create(Control^ host, int width, int height, bool windowed, bool vsync, Surfaces surfs) - { - IDirect3D9* d3d = Direct3DCreate9( D3D_SDK_VERSION ); - D3DPRESENT_PARAMETERS pp; - memset( &pp, 0, sizeof(pp) ); - - pp.BackBufferCount = vsync ? 1 : 2; - pp.BackBufferWidth = width; - pp.BackBufferHeight = height; - pp.BackBufferFormat = D3DFMT_X8R8G8B8; - - bool needZ = 0 != (int)(surfs & Surfaces::Depth); - - pp.EnableAutoDepthStencil = needZ; - if (needZ) - pp.AutoDepthStencilFormat = D3DFMT_D24X8; - pp.SwapEffect = D3DSWAPEFFECT_DISCARD; - - pp.Windowed = windowed; - pp.PresentationInterval = (vsync && !windowed) ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE; - - DWORD flags[] = { - D3DCREATE_PUREDEVICE | D3DCREATE_HARDWARE_VERTEXPROCESSING, - D3DCREATE_HARDWARE_VERTEXPROCESSING, - D3DCREATE_MIXED_VERTEXPROCESSING, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, - 0 - }; - - DWORD* pf = &flags[0]; - while(*pf) - { - IDirect3DDevice9* pd; - HRESULT hr; - - bool configHasHardwareVp = 0 != (*pf & D3DCREATE_HARDWARE_VERTEXPROCESSING); - - if (SUCCEEDED( hr = d3d->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, (HWND)host->Handle.ToInt32(), - *pf, &pp, &pd))) - return gcnew GraphicsDevice( pd, configHasHardwareVp ); - - ++pf; - } - - throw gcnew ApplicationException("D3D not available."); - } - - static GraphicsDevice^ Create(Control^ host, int width, int height, bool windowed, bool vsync) - { - return Create(host, width, height, windowed, vsync, Surfaces::Color); - } - - void EnableScissor( int left, int top, int width, int height ) - { - RECT r = { left, top, left + width, top + height }; - device->SetScissorRect( &r ); - device->SetRenderState( D3DRS_SCISSORTESTENABLE, true ); - } - - void DisableScissor() - { - device->SetRenderState( D3DRS_SCISSORTESTENABLE, false ); - } - - void DrawPrimitives(PrimitiveType primtype, int count) - { - if (FAILED(device->DrawPrimitive( (D3DPRIMITIVETYPE)primtype, 0, count ))) - throw gcnew InvalidOperationException("Failure"); - } - - void DrawIndexedPrimitives(PrimitiveType primtype, int vertexPoolSize, int numPrimitives) - { - if (FAILED(device->DrawIndexedPrimitive( (D3DPRIMITIVETYPE)primtype, 0, 0, vertexPoolSize, 0, numPrimitives ))) - throw gcnew InvalidOperationException("Failure"); - } - - void DrawIndexedPrimitives(PrimitiveType primType, Range vertices, Range indices) - { - if (FAILED(device->DrawIndexedPrimitive( (D3DPRIMITIVETYPE)primType, - 0, vertices.Start, vertices.End - vertices.Start, - indices.Start, (indices.End - indices.Start) / 3 ))) - throw gcnew InvalidOperationException("Failure"); - } - }; -}} diff --git a/BluntDx/ImageInformation.h b/BluntDx/ImageInformation.h deleted file mode 100644 index 3a5c69c55d..0000000000 --- a/BluntDx/ImageInformation.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -namespace BluntDirectX { namespace Direct3D -{ - public value class ImageInformation - { - private: - ImageInformation( int width, int height, int depth, bool isCube ) - : Width( width ), Height( height ), Depth( depth ), IsCube( isCube ) {} - - public: - int Width; - int Height; - int Depth; - bool IsCube; - - static ImageInformation Create( Stream^ stream ) - { - D3DXIMAGE_INFO info; - - stream->Position = 0; - array^ data = gcnew array( (int)stream->Length ); - stream->Read( data, 0, data->Length ); - - HRESULT hr; - - pin_ptr p = &data[0]; - - if (FAILED( hr = D3DXGetImageInfoFromFileInMemory( p, data->Length, &info ))) - throw gcnew InvalidOperationException( "image information load failed" ); - - return ImageInformation( info.Width, info.Height, info.Depth, - info.ResourceType == D3DRTYPE_CUBETEXTURE ); - } - }; -}} \ No newline at end of file diff --git a/BluntDx/InputDevice.h b/BluntDx/InputDevice.h deleted file mode 100644 index 52eba91eaa..0000000000 --- a/BluntDx/InputDevice.h +++ /dev/null @@ -1,153 +0,0 @@ -#pragma once - -namespace BluntDirectX { namespace DirectInput -{ - [Flags] - public enum class CooperativeLevel - { - OnlyWhenFocused = 0x1, - Exclusive = 0x2, - DisableWindowsKey = 0x4, - }; - - public enum class DeviceType - { - Keyboard, - Mouse, - Joystick, - }; - - public ref class DiInputDevice - { - private: - DiInputDevice( IDirectInputDevice8* device ) - : device(device), devtype( DeviceType::Joystick ) {} - - internal: - IDirectInputDevice8* device; - DeviceType devtype; - - public: - static property Guid SystemKeyboard - { - Guid get() - { - return *(Guid*)&GUID_SysKeyboard; - } - } - - static property Guid SystemMouse - { - Guid get() - { - return *(Guid*)&GUID_SysMouse; - } - } - - DiInputDevice( InputManager^ manager, Guid guid, DeviceType devtype ) : devtype( devtype ) - { - HRESULT hr; - IDirectInputDevice8* _device; - - GUID* p = (GUID*)&guid; - - if (FAILED( hr = manager->di->CreateDevice( *p, &_device, NULL ))) - ThrowHelper::Hr(hr); - - device = _device; - } - - void SetCooperativeLevel( Control^ host, CooperativeLevel level) - { - int _level = (int)level; - DWORD flags = 0; - HRESULT hr; - - flags |= ((_level & (int)CooperativeLevel::OnlyWhenFocused) ? DISCL_FOREGROUND : DISCL_BACKGROUND); - flags |= ((_level & (int)CooperativeLevel::Exclusive) ? DISCL_EXCLUSIVE : DISCL_NONEXCLUSIVE); - if (_level & (int)CooperativeLevel::DisableWindowsKey) - flags |= DISCL_NOWINKEY; - - if (FAILED( hr = device->SetCooperativeLevel( (HWND)host->Handle.ToInt32(), flags ) )) - ThrowHelper::Hr(hr); - - if (devtype == DeviceType::Keyboard) - device->SetDataFormat( &c_dfDIKeyboard ); - else if (devtype == DeviceType::Mouse) - device->SetDataFormat( &c_dfDIMouse ); - } - - void Acquire() - { - HRESULT hr; - if (FAILED(hr = device->Acquire())) - ThrowHelper::Hr(hr); - } - - void Unacquire() - { - HRESULT hr; - if (FAILED(hr = device->Unacquire())) - ThrowHelper::Hr(hr); - } - - void Poll() - { - HRESULT hr; - if (FAILED(hr = device->Poll())) - ThrowHelper::Hr(hr); - } - - KeyboardState^ GetKeyboardState() - { - char buffer[256]; - HRESULT hr; - - if (FAILED(hr = device->GetDeviceState(sizeof(buffer), (void*)buffer))) - ThrowHelper::Hr(hr); - - array^ result = gcnew array(256); - - for( int i=0; i<256; i++ ) - result[i] = (buffer[i] & 0x80) != 0; - - return gcnew KeyboardState(result); - } - - MouseState^ GetMouseState() - { - MouseData mouse; - HRESULT hr; - - if (FAILED(hr = device->GetDeviceState(sizeof(mouse), (void*)&mouse))) - ThrowHelper::Hr(hr); - - return gcnew MouseState(mouse); - } - - JoystickState^ GetJoystickState() - { - DIJOYSTATE state; - HRESULT hr; - - if (FAILED(hr = device->GetDeviceState(sizeof(state), (void*)&state))) - ThrowHelper::Hr(hr); - - return gcnew JoystickState( &state ); - } - - ~DiInputDevice() - { - safe_release( device ); - } - - static DiInputDevice^ GetJoystick( InputManager^ manager ) - { - IDirectInputDevice8* dev = CreateAndConfigureJoystick( manager->di ); - if (dev == nullptr) - return nullptr; - - return gcnew DiInputDevice( dev ); - } - }; -}} \ No newline at end of file diff --git a/BluntDx/InputManager.h b/BluntDx/InputManager.h deleted file mode 100644 index e02cb7918e..0000000000 --- a/BluntDx/InputManager.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -namespace BluntDirectX { namespace DirectInput -{ - public ref class InputManager - { - private: - - internal: - IDirectInput8* di; - - public: - InputManager() - { - HINSTANCE hinst = GetModuleHandle(0); - HRESULT hr; - IDirectInput8* _di; - - if (FAILED( hr = DirectInput8Create( hinst, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&_di, NULL ))) - ThrowHelper::Hr(hr); - - di = _di; - } - - ~InputManager() - { - safe_release(di); - } - }; -}} \ No newline at end of file diff --git a/BluntDx/JoystickState.h b/BluntDx/JoystickState.h deleted file mode 100644 index 7e9ce39b13..0000000000 --- a/BluntDx/JoystickState.h +++ /dev/null @@ -1,159 +0,0 @@ -#pragma once - -namespace BluntDirectX { namespace DirectInput { - -#define joy_axis_limit 1000 - -#pragma unmanaged - - int CALLBACK EnumDevicesCb( const DIDEVICEINSTANCE* inst, void* data ) - { - DIDEVICEINSTANCE* pdata = (DIDEVICEINSTANCE*)data; - memcpy( pdata, inst, sizeof( DIDEVICEINSTANCE ) ); - return DIENUM_STOP; - } - - int CALLBACK EnumDeviceObjectsCb( const DIDEVICEOBJECTINSTANCE* inst, void* data ) - { - IDirectInputDevice8* dev = (IDirectInputDevice8*) data; - - DIPROPRANGE p; - p.diph.dwSize = sizeof(DIPROPRANGE); - p.diph.dwHeaderSize = sizeof(DIPROPHEADER); - p.diph.dwHow = DIPH_BYID; - p.diph.dwObj = inst->dwType; - p.lMin = -joy_axis_limit; - p.lMax = joy_axis_limit; - - HRESULT hr; - if (FAILED(hr = dev->SetProperty( DIPROP_RANGE, &p.diph ))) - return DIENUM_STOP; - - return DIENUM_CONTINUE; - } - - IDirectInputDevice8* CreateAndConfigureJoystick( IDirectInput8* di ) - { - DIDEVICEINSTANCE inst; - memset( &inst, 0, sizeof(inst) ); - di->EnumDevices( DI8DEVCLASS_GAMECTRL, EnumDevicesCb, (void*)&inst, DIEDFL_ATTACHEDONLY ); - if (inst.dwSize == 0) - return nullptr; - - IDirectInputDevice8* dev; - HRESULT hr = di->CreateDevice( inst.guidInstance, &dev, NULL ); - - if (FAILED(hr)) - return nullptr; - - hr = dev->EnumObjects( EnumDeviceObjectsCb, (void*)dev, DIDFT_AXIS ); - - if (FAILED(hr)) { - dev->Release(); - return nullptr; - } - - dev->SetDataFormat( &c_dfDIJoystick ); - return dev; - } - -#pragma managed - - public ref class JoystickState - { - private: - DIJOYSTATE* pstate; - - internal: - JoystickState(DIJOYSTATE* state) - { - DIJOYSTATE* p = new DIJOYSTATE; - pstate = p; - memcpy( pstate, state, sizeof( DIJOYSTATE ) ); - } - - public: - ~JoystickState() - { - delete pstate; - } - - property float x - { - float get() - { - return (float)pstate->lX / joy_axis_limit; - } - } - - property float y - { - float get() - { - return (float)pstate->lY / joy_axis_limit; - } - } - - property float z - { - float get() - { - return (float)pstate->lZ / joy_axis_limit; - } - } - - property float rx - { - float get() - { - return (float)pstate->lRx / joy_axis_limit; - } - } - - property float ry - { - float get() - { - return (float)pstate->lRy / joy_axis_limit; - } - } - - property float rz - { - float get() - { - return (float)pstate->lRz / joy_axis_limit; - } - } - - property float u - { - float get() - { - return (float)pstate->rglSlider[0] / joy_axis_limit; - } - } - - property float v - { - float get() - { - return (float)pstate->rglSlider[1] / joy_axis_limit; - } - } - - property int pov - { - int get() - { - return pstate->rgdwPOV[0]; - } - } - - bool button( int button ) - { - return (pstate->rgbButtons[button] & 0x80) != 0; - } - }; - -}} \ No newline at end of file diff --git a/BluntDx/KeyboardState.h b/BluntDx/KeyboardState.h deleted file mode 100644 index c209733b05..0000000000 --- a/BluntDx/KeyboardState.h +++ /dev/null @@ -1,77 +0,0 @@ -#pragma once - -namespace BluntDirectX { namespace DirectInput -{ - public enum class Key : unsigned char - { - A = DIK_A, B = DIK_B, C = DIK_C, - D = DIK_D, E = DIK_E, F = DIK_F, - G = DIK_G, H = DIK_H, I = DIK_I, - J = DIK_J, K = DIK_K, L = DIK_L, - M = DIK_M, N = DIK_N, O = DIK_O, - P = DIK_P, Q = DIK_Q, R = DIK_R, - S = DIK_S, T = DIK_T, U = DIK_U, - V = DIK_V, W = DIK_W, X = DIK_X, - Y = DIK_Y, Z = DIK_Z, - - D0 = DIK_0, D1 = DIK_1, D2 = DIK_2, D3 = DIK_3, D4 = DIK_4, - D5 = DIK_5, D6 = DIK_6, D7 = DIK_7, D8 = DIK_8, D9 = DIK_9, - - ArrowUp = DIK_UPARROW, - ArrowLeft = DIK_LEFTARROW, - ArrowRight = DIK_RIGHTARROW, - ArrowDown = DIK_DOWNARROW, - - Space = DIK_SPACE, - - Escape = DIK_ESCAPE, - Tab = DIK_TAB, - Enter = DIK_RETURN, - - Tilde = DIK_GRAVE, - - F1 = DIK_F1, - F2 = DIK_F2, - F3 = DIK_F3, - F4 = DIK_F4, - F5 = DIK_F5, - F6 = DIK_F6, - F7 = DIK_F7, - F8 = DIK_F8, - F9 = DIK_F9, - F10 = DIK_F10, - F11 = DIK_F11, - F12 = DIK_F12, - - LeftControl = DIK_LCONTROL, - LeftShift = DIK_LSHIFT, - LeftAlt = DIK_LALT, - - Home = DIK_HOME, - End = DIK_END, - PageUp = DIK_PGUP, - PageDown = DIK_PGDN, - - RightControl = DIK_RCONTROL, - RightShift = DIK_RSHIFT, - RightAlt = DIK_RALT, - }; - - public ref class KeyboardState - { - private: - array^ data; - - internal: - KeyboardState( array^ data ) : data(data) {} - - public: - property bool default[ Key ] - { - bool get( Key key ) - { - return data[ (int) key ]; - } - } - }; -}} \ No newline at end of file diff --git a/BluntDx/Mesh.h b/BluntDx/Mesh.h deleted file mode 100644 index 1ab4294e6b..0000000000 --- a/BluntDx/Mesh.h +++ /dev/null @@ -1,66 +0,0 @@ -#pragma once - -namespace BluntDirectX { namespace Direct3D -{ - - generic< typename T > where T : value class - public ref class Mesh - { - internal: - ID3DXMesh* mesh; - - public: - Mesh( GraphicsDevice^ device, VertexFormat vertexFormat, array^ vertices, array^ indices, - array^ attributes ) - { - ID3DXMesh* m; - HRESULT hr; - - if (FAILED( hr = - D3DXCreateMeshFVF( indices->Length / 3, vertices->Length, D3DXMESH_MANAGED, (DWORD)vertexFormat, - device->device, &m))) - ThrowHelper::Hr(hr); - - mesh = m; - - { - void* vb; - mesh->LockVertexBuffer(0, &vb); - pin_ptr t = &vertices[0]; - memcpy( vb, t, vertices->Length * sizeof(T) ); - mesh->UnlockVertexBuffer(); - } - - { - void* ib; - mesh->LockIndexBuffer(0, &ib); - pin_ptr t = &indices[0]; - memcpy( ib, t, indices->Length * sizeof(short) ); - mesh->UnlockIndexBuffer(); - } - - { - DWORD* ab; - mesh->LockAttributeBuffer(0, &ab); - pin_ptr t = &attributes[0]; - memcpy( ab, t, attributes->Length * sizeof(int) ); - mesh->UnlockAttributeBuffer(); - } - - DWORD* adjacency = new DWORD[ indices->Length ]; - mesh->GenerateAdjacency(1e-3f, adjacency); - mesh->OptimizeInplace(D3DXMESHOPT_ATTRSORT, adjacency, NULL, NULL, NULL); - delete[] adjacency; - } - - void DrawSubset( int attributeId ) - { - mesh->DrawSubset( attributeId ); - } - - ~Mesh() - { - safe_release( mesh ); - } - }; -}} diff --git a/BluntDx/MouseState.h b/BluntDx/MouseState.h deleted file mode 100644 index b930f565c7..0000000000 --- a/BluntDx/MouseState.h +++ /dev/null @@ -1,67 +0,0 @@ -#pragma once - -namespace BluntDirectX { namespace DirectInput { - - value class MouseData - { - public: - long x; - long y; - long z; - unsigned char left, right, middle, aux; - }; - - public ref class MouseState - { - private: - MouseData d; - - internal: - MouseState( MouseData d ) : d(d) {} - - public: - property bool default[ int ] - { - bool get( int button ) - { - unsigned char value = 0; - switch( button ) - { - case 0: value = d.left; break; - case 1: value = d.right; break; - case 2: value = d.middle; break; - case 3: value = d.aux; break; - default: - throw gcnew System::Exception("you idiot"); - } - - return (value & 0x80) != 0; - } - } - - property int X - { - int get() - { - return (int)d.x; - } - } - - property int Y - { - int get() - { - return (int)d.y; - } - } - - property int Z - { - int get() - { - return (int)d.z; - } - } - }; - -}} \ No newline at end of file diff --git a/BluntDx/SpriteHelper.h b/BluntDx/SpriteHelper.h deleted file mode 100644 index da72a34d2f..0000000000 --- a/BluntDx/SpriteHelper.h +++ /dev/null @@ -1,64 +0,0 @@ -#pragma once - -namespace BluntDirectX { namespace Direct3D -{ - public ref class SpriteHelper - { - internal: - ID3DXSprite* sprite; - - public: - SpriteHelper( GraphicsDevice^ device ) - { - HRESULT hr; - ID3DXSprite* s; - - if (FAILED( - hr = D3DXCreateSprite( device->device, &s ))) - ThrowHelper::Hr( hr ); - - sprite = s; - } - - void SetTransform( float sx, float sy, float tx, float ty ) - { - D3DXMATRIX m; - memset( &m, 0, sizeof(m)); - m._11 = sx; m._22 = sy; m._33 = 1; m._44 = 1; - m._41 = tx; m._42 = ty; - - sprite->SetTransform(&m); - } - - void Begin() - { - sprite->Begin( D3DXSPRITE_ALPHABLEND ); - } - - void End() - { - sprite->End(); - } - - void Flush() - { - sprite->Flush(); - } - - void Draw( Texture^ texture, int left, int top, int width, int height, int color ) - { - RECT r = { left, top, width + left, height + top }; - sprite->Draw( (IDirect3DTexture9*)texture->texture, &r, NULL, NULL, color ); - } - - void Draw( Texture^ texture, int color ) - { - sprite->Draw( (IDirect3DTexture9*)texture->texture, NULL, NULL, NULL, color ); - } - - ~SpriteHelper() - { - safe_release( sprite ); - } - }; -}} diff --git a/BluntDx/Texture.h b/BluntDx/Texture.h deleted file mode 100644 index b03b73864c..0000000000 --- a/BluntDx/Texture.h +++ /dev/null @@ -1,49 +0,0 @@ -#pragma once - -namespace BluntDirectX { namespace Direct3D -{ - public ref class Texture - { - private: - Texture( IDirect3DBaseTexture9* texture ) : texture(texture) {} - - internal: - IDirect3DBaseTexture9* texture; - - public: - static Texture^ Create( Stream^ stream, GraphicsDevice^ device ) - { - stream->Position = 0; - array^ data = gcnew array( (int)stream->Length ); - stream->Read( data, 0, data->Length ); - - HRESULT hr; - IDirect3DBaseTexture9* tex; - - pin_ptr p = &data[0]; - - if (FAILED( hr = D3DXCreateTextureFromFileInMemory( device->device, p, data->Length, (IDirect3DTexture9**)&tex ) )) - throw gcnew InvalidOperationException("Texture load failed"); - - return gcnew Texture( tex ); - } - - static Texture^ CreateCube( Stream^ stream, GraphicsDevice^ device ) - { - stream->Position = 0; - array^ data = gcnew array((int)stream->Length); - stream->Read( data, 0, data->Length ); - - HRESULT hr; - IDirect3DBaseTexture9* tex; - - pin_ptr p = &data[0]; - - if (FAILED( hr = D3DXCreateCubeTextureFromFileInMemory( device->device, p, data->Length, (IDirect3DCubeTexture9**)&tex ) )) - throw gcnew InvalidOperationException("Texture load failed"); - - return gcnew Texture( tex ); - } - }; -} -} \ No newline at end of file diff --git a/BluntDx/Utilities.h b/BluntDx/Utilities.h deleted file mode 100644 index 5d4c5fde68..0000000000 --- a/BluntDx/Utilities.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#define safe_release(x) if(x) { (x)->Release(); x = NULL; } - -namespace BluntDirectX -{ - ref class ThrowHelper - { - public: - static void Hr( HRESULT hr ) - { - throw gcnew InvalidOperationException( String::Format("COM error in DirectX, hr={0}", hr) ); - } - }; -} \ No newline at end of file diff --git a/BluntDx/VertexBuffer.h b/BluntDx/VertexBuffer.h deleted file mode 100644 index 134f6c014b..0000000000 --- a/BluntDx/VertexBuffer.h +++ /dev/null @@ -1,161 +0,0 @@ -#pragma once - -namespace BluntDirectX { namespace Direct3D -{ - public ref class IndexBuffer - { - internal: - IDirect3DIndexBuffer9* buffer; - IDirect3DDevice9* device; - int size; - - public: - IndexBuffer( GraphicsDevice^ device, int size ) - : size( size ), device( device->device ) - { - HRESULT hr; - IDirect3DIndexBuffer9* b; - - if (FAILED( hr = this->device->CreateIndexBuffer( sizeof( unsigned short ) * size, - device->HasHardwareVP ? 0 : D3DUSAGE_SOFTWAREPROCESSING, D3DFMT_INDEX16, D3DPOOL_SYSTEMMEM, &b, NULL ))) - ThrowHelper::Hr(hr); - - buffer = b; - } - - void SetData( array^ data ) - { - pin_ptr pdata = &data[0]; - void * ib; - - buffer->Lock( 0, sizeof(unsigned short) * size, &ib, D3DLOCK_DISCARD ); - memcpy( ib, pdata, sizeof(unsigned short) * data->Length ); - buffer->Unlock(); - } - - void Bind() - { - device->SetIndices( buffer ); - } - - ~IndexBuffer() - { - safe_release( buffer ); - } - - property int Size { int get() { return size; } } - }; - - generic where T : value class - public ref class FvfVertexBuffer - { - internal: - IDirect3DVertexBuffer9* buffer; - IDirect3DDevice9* device; - int numVertices; - unsigned int fvf; - - public: - FvfVertexBuffer( GraphicsDevice^ device, int numVertices, VertexFormat fvf ) - : numVertices( numVertices ), device(device->device), fvf((unsigned int)fvf) - { - HRESULT hr; - IDirect3DVertexBuffer9* b; - - if (FAILED( hr = device->device->CreateVertexBuffer( sizeof(T) * numVertices, - device->HasHardwareVP ? 0 : D3DUSAGE_SOFTWAREPROCESSING, this->fvf, D3DPOOL_SYSTEMMEM, &b, NULL ))) - ThrowHelper::Hr(hr); - - buffer = b; - } - - void SetData( array^ data ) - { - pin_ptr pdata = &data[0]; - void* vb; - - buffer->Lock( 0, sizeof(T) * numVertices, &vb, D3DLOCK_DISCARD ); - memcpy( vb, pdata, sizeof(T) * data->Length ); - buffer->Unlock(); - } - - void Bind( int stream ) - { - device->SetStreamSource( stream, buffer, 0, sizeof(T) ); - device->SetFVF( fvf ); - } - - ~FvfVertexBuffer() - { - safe_release( buffer ); - } - - property int Size { int get() { return numVertices; } } - property VertexFormat FVF { VertexFormat get() { return (VertexFormat)fvf; }} - }; - - generic where T : value class - public ref class VertexBuffer - { - internal: - IDirect3DVertexBuffer9* buffer; - IDirect3DVertexDeclaration9* decl; - IDirect3DDevice9* device; - int numVertices; - - public: - VertexBuffer( GraphicsDevice^ device, int numVertices ) - : numVertices( numVertices ), device(device->device) - { - HRESULT hr; - IDirect3DVertexBuffer9* b; - IDirect3DVertexDeclaration9* d; - - D3DVERTEXELEMENT9 elements[] = - { - {0,0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, - {0,12,D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR,0}, - {0,28,D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR,1}, - {0,44,D3DDECLTYPE_FLOAT1, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_PSIZE,0}, - - D3DDECL_END() - }; - - if (FAILED( hr = device->device->CreateVertexDeclaration( elements, &d ) )) - ThrowHelper::Hr(hr); - - decl = d; - - if (FAILED( hr = device->device->CreateVertexBuffer( sizeof(T) * numVertices, - D3DUSAGE_DYNAMIC | D3DUSAGE_POINTS | - (device->HasHardwareVP ? 0 : D3DUSAGE_SOFTWAREPROCESSING), 0, D3DPOOL_DEFAULT, &b, NULL ))) - ThrowHelper::Hr(hr); - - buffer = b; - } - - void SetData( array^ data ) - { - pin_ptr pdata = &data[0]; - void* vb; - - buffer->Lock( 0, sizeof(T) * numVertices, &vb, D3DLOCK_DISCARD ); - memcpy( vb, pdata, sizeof(T) * data->Length ); - buffer->Unlock(); - } - - void Bind( int stream ) - { - device->SetStreamSource( stream, buffer, 0, sizeof(T) ); - device->SetVertexDeclaration( decl ); - } - - ~VertexBuffer() - { - safe_release( decl ); - safe_release( buffer ); - } - - property int Size { int get() { return numVertices; } } - }; -}} \ No newline at end of file diff --git a/OpenRa.Game/Actor.cs b/OpenRa.Game/Actor.cs index ec720892f5..0141466a19 100644 --- a/OpenRa.Game/Actor.cs +++ b/OpenRa.Game/Actor.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Text; using System.Drawing; using OpenRa.FileFormats; -using BluntDirectX.Direct3D; + using System.Windows.Forms; namespace OpenRa.Game diff --git a/OpenRa.Game/ConstructionYard.cs b/OpenRa.Game/ConstructionYard.cs index bd4db2b1d0..c6e6e9c45f 100644 --- a/OpenRa.Game/ConstructionYard.cs +++ b/OpenRa.Game/ConstructionYard.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Text; -using BluntDirectX.Direct3D; + namespace OpenRa.Game { diff --git a/OpenRa.Game/Game.cs b/OpenRa.Game/Game.cs index 9ab2a46750..83f6d25db8 100644 --- a/OpenRa.Game/Game.cs +++ b/OpenRa.Game/Game.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; using System.Text; using OpenRa.FileFormats; -using BluntDirectX.Direct3D; + using System.Drawing; using IjwFramework.Delegates; @@ -37,7 +37,7 @@ namespace OpenRa.Game terrain = new TerrainRenderer(renderer, map, viewport); world = new World(renderer, this); - treeCache = new TreeCache(renderer.Device, map); + treeCache = new TreeCache(map); foreach (TreeReference treeReference in map.Trees) world.Add(new Tree(treeReference, treeCache, map, this)); diff --git a/OpenRa.Game/HardwarePalette.cs b/OpenRa.Game/HardwarePalette.cs index 662b95b80e..a0c7e256bd 100644 --- a/OpenRa.Game/HardwarePalette.cs +++ b/OpenRa.Game/HardwarePalette.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Text; -using BluntDirectX.Direct3D; +using Ijw.DirectX; using System.Drawing; using System.IO; using OpenRa.FileFormats; diff --git a/OpenRa.Game/MainWindow.cs b/OpenRa.Game/MainWindow.cs index ff7d709ac0..d9e0201e6d 100644 --- a/OpenRa.Game/MainWindow.cs +++ b/OpenRa.Game/MainWindow.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Text; using System.Windows.Forms; using System.Drawing; -using BluntDirectX.Direct3D; + using OpenRa.FileFormats; using System.IO; using OpenRa.TechTree; diff --git a/OpenRa.Game/OpenRa.Game.csproj b/OpenRa.Game/OpenRa.Game.csproj index 375f65951f..24fd7200b4 100644 --- a/OpenRa.Game/OpenRa.Game.csproj +++ b/OpenRa.Game/OpenRa.Game.csproj @@ -29,9 +29,9 @@ 4 - + False - ..\release\BluntDx.dll + ..\..\Ijw.DirectX\Release\Ijw.DirectX.dll False diff --git a/OpenRa.Game/Refinery.cs b/OpenRa.Game/Refinery.cs index 49d1ad3b29..c9d3865fac 100644 --- a/OpenRa.Game/Refinery.cs +++ b/OpenRa.Game/Refinery.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; using System.Text; using OpenRa.FileFormats; -using BluntDirectX.Direct3D; + using System.Drawing; namespace OpenRa.Game diff --git a/OpenRa.Game/Renderer.cs b/OpenRa.Game/Renderer.cs index 695d086689..88fc9e7281 100644 --- a/OpenRa.Game/Renderer.cs +++ b/OpenRa.Game/Renderer.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Text; using System.Windows.Forms; using System.Drawing; -using BluntDirectX.Direct3D; +using Ijw.DirectX; using System.IO; using OpenRa.FileFormats; using IjwFramework.Delegates; diff --git a/OpenRa.Game/Sequence.cs b/OpenRa.Game/Sequence.cs index 75be84ce9e..ab16c512ed 100644 --- a/OpenRa.Game/Sequence.cs +++ b/OpenRa.Game/Sequence.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Text; -using BluntDirectX.Direct3D; +using Ijw.DirectX; using System.Xml; namespace OpenRa.Game diff --git a/OpenRa.Game/Sheet.cs b/OpenRa.Game/Sheet.cs index e1892c7f16..a83251f467 100644 --- a/OpenRa.Game/Sheet.cs +++ b/OpenRa.Game/Sheet.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Text; -using BluntDirectX.Direct3D; using System.Drawing; using System.IO; +using Ijw.DirectX; namespace OpenRa.Game { diff --git a/OpenRa.Game/SheetBuilder.cs b/OpenRa.Game/SheetBuilder.cs index 28579288cd..4cd75bab5a 100644 --- a/OpenRa.Game/SheetBuilder.cs +++ b/OpenRa.Game/SheetBuilder.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Text; using System.Drawing; -using BluntDirectX.Direct3D; using OpenRa.FileFormats; namespace OpenRa.Game diff --git a/OpenRa.Game/Sidebar.cs b/OpenRa.Game/Sidebar.cs index 63e331992e..1ec7b7751c 100644 --- a/OpenRa.Game/Sidebar.cs +++ b/OpenRa.Game/Sidebar.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; using System.Text; using OpenRa.TechTree; -using BluntDirectX.Direct3D; +using Ijw.DirectX; using OpenRa.FileFormats; using System.Drawing; using System.IO; diff --git a/OpenRa.Game/SpriteRenderer.cs b/OpenRa.Game/SpriteRenderer.cs index 916da648ab..51384c0d4d 100644 --- a/OpenRa.Game/SpriteRenderer.cs +++ b/OpenRa.Game/SpriteRenderer.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Text; -using BluntDirectX.Direct3D; using OpenRa.FileFormats; using System.Drawing; +using Ijw.DirectX; namespace OpenRa.Game { diff --git a/OpenRa.Game/TerrainRenderer.cs b/OpenRa.Game/TerrainRenderer.cs index 9a6ef5889a..4d7fb779ca 100644 --- a/OpenRa.Game/TerrainRenderer.cs +++ b/OpenRa.Game/TerrainRenderer.cs @@ -2,10 +2,11 @@ using System; using System.Collections.Generic; using System.Text; using OpenRa.FileFormats; -using BluntDirectX.Direct3D; + using System.Drawing; using System.IO; using System.Windows.Forms; +using Ijw.DirectX; namespace OpenRa.Game { diff --git a/OpenRa.Game/TreeCache.cs b/OpenRa.Game/TreeCache.cs index 186f9f7118..86dcf7fe70 100644 --- a/OpenRa.Game/TreeCache.cs +++ b/OpenRa.Game/TreeCache.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Text; using OpenRa.FileFormats; -using BluntDirectX.Direct3D; using System.Drawing; namespace OpenRa.Game @@ -11,7 +10,7 @@ namespace OpenRa.Game { Dictionary trees = new Dictionary(); - public TreeCache(GraphicsDevice device, Map map) + public TreeCache(Map map) { foreach (TreeReference r in map.Trees) { diff --git a/OpenRa.Game/UnitSheetBuilder.cs b/OpenRa.Game/UnitSheetBuilder.cs index 8fbda2abc2..df46fd16bd 100644 --- a/OpenRa.Game/UnitSheetBuilder.cs +++ b/OpenRa.Game/UnitSheetBuilder.cs @@ -3,7 +3,8 @@ using System.Collections.Generic; using System.Text; using OpenRa.FileFormats; using System.Drawing; -using BluntDirectX.Direct3D; +using Ijw.DirectX; + namespace OpenRa.Game { diff --git a/OpenRa.Game/Util.cs b/OpenRa.Game/Util.cs index e574840476..e21fa32202 100644 --- a/OpenRa.Game/Util.cs +++ b/OpenRa.Game/Util.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Text; using OpenRa.FileFormats; using System.Drawing; -using BluntDirectX.Direct3D; using System.IO; namespace OpenRa.Game diff --git a/OpenRa.Game/Vertex.cs b/OpenRa.Game/Vertex.cs index 1872148b8c..e32a5a9ef8 100644 --- a/OpenRa.Game/Vertex.cs +++ b/OpenRa.Game/Vertex.cs @@ -2,8 +2,8 @@ using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; -using BluntDirectX.Direct3D; using System.Drawing; +using Ijw.DirectX; namespace OpenRa.Game { diff --git a/OpenRa.Game/World.cs b/OpenRa.Game/World.cs index 8c0685cab3..771ae1355b 100644 --- a/OpenRa.Game/World.cs +++ b/OpenRa.Game/World.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.Text; -using BluntDirectX.Direct3D; using OpenRa.FileFormats; using System.Drawing; using System.Windows.Forms; +using Ijw.DirectX; namespace OpenRa.Game { diff --git a/OpenRa.sln b/OpenRa.sln index d0e7cffbb4..7247e4aade 100644 --- a/OpenRa.sln +++ b/OpenRa.sln @@ -9,11 +9,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRa.FileFormats", "OpenR EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRa.Game", "OpenRa.Game\OpenRa.Game.csproj", "{0DFB103F-2962-400F-8C6D-E2C28CCBA633}" - ProjectSection(ProjectDependencies) = postProject - {4EA97564-C929-4ABE-AC5D-A9D11EDE08E1} = {4EA97564-C929-4ABE-AC5D-A9D11EDE08E1} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BluntDx", "BluntDx\BluntDx.vcproj", "{4EA97564-C929-4ABE-AC5D-A9D11EDE08E1}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRa.TechTree", "OpenRa.TechTree\OpenRa.TechTree.csproj", "{2BFC3861-E90E-4F77-B254-8FB8285E43AC}" EndProject @@ -61,16 +56,6 @@ Global {0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release|Mixed Platforms.Build.0 = Release|Any CPU {0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release|Win32.ActiveCfg = Release|Any CPU - {4EA97564-C929-4ABE-AC5D-A9D11EDE08E1}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {4EA97564-C929-4ABE-AC5D-A9D11EDE08E1}.Debug|Mixed Platforms.ActiveCfg = Release|Win32 - {4EA97564-C929-4ABE-AC5D-A9D11EDE08E1}.Debug|Mixed Platforms.Build.0 = Release|Win32 - {4EA97564-C929-4ABE-AC5D-A9D11EDE08E1}.Debug|Win32.ActiveCfg = Debug|Win32 - {4EA97564-C929-4ABE-AC5D-A9D11EDE08E1}.Debug|Win32.Build.0 = Debug|Win32 - {4EA97564-C929-4ABE-AC5D-A9D11EDE08E1}.Release|Any CPU.ActiveCfg = Release|Win32 - {4EA97564-C929-4ABE-AC5D-A9D11EDE08E1}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {4EA97564-C929-4ABE-AC5D-A9D11EDE08E1}.Release|Mixed Platforms.Build.0 = Release|Win32 - {4EA97564-C929-4ABE-AC5D-A9D11EDE08E1}.Release|Win32.ActiveCfg = Release|Win32 - {4EA97564-C929-4ABE-AC5D-A9D11EDE08E1}.Release|Win32.Build.0 = Release|Win32 {2BFC3861-E90E-4F77-B254-8FB8285E43AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2BFC3861-E90E-4F77-B254-8FB8285E43AC}.Debug|Any CPU.Build.0 = Debug|Any CPU {2BFC3861-E90E-4F77-B254-8FB8285E43AC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU