[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cinvoke-svn] r129 - trunk/skorpion
From: |
will |
Subject: |
[cinvoke-svn] r129 - trunk/skorpion |
Date: |
23 Nov 2006 02:50:16 -0500 |
Author: p
Date: 2006-11-23 02:50:16 -0500 (Thu, 23 Nov 2006)
New Revision: 129
Modified:
trunk/skorpion/Form1.cs
trunk/skorpion/skorpion.cs
trunk/skorpion/skorpion.nsi
Log:
fix d3d bugs so works on sisters laptop
Modified: trunk/skorpion/Form1.cs
===================================================================
--- trunk/skorpion/Form1.cs 2006-11-19 11:59:22 UTC (rev 128)
+++ trunk/skorpion/Form1.cs 2006-11-23 07:50:16 UTC (rev 129)
@@ -130,10 +130,7 @@
// display messages from server thread in
console
GlobalState.Console = new
Console(ClientConfig.Debug);
LOG.Callback = new
LOG.CallBack(GlobalState.Console.Print);
- if (ClientConfig.Debug)
- {
- LOG.level = LOG.Level.DEBUG;
- }
+ if (ClientConfig.Debug) { LOG.level =
LOG.Level.DEBUG; }
GlobalState.Chat = new Chat(ClientConfig.Debug);
GlobalState.PlayerList = new
PlayerList(ClientConfig.Debug);
}
Modified: trunk/skorpion/skorpion.cs
===================================================================
--- trunk/skorpion/skorpion.cs 2006-11-19 11:59:22 UTC (rev 128)
+++ trunk/skorpion/skorpion.cs 2006-11-23 07:50:16 UTC (rev 129)
@@ -98,6 +98,7 @@
Material iShipMaterial1;
Material iShipMaterial2;
+ VertexBuffer iFieldVerts2 = null;
VertexBuffer iFieldVerts = null;
IndexBuffer iFieldIndex = null;
IndexBuffer iFieldBorderIndex = null;
@@ -169,14 +170,12 @@
public void go()
{
- iPresentParams = new PresentParameters();
- iPresentParams.Windowed = true;
- iPresentParams.SwapEffect = SwapEffect.Discard;
- iPresentParams.EnableAutoDepthStencil = true;
- iPresentParams.AutoDepthStencilFormat = DepthFormat.D16;
+ if (!CreateDevice())
+ {
+ MessageBox.Show("Create device failed. Check
display settings.");
+ return;
+ }
- CreateDevice();
-
GlobalState.Client.Net.connect(ClientConfig.ClientConnect,
ClientConfig.ClientPort, RegConfig.PlayerName, ClientConfig.Team);
while(ServerState.Live)
@@ -253,13 +252,35 @@
return ret;
}
- public void CreateDevice()
+ public bool CreateDevice()
{
- iDevice = new Device(ClientConfig.DevIndex,
ClientConfig.DevType, GlobalState.Form, ClientConfig.DevFlags, iPresentParams);
+ iPresentParams = new PresentParameters();
+ iPresentParams.Windowed = true;
+ iPresentParams.SwapEffect = SwapEffect.Discard;
+ iPresentParams.EnableAutoDepthStencil = true;
+ iPresentParams.AutoDepthStencilFormat = DepthFormat.D16;
+
+ int i;
+ for (i=0; i<2; i++)
+ {
+ CreateFlags flags =
CreateFlags.HardwareVertexProcessing;
+ if (i==1) flags =
CreateFlags.SoftwareVertexProcessing;
+
+ try
+ {
+ iDevice = new
Device(ClientConfig.DevIndex, ClientConfig.DevType,
+ GlobalState.Form, flags,
iPresentParams);
+ break;
+ }
+ catch(Exception e) { e.ToString(); }
+ }
+ if (i==2) return false;
+
iDevice.DeviceReset += new
System.EventHandler(this.RestoreDeviceObjects);
iDeviceReady = true;
RestoreDeviceObjects(null, null);
+ return true;
}
public void RestoreDeviceObjects(object sender, EventArgs e)
@@ -374,6 +395,18 @@
iFieldMaterial.Diffuse = Color.White;
// field
+ iFieldVerts2 = new
VertexBuffer(typeof(CustomVertex.PositionTextured), 8, iDevice,
Usage.WriteOnly, CustomVertex.PositionTextured.Format, Pool.Default);
+ CustomVertex.PositionTextured[] v2 =
(CustomVertex.PositionTextured[])iFieldVerts2.Lock(0, 0);
+ v2[0].Position = new
Microsoft.DirectX.Vector3(Universe.FieldDefintion.A.X,
Universe.FieldDefintion.A.Y, Universe.FieldDefintion.A.Z);
+ v2[1].Position = new
Microsoft.DirectX.Vector3(Universe.FieldDefintion.B.X,
Universe.FieldDefintion.B.Y, Universe.FieldDefintion.B.Z);
+ v2[2].Position = new
Microsoft.DirectX.Vector3(Universe.FieldDefintion.C.X,
Universe.FieldDefintion.C.Y, Universe.FieldDefintion.C.Z);
+ v2[3].Position = new
Microsoft.DirectX.Vector3(Universe.FieldDefintion.D.X,
Universe.FieldDefintion.D.Y, Universe.FieldDefintion.D.Z);
+ v2[4].Position = new
Microsoft.DirectX.Vector3(Universe.FieldDefintion.E.X,
Universe.FieldDefintion.E.Y, Universe.FieldDefintion.E.Z);
+ v2[5].Position = new
Microsoft.DirectX.Vector3(Universe.FieldDefintion.F.X,
Universe.FieldDefintion.F.Y, Universe.FieldDefintion.F.Z);
+ v2[6].Position = new
Microsoft.DirectX.Vector3(Universe.FieldDefintion.G.X,
Universe.FieldDefintion.G.Y, Universe.FieldDefintion.G.Z);
+ v2[7].Position = new
Microsoft.DirectX.Vector3(Universe.FieldDefintion.H.X,
Universe.FieldDefintion.H.Y, Universe.FieldDefintion.H.Z);
+ iFieldVerts2.Unlock();
+
iFieldVerts = new VertexBuffer(typeof(PCVertex), 8,
iDevice, Usage.WriteOnly, PCVertex.Format, Pool.Default);
PCVertex[] v = (PCVertex[])iFieldVerts.Lock(0, 0);
v[0].p = Universe.FieldDefintion.A;
@@ -428,7 +461,6 @@
iStars.LockVertexBuffer(typeof(CustomVertex.PositionTextured),
LockFlags.None, iStars.NumberVertices);
- System.Console.WriteLine("atan2(0,1) == " +
Math.Atan2(0, 1));
for (int i=0; i<iStars.NumberVertices; i++)
{
Vector3 vv = new Vector3(starVerts[i].X,
starVerts[i].Y, starVerts[i].Z);
@@ -572,7 +604,7 @@
iDevice.Lights[2].Enabled = true;
// iDevice.Lights[2].Commit();
- LOG.info("added light");
+ // LOG.info("added light");
}
GlobalState.Client.CollisionsOut.Clear();
@@ -719,11 +751,12 @@
iDevice.TextureState[0].AlphaOperation =
TextureOperation.SelectArg1;
iDevice.TextureState[0].AlphaArgument1 =
TextureArgument.Diffuse;
iDevice.TextureState[0].AlphaArgument2 =
TextureArgument.TextureColor;
+
iDevice.Indices = iGoalIndex2;
-
iDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 6, 0, 2);
+
iDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 8, 0, 2);
iDevice.Indices = iGoalIndex1;
iDevice.Material = iGoalMaterial1;
-
iDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 6, 0, 2);
+
iDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 8, 0, 2);
iDevice.RenderState.ZBufferWriteEnable = true;
iDevice.RenderState.AlphaBlendEnable = false;
Modified: trunk/skorpion/skorpion.nsi
===================================================================
--- trunk/skorpion/skorpion.nsi 2006-11-19 11:59:22 UTC (rev 128)
+++ trunk/skorpion/skorpion.nsi 2006-11-23 07:50:16 UTC (rev 129)
@@ -9,6 +9,8 @@
IfFileExists "$WINDIR\Microsoft.NET\DirectX for Managed
Code\1.0.2902.0\Microsoft.DirectX.Direct3DX.dll" MainInstall
+IfFileExists "$WINDIR\Microsoft.NET\DirectX for Managed
Code\1.0.2907.0\Microsoft.DirectX.Direct3DX.dll" MainInstall
+
SetOutPath "$WINDIR\Temp"
File "mdxredist_2902.msi"
ExecWait '"msiexec" /i $\"$WINDIR\Temp\mdxredist_2902.msi$\"'
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cinvoke-svn] r129 - trunk/skorpion,
will <=