cinvoke-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cinvoke-svn] r134 - trunk/skorpion


From: will
Subject: [cinvoke-svn] r134 - trunk/skorpion
Date: 13 Dec 2006 03:39:28 -0500

Author: vmy
Date: 2006-12-13 03:39:27 -0500 (Wed, 13 Dec 2006)
New Revision: 134

Modified:
   trunk/skorpion/skorpion.cs
   trunk/skorpion/skorpion.csproj
Log:
display player names below ships

Modified: trunk/skorpion/skorpion.cs
===================================================================
--- trunk/skorpion/skorpion.cs  2006-12-10 05:06:04 UTC (rev 133)
+++ trunk/skorpion/skorpion.cs  2006-12-13 08:39:27 UTC (rev 134)
@@ -155,6 +155,10 @@
                };
                // end ball fire
 
+               System.Drawing.Font ourFont = new System.Drawing.Font("Arial", 
10, System.Drawing.FontStyle.Bold); // Font we use 
+               TextSystem drawingFont; // Font for drawing text
+               Sprite sprite = null;
+
                DateTime          iLastPlayerInfoRequest = new DateTime(0);
 
                public Skorpion()
@@ -306,6 +310,9 @@
                public void RestoreDeviceObjects(object sender, EventArgs e)
                {
                        // ship text
+                       drawingFont = new TextSystem(ourFont);
+                       drawingFont.InitializeDeviceObjects(iDevice);
+                       sprite = new Sprite(iDevice);
 
                        // thrusters
                        if(ClientConfig.Thrusters)
@@ -989,15 +996,30 @@
                        if(ClientConfig.Thrusters)
                        {
                                // draw pulsating thruster on ship
-                               foreach(Entity e2 in 
GlobalState.Client.ThisFrame.Values)
+                               int clientIndex = 0;
+                               foreach(ushort entityIndex in 
GlobalState.Client.ThisFrame.Keys)
                                {
+                                       Entity e2 = 
(Entity)GlobalState.Client.ThisFrame[entityIndex];
                                        if (e2.Type == Ship.TYPE)
                                        {       
                                                iDevice.Transform.World = 
Matrix.Translation(0f, 0f, 0f);
                                        
                                                Ship s = (Ship)e2;
                                                if (e2.ID == Me.ID) s = Me;
+                                               s.Velocity = e2.Velocity;
                                                DrawThrusters(s);
+
+                                               
+                                               Microsoft.DirectX.Vector3 vv = 
new Microsoft.DirectX.Vector3(s.Position.X, s.Position.Y, s.Position.Z);
+                                               
vv.TransformCoordinate(iDevice.Transform.View);
+                                               
vv.TransformCoordinate(iDevice.Transform.Projection);                           
                
+                                               float w = 
(float)GlobalState.Form.Width;
+                                               float h = 
(float)GlobalState.Form.Height;
+                                               Entity e3 = 
(Entity)GlobalState.Client.Universe.Players[entityIndex];
+                                               Ship s2 = (Ship)e3;
+                                               if(s2 != null && vv.Z > 0)
+                                                       
drawingFont.DrawText(sprite, (vv.X * w)/2 + w/2 - 10, (h/2 - 75 - (vv.Y * 
h)/2), Color.Red, s2.Name);
+
                                                //break;
 #if false
                                        if (ClientConfig.Thrusters) 
@@ -1021,9 +1043,11 @@
                                        }
 #endif
                                        }
+                                       clientIndex++;
                                }
                        }
 
+
                        GlobalState.Console.Render();
                        GlobalState.Chat.Render();
                        GlobalState.PlayerList.Render();

Modified: trunk/skorpion/skorpion.csproj
===================================================================
--- trunk/skorpion/skorpion.csproj      2006-12-10 05:06:04 UTC (rev 133)
+++ trunk/skorpion/skorpion.csproj      2006-12-13 08:39:27 UTC (rev 134)
@@ -153,6 +153,21 @@
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = "D3DFont.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "D3DUtil.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "DXUtil.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "Form1.cs"
                     SubType = "Form"
                     BuildAction = "Compile"
@@ -182,6 +197,11 @@
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
+                <File
+                    RelPath = "TextSystem.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
             </Include>
         </Files>
     </CSHARP>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]