using System.Threading;\r
using System.Diagnostics;\r
using System.Windows.Forms;\r
+using FDK;\r
\r
namespace DTXMania\r
{\r
Thread.CurrentThread.CurrentCulture = new CultureInfo( "en-US" );\r
#endif\r
\r
- // turn off Aero Glass\r
-// try\r
-// {\r
-// DwmEnableComposition( false );\r
-// }\r
-// catch ( DllNotFoundException )\r
-// {\r
-// // DLLがなければXP以下とみなし何もしない\r
-// }\r
+ DWM.EnableComposition(false);\r
\r
// BEGIN #23670 2010.11.13 from: キャッチされない例外は放出せずに、ログに詳細を出力する。\r
// BEGIM #24606 2011.03.08 from: DEBUG 時は例外発生箇所を直接デバッグできるようにするため、例外をキャッチしないようにする。\r
/// Gets the graphics device.\r
/// </summary>\r
/// <value>The graphics device.</value>\r
- public Device Device\r
- {\r
+#if TEST_Direct3D9Ex\r
+ public DeviceEx Device //yyagi\r
+#else\r
+ public Device Device\r
+#endif\r
+ {\r
get;\r
internal set;\r
}\r
long windowedStyle;\r
bool savedTopmost;\r
\r
- internal static Direct3D Direct3D9Object\r
- {\r
+#if TEST_Direct3D9Ex\r
+ internal static Direct3DEx Direct3D9Object // yyagi\r
+#else\r
+ internal static Direct3D Direct3D9Object\r
+#endif\r
+ {\r
get;\r
private set;\r
}\r
{\r
EnsureD3D9();\r
\r
+#if TEST_Direct3D9Ex\r
+ Direct3D9.Device = new SlimDX.Direct3D9.DeviceEx( Direct3D9Object, CurrentSettings.Direct3D9.AdapterOrdinal,\r
+ CurrentSettings.Direct3D9.DeviceType, game.Window.Handle,\r
+ CurrentSettings.Direct3D9.CreationFlags, CurrentSettings.Direct3D9.PresentParameters );\r
+// yyagi\r
+#else\r
Direct3D9.Device = new SlimDX.Direct3D9.Device( Direct3D9Object, CurrentSettings.Direct3D9.AdapterOrdinal,\r
CurrentSettings.Direct3D9.DeviceType, game.Window.Handle,\r
CurrentSettings.Direct3D9.CreationFlags, CurrentSettings.Direct3D9.PresentParameters );\r
-\r
- if( Result.Last == SlimDX.Direct3D9.ResultCode.DeviceLost )\r
+#endif\r
+ if ( Result.Last == SlimDX.Direct3D9.ResultCode.DeviceLost )\r
{\r
deviceLost = true;\r
return;\r
}\r
+#if TEST_Direct3D9Ex\r
+ Direct3D9.Device.MaximumFrameLatency = 0; // yyagi\r
+#endif\r
}\r
catch( Exception e )\r
{\r
\r
internal static void EnsureD3D9()\r
{\r
- if (Direct3D9Object == null)\r
- Direct3D9Object = new Direct3D();\r
+ if ( Direct3D9Object == null )\r
+#if TEST_Direct3D9Ex\r
+ Direct3D9Object = new Direct3DEx(); // yyagi\r
+#else\r
+ Direct3D9Object = new Direct3D();\r
+#endif\r
}\r
}\r
}\r
--- /dev/null
+using System;\r
+using System.Collections.Generic;\r
+using System.Text;\r
+using System.Runtime.InteropServices;\r
+using System.Drawing;\r
+using SlimDX;\r
+\r
+namespace FDK\r
+{\r
+ //http://spazzarama.wordpress.com/2009/09/30/enable-or-disable-dwm-composition-aero/\r
+ /// <summary>\r
+ /// To control Aerograph in Vista and Windows7. Don't use this class in XP.\r
+ /// </summary>\r
+ public static class DWM\r
+ {\r
+ const uint DWM_EC_DISABLECOMPOSITION = 0;\r
+ const uint DWM_EC_ENABLECOMPOSITION = 1;\r
+\r
+ [DllImport( "dwmapi.dll", EntryPoint = "DwmEnableComposition" )]\r
+ extern static uint DwmEnableComposition( uint compositionAction );\r
+\r
+ /// <summary> \r
+ /// Enable/Disable DWM composition (aka Aero) \r
+ /// </summary> \r
+ /// <param name="bIsAeroEnabled">True to enable composition, false to disable composition.</param> \r
+ /// <returns>True if the operation was successful.</returns> \r
+ public static bool EnableComposition( bool bIsAeroEnabled )\r
+ {\r
+#if TEST_Direct3D9Ex\r
+ try\r
+ {\r
+ if ( bIsAeroEnabled )\r
+ {\r
+ DwmEnableComposition( DWM_EC_ENABLECOMPOSITION );\r
+ }\r
+ else\r
+ {\r
+ DwmEnableComposition( DWM_EC_DISABLECOMPOSITION );\r
+ }\r
+ return true;\r
+ }\r
+ catch ( DllNotFoundException )\r
+ {\r
+ return false;\r
+ }\r
+#else\r
+ return true;\r
+#endif\r
+ } \r
+ }\r
+}\r
+\r
stream.Seek( 0L, SeekOrigin.Begin );\r
int colorKey = 0;\r
colorKey = -16777216;\r
+#if TEST_Direct3D9Ex\r
+ this.texture = Texture.FromStream( device, stream, this.szテクスチャサイズ.Width, this.szテクスチャサイズ.Height, 1, Usage.None, format, Pool.Default, Filter.Point, Filter.None, colorKey );\r
+#else\r
this.texture = Texture.FromStream( device, stream, this.szテクスチャサイズ.Width, this.szテクスチャサイズ.Height, 1, Usage.None, format, Pool.Managed, Filter.Point, Filter.None, colorKey );\r
+#endif\r
}\r
this.t頂点バッファの作成( device );\r
}\r
{\r
bitmap.Save( stream, ImageFormat.Bmp );\r
stream.Seek( 0L, SeekOrigin.Begin );\r
+#if TEST_Direct3D9Ex\r
+ this.texture = Texture.FromStream( device, stream, n幅, n高さ, 1, Usage.None, format, Pool.Default, Filter.Point, Filter.None, 0 );\r
+#else\r
this.texture = Texture.FromStream( device, stream, n幅, n高さ, 1, Usage.None, format, pool, Filter.Point, Filter.None, 0 );\r
+#endif\r
}\r
}\r
this.t頂点バッファの作成( device );\r
ImageInformation information = ImageInformation.FromFile( strファイル名 );\r
this.sz画像サイズ = new Size( information.Width, information.Height );\r
this.szテクスチャサイズ = this.t指定されたサイズを超えない最適なテクスチャサイズを返す( device, this.sz画像サイズ );\r
+#if TEST_Direct3D9Ex\r
+ this.texture = Texture.FromFile( device, strファイル名, this.sz画像サイズ.Width, this.sz画像サイズ.Height, 1, Usage.None, format, Pool.Default, Filter.Point, Filter.None, b黒を透過する ? -16777216 : 0 );\r
+#else\r
this.texture = Texture.FromFile( device, strファイル名, this.sz画像サイズ.Width, this.sz画像サイズ.Height, 1, Usage.None, format, pool, Filter.Point, Filter.None, b黒を透過する ? -16777216 : 0 );\r
+#endif\r
this.t頂点バッファの作成( device );\r
}\r
catch\r
}\r
private void t頂点バッファの作成( Device device )\r
{\r
+#if TEST_Direct3D9Ex\r
+ this.vbPositionColoredVertexBuffer = new VertexBuffer( device, 4 * PositionColoredTexturedVertex.SizeInBytes, Usage.WriteOnly, VertexFormat.None, Pool.Default );\r
+#else\r
this.vbPositionColoredVertexBuffer = new VertexBuffer( device, 4 * PositionColoredTexturedVertex.SizeInBytes, Usage.WriteOnly, VertexFormat.None, Pool.Managed );\r
+#endif\r
}\r
//-----------------\r
#endregion\r