示例#1
0
        // draw
        public void RenderStarport()
        {
            if (starportMesh == null)
            {
                starportMesh = new MeshObject("\\starport.x");
            }

            if (OuterSpace.theWindowMgr.FindWindow("   ") == -1)
            {
                if (OuterSpace.theWindowMgr.LoadWindow("CStarportWindow",
                                                       75, 0, 175, OuterSpace.ClientArea.Height, Color.FromArgb(255, 255, 255, 255)) == true)
                {
                    OuterSpace.theWindowMgr.DoModal(OuterSpace.theWindowMgr.FindWindow("   "));
                    wndStarport = (CStarportWindow)(OuterSpace.theWindowMgr.GetWindow(OuterSpace.theWindowMgr.FindWindow("   ")));
                }
            }

            Mesh            moMesh       = starportMesh.GetMesh();
            List <Material> materialList = new List <Material>();
            List <Texture>  textureList  = new List <Texture>();

            HandleMouseInput();

            OuterSpace.device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0F, 0);

            OuterSpace.d3d_scene.SetupLights();

            OuterSpace.thisPlanet.drawplanet();

            // render starport
            Direct3D.Cull oldCull = OuterSpace.device.RenderState.CullMode;

            OuterSpace.device.RenderState.CullMode = Cull.CounterClockwise;

            fYAngle += 0.001F;

            OuterSpace.d3d_scene.transformWorld(Matrix.Zero, Matrix.RotationY(fYAngle), Matrix.Zero,
                                                Matrix.Zero, Matrix.Translation(0.3F, 0.0F, -77.5F));

            OuterSpace.d3d_scene.transformView_Projection(new Vector3(0.0F, 0.1F, -80.0F), new Vector3(0.0F, 0.0F, 0.0F),
                                                          new Vector3(0.0F, 1.0F, 0.0F), Convert.ToSingle(Math.PI / 4), Convert.ToSingle(OuterSpace.ClientArea.Width / OuterSpace.ClientArea.Height),
                                                          0.01F, 1000.0F);

            OuterSpace.d3d_scene.transform_Pipeline();

            starportMesh.Drawmesh();

            OuterSpace.device.RenderState.CullMode = oldCull;

            OuterSpace.device.RenderState.Ambient = Color.FromArgb(255, 65, 65, 65);

            OuterSpace.textfont.DrawText(5, 5, Color.Blue, statustext);
        }
示例#2
0
        public bool LoadWindow(string wndType, int x, int y, int width, int height, Color wndcolor, define_sprite_struct[] spritedefs)
        {
            CWindow aWindow = null;
            bool bRetVal = false;

            switch (wndType)
            {
                case "CPDAWindow":
                    aWindow = new CPDAWindow(x, y, width, height, wndcolor);
                    break;
                case "CTitleWindow":
                    aWindow = new CTitleWindow(x, y, width, height, wndcolor);
                    break;
                case "COptionsWindow":
                    aWindow = new COptionsWindow(x, y, width, height, wndcolor);
                    break;
                case "CmsgWindow":
                    aWindow = new CMsgWindow(x, y, width, height, wndcolor);
                    break;
                case "CstatusWindow":
                    aWindow = new CstatusWindow(x, y, width, height, wndcolor);
                    break;
                case "CStarportWindow":
                    aWindow = new CStarportWindow(x, y, width, height, wndcolor);
                    break;
                case "CScanWindow":
                    aWindow = new CScanWindow(x, y, width, height, wndcolor);
                    break;
                case "CAnalysisWindow":
                    aWindow = new CAnalysisWindow(x, y, width, height, wndcolor);
                    break;
                case "CMenuWindow":
                    aWindow = new CMenuWindow(x, y, width, height, wndcolor);
                    break;
            }

            if (spritedefs != null)
            {
                for (int i = 0; i < (spritedefs.GetUpperBound(0) + 1); i++)
                {
                    aWindow.LoadSprite(spritedefs[i].number, spritedefs[i].file, spritedefs[i].width,
                        spritedefs[i].height, spritedefs[i].Colorkey);
                }
            }

            if (aWindow != null)
            {
                AddWindow(aWindow);
                bRetVal = true;
            }

            return bRetVal;
        }
示例#3
0
        // draw
        public void RenderStarport()
        {
            if (starportMesh == null)
            {
                starportMesh = new MeshObject("\\starport.x");
            }

            if (OuterSpace.theWindowMgr.FindWindow("   ") == -1)
            {
                if (OuterSpace.theWindowMgr.LoadWindow("CStarportWindow",
                    75, 0, 175, OuterSpace.ClientArea.Height, Color.FromArgb(255, 255, 255, 255)) == true)
                {
                    OuterSpace.theWindowMgr.DoModal(OuterSpace.theWindowMgr.FindWindow("   "));
                    wndStarport = (CStarportWindow)(OuterSpace.theWindowMgr.GetWindow(OuterSpace.theWindowMgr.FindWindow("   ")));
                }
            }

            Mesh moMesh = starportMesh.GetMesh();
            List<Material> materialList = new List<Material>();
            List<Texture> textureList = new List<Texture>();

            HandleMouseInput();

            OuterSpace.device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0F, 0);

            OuterSpace.d3d_scene.SetupLights();

            OuterSpace.thisPlanet.drawplanet();

            // render starport
            Direct3D.Cull oldCull = OuterSpace.device.RenderState.CullMode;

            OuterSpace.device.RenderState.CullMode = Cull.CounterClockwise;

            fYAngle += 0.001F;

            OuterSpace.d3d_scene.transformWorld(Matrix.Zero, Matrix.RotationY(fYAngle), Matrix.Zero,
                Matrix.Zero, Matrix.Translation(0.3F, 0.0F, -77.5F));

            OuterSpace.d3d_scene.transformView_Projection(new Vector3(0.0F, 0.1F, -80.0F), new Vector3(0.0F, 0.0F, 0.0F),
                new Vector3(0.0F, 1.0F, 0.0F), Convert.ToSingle(Math.PI / 4), Convert.ToSingle(OuterSpace.ClientArea.Width / OuterSpace.ClientArea.Height),
                0.01F, 1000.0F);

            OuterSpace.d3d_scene.transform_Pipeline();

            starportMesh.Drawmesh();

            OuterSpace.device.RenderState.CullMode = oldCull;

            OuterSpace.device.RenderState.Ambient = Color.FromArgb(255, 65, 65, 65);

            OuterSpace.textfont.DrawText(5, 5, Color.Blue, statustext);
        }
示例#4
0
        public bool LoadWindow(string wndType, int x, int y, int width, int height, Color wndcolor, define_sprite_struct[] spritedefs)
        {
            CWindow aWindow = null;
            bool    bRetVal = false;

            switch (wndType)
            {
            case "CPDAWindow":
                aWindow = new CPDAWindow(x, y, width, height, wndcolor);
                break;

            case "CTitleWindow":
                aWindow = new CTitleWindow(x, y, width, height, wndcolor);
                break;

            case "COptionsWindow":
                aWindow = new COptionsWindow(x, y, width, height, wndcolor);
                break;

            case "CmsgWindow":
                aWindow = new CMsgWindow(x, y, width, height, wndcolor);
                break;

            case "CstatusWindow":
                aWindow = new CstatusWindow(x, y, width, height, wndcolor);
                break;

            case "CStarportWindow":
                aWindow = new CStarportWindow(x, y, width, height, wndcolor);
                break;

            case "CScanWindow":
                aWindow = new CScanWindow(x, y, width, height, wndcolor);
                break;

            case "CAnalysisWindow":
                aWindow = new CAnalysisWindow(x, y, width, height, wndcolor);
                break;

            case "CMenuWindow":
                aWindow = new CMenuWindow(x, y, width, height, wndcolor);
                break;
            }

            if (spritedefs != null)
            {
                for (int i = 0; i < (spritedefs.GetUpperBound(0) + 1); i++)
                {
                    aWindow.LoadSprite(spritedefs[i].number, spritedefs[i].file, spritedefs[i].width,
                                       spritedefs[i].height, spritedefs[i].Colorkey);
                }
            }

            if (aWindow != null)
            {
                AddWindow(aWindow);
                bRetVal = true;
            }

            return(bRetVal);
        }