Example #1
0
        protected override void Load()
        {
            AddComponent(new BackgroundComponent(Engine.Content.Load<Texture2D>("content/GUI/blackbackground")));

            Label helpText = new Label(Engine.Content.Load<SpriteFont>("content/fonts/MenuFont"), Engine.SpriteBatch);
            helpText.Text = "Use Arrow-Keys to move the character \nUse escape to quit current screen \nUse Enter to accept selected choice";
            helpText.Position = new Vector2(Engine.GraphicsDevice.PresentationParameters.BackBufferWidth/4, Engine.GraphicsDevice.PresentationParameters.BackBufferHeight / 3);
            AddControl(helpText);
            base.Load();
        }
Example #2
0
 protected override void Load()
 {
     SpriteFont spriteFont = Engine.Content.Load<SpriteFont>("Content/Fonts/Georgia");
     label = new Label(spriteFont, Engine.SpriteBatch);
     label.Text = "PRESS START TO BEGIN";
     label.Size = spriteFont.MeasureString(label.Text);
     label.Position = new Vector2(
     (Engine.GameRef.Window.ClientBounds.Width - label.Size.X) / 2,
     (int)((Engine.GameRef.Window.ClientBounds.Height - label.Size.Y) / 2));
     Controls.Add(label);
     base.Load();
 }
        protected override void Load()
        {
            BackgroundComponent bgComponent = new BackgroundComponent(Engine.Content.Load < Texture2D > ("Content/GUI/blackbackground"));
            SpriteFont spriteFont = Engine.Content.Load<SpriteFont>("Content/Fonts/MenuFont");
            Texture2D leftArrow = Engine.Content.Load<Texture2D>("Content/Controls/leftarrow");
            Texture2D rightArrow = Engine.Content.Load<Texture2D>("Content/Controls/rightarrow");
            Label label1 = new Label(spriteFont, Engine.SpriteBatch);

            AddComponent(bgComponent);
            label1.Text = "Make your Character";
            label1.Size = spriteFont.MeasureString(label1.Text);
            label1.Position = new Vector2((Engine.GameRef.Window.ClientBounds.Width - label1.Size.X) / 2, 100);
            Controls.Add(label1);

            genderSelector = new LeftRightSelector(
            spriteFont,
            leftArrow,
            rightArrow, Engine.SpriteBatch);
            genderSelector.SetItems(genderItems, 125);
            genderSelector.Position = new Vector2(label1.Position.X, 150);
            Controls.Add(genderSelector);

            classSelector = new LeftRightSelector(
            spriteFont,
            leftArrow,
            rightArrow, Engine.SpriteBatch);
            classSelector.SetItems(classItems, 125);
            classSelector.Position = new Vector2(label1.Position.X, 200);
            Controls.Add(classSelector);

            Label labelName = new Label(spriteFont, Engine.SpriteBatch);
            labelName.Text = "Name: ";
            labelName.Size = spriteFont.MeasureString(labelName.Text);
            labelName.Position = new Vector2(label1.Position.X, 270);
            Controls.Add(labelName);

            TextBox textbox = new TextBox(spriteFont, Engine.Content, Engine.SpriteBatch);
            textbox.Position = new Vector2(label1.Position.X, 320);
            Controls.Add(textbox);

            LinkLabel linkLabel1 = new LinkLabel(spriteFont, Engine.SpriteBatch);
            linkLabel1.Text = "Accept this character";
            linkLabel1.Position = new Vector2(textbox.Position.X, 370);
            Controls.Add(linkLabel1);

            linkLabel1.Selected += new EventHandler(linkLabel1_Selected);
            Controls.NextControl();
            base.Load();
        }
Example #4
0
        protected override void Load()
        {
            // TODO: Test worked, no just put it to use content pipeline

            // Load each tile used in map and ask for a TileList
            TileLoader loader = new TileLoader("Content/XMLmap/testi.xml", Engine.Content);
            TileList list = loader.GetTileList();

            // Load all the layers from file and ask for a maplayer list
            LayerLoader layerLoader = new LayerLoader("Content/XMLmap/layertesti.xml", list);
            List<MapLayer> layers = layerLoader.GetLayerList();

            tileEngine = new TileEngine(32, 32, Engine.GameRef);

            // Make map with all those layers
            Session.CurrentMap = new TileMap(layers);

            // Add components and controls etc
            animations = new Dictionary<AnimationKey, Animation>(); ;
            Texture2D playerTexture = Engine.Content.Load<Texture2D>("content/Sprites/malefighter");
            Animation animation = new Animation(3, 28, 28, 0, 0);
            animations.Add(AnimationKey.Down, animation);
            animation = new Animation(3, 28, 28, 0, 28);
            animations.Add(AnimationKey.Left, animation);
            animation = new Animation(3, 28, 28, 0, 56);
            animations.Add(AnimationKey.Right, animation);
            animation = new Animation(3, 28, 28, 0, 84);
            animations.Add(AnimationKey.Up, animation);
            playerSprite = new AnimatedSprite(playerTexture, animations);
            playerSprite.IsAnimating = true;

            AddComponent(playerSprite);

            SpriteFont spriteFont = Engine.Content.Load<SpriteFont>("Content/Fonts/Georgia");

            Label text = new Label(spriteFont, Engine.SpriteBatch);
            text.Text = "HakaGame 1.0";
            text.Size = spriteFont.MeasureString(text.Text);
            text.Position = new Vector2(100, 100);
            Controls.Add(text);
            base.Load();
        }