Ejemplo n.º 1
0
        public D3DSceneManager()
        {
            //dayflipper = 1;
            lasttick = Environment.TickCount / 3600;
            //sunintensity = 250;
            sunposition = new Vector4(-1500.0F, 0.0F, 500.0F, 0.0F);
            snowSprite  = new SpriteClass("snow.bmp", 30, 30, Color.FromArgb(255, 0, 0, 0).ToArgb());

            for (int i = 0; i < 8; i++)
            {
                Point pt = new Point((i % 4) * 10, (int)(i / 3) * 10);
                snowSprite.sourceFrame[i] = new Rectangle(pt.X, pt.Y, 10, 10);
            }

            rainSprite = new SpriteClass("rain.bmp", 10, 10, Color.FromArgb(255, 0, 0, 0).ToArgb());
            rainSprite.sourceFrame[0] = new Rectangle(0, 0, 10, 10);

            for (int i = 0; i < 160; i++)
            {
                precipitation[i]       = new pricip();
                precipitation[i].Frame = Convert.ToInt32((int)(8 * rnd.NextDouble()));
                precipitation[i].X     = Convert.ToInt32((int)((OuterSpace.ClientArea.Width + 1) * rnd.NextDouble()));
                precipitation[i].Y     = Convert.ToInt32((int)((OuterSpace.ClientArea.Height + 1) * rnd.NextDouble()));
            }
        }
Ejemplo n.º 2
0
        public D3DSceneManager()
        {
            //dayflipper = 1;
            lasttick = Environment.TickCount / 3600;
            //sunintensity = 250;
            sunposition = new Vector4(-1500.0F, 0.0F, 500.0F, 0.0F);
            snowSprite = new SpriteClass("snow.bmp", 30, 30, Color.FromArgb(255,0,0,0).ToArgb());

            for (int i = 0; i < 8; i++)
            {
                Point pt = new Point((i % 4) * 10, (int)(i / 3) * 10);
                snowSprite.sourceFrame[i] = new Rectangle(pt.X, pt.Y, 10, 10);
            }

            rainSprite = new SpriteClass("rain.bmp", 10, 10, Color.FromArgb(255,0,0,0).ToArgb());
            rainSprite.sourceFrame[0] = new Rectangle(0, 0, 10, 10);

            for (int i = 0; i < 160; i++)
            {
                precipitation[i] = new pricip();
                precipitation[i].Frame = Convert.ToInt32((int)(8 * rnd.NextDouble()));
                precipitation[i].X = Convert.ToInt32((int)((OuterSpace.ClientArea.Width + 1) * rnd.NextDouble()));
                precipitation[i].Y = Convert.ToInt32((int)((OuterSpace.ClientArea.Height + 1) * rnd.NextDouble()));
            }
        }
Ejemplo n.º 3
0
        public void LoadSprite(int spriteNum, string spriteFile, int width, int height, int colorKey)
        {
            switch (spriteNum)
            {
            case 1:
                BackgroundSprite = new SpriteClass(spriteFile, width, height, colorKey);
                for (int i = 0; i < 9; i++)
                {
                    Point pt = new Point((i % 3) * 16, (int)(i / 3) * 16);
                    BackgroundSprite.sourceFrame[i] = new Rectangle(pt.X, pt.Y, 16, 16);
                }
                break;

            case 2:
                CornerSprite[0] = new SpriteClass(spriteFile, width, height, colorKey);
                break;

            case 3:
                CornerSprite[1] = new SpriteClass(spriteFile, width, height, colorKey);
                break;

            case 4:
                CornerSprite[2] = new SpriteClass(spriteFile, width, height, colorKey);
                break;

            case 5:
                CornerSprite[3] = new SpriteClass(spriteFile, width, height, colorKey);
                break;

            case 6:
                BorderSprite[0] = new SpriteClass(spriteFile, width, height, colorKey);
                break;

            case 7:
                BorderSprite[1] = new SpriteClass(spriteFile, width, height, colorKey);
                break;

            case 8:
                BorderSprite[2] = new SpriteClass(spriteFile, width, height, colorKey);
                break;

            case 9:
                BorderSprite[3] = new SpriteClass(spriteFile, width, height, colorKey);
                break;

            case 10:
                CaptionSprite = new SpriteClass(spriteFile, width, height, colorKey);
                break;
            }

            IsSpriteLoaded[spriteNum - 1] = true;
        }
Ejemplo n.º 4
0
 public starmap(float xScale, float yScale)
 {
     aLine = new Microsoft.DirectX.Direct3D.Line(OuterSpace.device);
     mapArea[1].Y = (int)(OuterSpace.ClientArea.Height * yScale);
     //Bottom
     mapArea[1].X = (int)OuterSpace.ClientArea.Width;
     //Right
     mapArea[0].Y = 0;
     //Top
     mapArea[0].X = (int)(OuterSpace.ClientArea.Width * xScale);
     //Left
     resizeButton = new SpriteClass("resizeButton.bmp", 35, 35, Convert.ToInt32(-16777216));
     resizeButton.sourceFrame[0] = new System.Drawing.Rectangle(0, 0, 35, 35);
     resizeButtonColor = Color.FromArgb(75, 255, 255, 255);
     resizing = false;
 }
Ejemplo n.º 5
0
 public starmap(float xScale, float yScale)
 {
     aLine        = new Microsoft.DirectX.Direct3D.Line(OuterSpace.device);
     mapArea[1].Y = (int)(OuterSpace.ClientArea.Height * yScale);
     //Bottom
     mapArea[1].X = (int)OuterSpace.ClientArea.Width;
     //Right
     mapArea[0].Y = 0;
     //Top
     mapArea[0].X = (int)(OuterSpace.ClientArea.Width * xScale);
     //Left
     resizeButton = new SpriteClass("resizeButton.bmp", 35, 35, Convert.ToInt32(-16777216));
     resizeButton.sourceFrame[0] = new System.Drawing.Rectangle(0, 0, 35, 35);
     resizeButtonColor           = Color.FromArgb(75, 255, 255, 255);
     resizing = false;
 }
Ejemplo n.º 6
0
        public void Start()
        {
            if (RotatingPlanetMesh == null)
            {
                RotatingPlanetMesh = new MeshObject("title_planet.x");
                bgSprite           = new SpriteClass("title_bg.jpg", 1024, 768);
                fgSprite           = new SpriteClass("title_fg.bmp", 1024, 256);
            }

            if (OuterSpace.theWindowMgr.FindWindow(" ") == -1)
            {
                if (OuterSpace.theWindowMgr.LoadWindow("CTitleWindow", options.GetScreenWidth() - 200, 0, 150, options.GetScreenHeight(), Color.FromArgb(255, 255, 255, 255)) == true)
                {
                    OuterSpace.theWindowMgr.DoModal(OuterSpace.theWindowMgr.FindWindow(" "));
                }
            }

            bStarted = true;
        }
Ejemplo n.º 7
0
        // *** Initialize Game Sprites ***
        private void InitializeSprites()
        {
            Random rnd = new Random();

            // Describes a surface
            try
            {
                int i;

                textfont.InitializeDeviceObjects(device);
                linkfont.InitializeDeviceObjects(device);

                shields = new SpriteClass("sheild.bmp", 150, 150, Color.FromArgb(255,0,0,0).ToArgb());
                shields.sourceFrame[0] = new Rectangle(0, 0, 150, 150);

                atmosphere = new SpriteClass("atmosphere.bmp", 410, 400, Color.FromArgb(255,0,0,0).ToArgb());
                atmosphere.sourceFrame[0] = new Rectangle(0, 0, 410, 400);

                starship = new SpriteClass("starship.bmp", 122, 94, Color.FromArgb(255,0,0,0).ToArgb());
                starship.sourceFrame[0] = new Rectangle(0, 0, 122, 94);

                menuback = new SpriteClass("menuback.bmp", 193, 140, Color.FromArgb(255,0,0,0).ToArgb());
                menuback.sourceFrame[0] = new Rectangle(0, 0, 193, 140);

                sun = new SpriteClass("sun.bmp", 44, 44, Color.FromArgb(255,0,0,0).ToArgb());
                sun.sourceFrame[0] = new Rectangle(0, 0, 44, 44);

                pointer = new SpriteClass("pointer.bmp", 75, 30, Color.FromArgb(255,0,0,0).ToArgb());
                pointer.sourceFrame[0] = new Rectangle(0, 0, 15, 30);
                pointer.sourceFrame[1] = new Rectangle(15, 0, 30, 30);
                pointer.sourceFrame[2] = new Rectangle(45, 0, 30, 30);

                smallship = new SpriteClass("smallship.bmp", 31, 24, Color.FromArgb(255,0,0,0).ToArgb());
                smallship.sourceFrame[0] = new Rectangle(0, 0, 31, 24);

                msgboxboarder = new SpriteClass("msgboxboarder.bmp", 48, 48, Color.FromArgb(255,0,0,0).ToArgb());
                for (i = 0; i < 8; i++)
                {
                    System.Drawing.Point p = new System.Drawing.Point((i % 3) * 16, Convert.ToInt32(i / 3) * 16);
                    msgboxboarder.sourceFrame[i] = new System.Drawing.Rectangle(p.X, p.Y, 16, 16);
                }

                windowbackground = new SpriteClass("windowbackground.bmp", 48, 48, Color.FromArgb(255,0,0,0).ToArgb());
                for (i = 0; i < 8; i++)
                {
                    System.Drawing.Point p = new System.Drawing.Point((i % 3) * 16, Convert.ToInt32(i / 3) * 16);
                    windowbackground.sourceFrame[i] = new System.Drawing.Rectangle(p.X, p.Y, 16, 16);
                }

                planetsprite = new SpriteClass("planetmap.bmp", 200, 275, Color.FromArgb(255,0,0,0).ToArgb());

                solarsystem = new SpriteClass("solarsystem.bmp", 1024, 128, Color.FromArgb(255,0,0,0).ToArgb());
                solarsystem.curframe = 0;
                for (i = 0; i < 8; i++)
                {
                    Point p = new Point(i * 128, 0);
                    solarsystem.sourceFrame[i] = new Rectangle(p.X, p.Y, 128, 128);
                }

                backstars = new SpriteClass("backstars.bmp", 56, 6, Color.FromArgb(255,0,0,0).ToArgb());
                for (i = 0; i < 8; i++)
                {
                    backstars.sourceFrame[i] = new Rectangle(i * 7, 0, 6, 6);
                }

                for (i = 1; i < MAXSTARS; i++)
                {
                    stars[i].starFrame = Convert.ToInt32(6 * rnd.NextDouble());
                    stars[i].X = Convert.ToInt32((ClientArea.Width + 1) * rnd.NextDouble());
                    stars[i].Y = Convert.ToInt32((ClientArea.Height + 1) * rnd.NextDouble());
                }

                //stars[0] = null;
                // Used to store the movement velocity
            }
            //of the stars when they scroll.
            catch (DirectXException )
            {
                MessageBox.Show("Could not initialize Direct3D. This game will exit.");
            }
        }
Ejemplo n.º 8
0
        public void Start()
        {
            if (RotatingPlanetMesh == null)
            {
                RotatingPlanetMesh = new MeshObject("title_planet.x");
                bgSprite = new SpriteClass("title_bg.jpg", 1024, 768);
                fgSprite = new SpriteClass("title_fg.bmp", 1024, 256);
            }

            if (OuterSpace.theWindowMgr.FindWindow(" ") == -1)
            {
                if (OuterSpace.theWindowMgr.LoadWindow("CTitleWindow", options.GetScreenWidth() - 200, 0, 150, options.GetScreenHeight(), Color.FromArgb(255, 255, 255, 255)) == true)
                {
                    OuterSpace.theWindowMgr.DoModal(OuterSpace.theWindowMgr.FindWindow(" "));
                }
            }

            bStarted = true;
        }
Ejemplo n.º 9
0
        public void LoadSprite(int spriteNum, string spriteFile, int width, int height, int colorKey)
        {
            switch (spriteNum)
            {
                case 1:
                    BackgroundSprite = new SpriteClass(spriteFile, width, height, colorKey);
                    for (int i = 0; i < 9; i++)
                    {
                        Point pt = new Point((i % 3) * 16, (int)(i / 3) * 16);
                        BackgroundSprite.sourceFrame[i] = new Rectangle(pt.X, pt.Y, 16, 16);
                    }
                    break;
                case 2:
                    CornerSprite[0] = new SpriteClass(spriteFile, width, height, colorKey);
                    break;
                case 3:
                    CornerSprite[1] = new SpriteClass(spriteFile, width, height, colorKey);
                    break;
                case 4:
                    CornerSprite[2] = new SpriteClass(spriteFile, width, height, colorKey);
                    break;
                case 5:
                    CornerSprite[3] = new SpriteClass(spriteFile, width, height, colorKey);
                    break;
                case 6:
                    BorderSprite[0] = new SpriteClass(spriteFile, width, height, colorKey);
                    break;
                case 7:
                    BorderSprite[1] = new SpriteClass(spriteFile, width, height, colorKey);
                    break;
                case 8:
                    BorderSprite[2] = new SpriteClass(spriteFile, width, height, colorKey);
                    break;
                case 9:
                    BorderSprite[3] = new SpriteClass(spriteFile, width, height, colorKey);
                    break;
                case 10:
                    CaptionSprite = new SpriteClass(spriteFile, width, height, colorKey);
                    break;
            }

            IsSpriteLoaded[spriteNum - 1] = true;
        }