Beispiel #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            bombTexture = Content.Load<Texture2D>("Textures/Bomb");      // Load the texture
            textFont = Content.Load<SpriteFont>("Fonts/SegoeUI");    // Load the font
            torus = new ModelObject();
            torus.Model = Content.Load<Model>("Models/Cube");
            torus.Texture = Content.Load<Texture2D>("Textures/Stripes");
            torus.Scale *= 5;

            mercury = new Planet();
            mercury.Parent = torus;
            mercury.RevolutionRate = MathHelper.PiOver2;
            mercury.Radius = 10;
            mercury.Scale *= 2;
            mercury.Model = torus.Model;
            mercury.Texture = torus.Texture;

            // TODO: use this.Content to load your game content here
            camera = new Camera();
            camera.Position = new Vector3(0, 0, -20);
            camera.AspectRatio = GraphicsDevice.Viewport.AspectRatio;

            plane = new Common.Plane(99);
            plane.Texture = Content.Load<Texture2D>("Textures/Jellyfish");
            plane.Scale *= 50;
            //plane.RotateX = 0.50f;
            plane.Position = new Vector3(0, -5, 0);

            UIElement background = new UIElement(Content.Load<Texture2D>("Textures/Jellyfish"),
                                    GraphicsDevice.Viewport.Bounds);
            ButtonGroup group = new ButtonGroup();
            group.Children.Add(new Button(Content.Load<Texture2D>("Textures/Stripes"),
                                new Rectangle(40,40,200,25),
                                Content.Load<Texture2D>("Textures/Bomb"),
                                "Play",textFont));

            group.Children.Add(new Button(Content.Load<Texture2D>("Textures/Stripes"),
                                new Rectangle(40,80,200,25),
                                Content.Load<Texture2D>("Textures/Bomb"),
                                "Information",textFont));

            group.Children.Add(new Button(Content.Load<Texture2D>("Textures/Stripes"),
                                new Rectangle(40,120,200,25),
                                Content.Load<Texture2D>("Textures/Bomb"),
                                "Credits",textFont));

            group.Children.Add(new Button(null,
                                new Rectangle(40,160,200,25),
                                Content.Load<Texture2D>("Textures/Bomb"),
                                "Quit",textFont));
            group.Children[0].Clicked += StartNewGame;
            group.Children[3].Clicked += EndGame;
            background.Children.Add(group);

            elements[GameState.Start] = background;
            elements[GameState.Play] = new UIElement();
            elements[GameState.Pause] = background;

            effect = new BasicEffect(GraphicsDevice);
        }
Beispiel #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            bombTexture = Content.Load<Texture2D>("Textures/Bomb");      // Load the texture
            textFont = Content.Load<SpriteFont>("Fonts/SegoeUI");    // Load the font
            torus = new ModelObject();
            torus.Model = Content.Load<Model>("Models/Cube");
            torus.Texture = Content.Load<Texture2D>("Textures/Stripes");
            torus.Scale *= 5;

            mercury = new Planet();
            mercury.Parent = torus;
            mercury.RevolutionRate = MathHelper.PiOver2;
            mercury.Radius = 10;
            mercury.Scale *= 2;
            mercury.Model = torus.Model;
            mercury.Texture = torus.Texture;

            // TODO: use this.Content to load your game content here
            camera = new Camera();
            camera.Position = new Vector3(0, 0, -20);
            camera.AspectRatio = GraphicsDevice.Viewport.AspectRatio;

            plane = new Common.Plane(99);
            plane.Texture = Content.Load<Texture2D>("Textures/Jellyfish");
            plane.Scale *= 50;
            //plane.RotateX = 0.50f;
            plane.Position = new Vector3(0, -5, 0);

            effect = new BasicEffect(GraphicsDevice);
        }