コード例 #1
0
ファイル: MainMenu.cs プロジェクト: jl4312/Meteor-Freeze
        public MainMenu(Game game, EffectRenderer renderer, StateManager parent)
            : base(game, renderer, parent)
        {
            titlePic = new Picture(game, guiManager, gameRef.Content.Load<Texture2D>("Gui/button-up"));
            characterPic = new Picture(game, guiManager, gameRef.Content.Load<Texture2D>("Freezling"));

            guiManager.AddPicture("titlePic", gameRef.Content.Load<Texture2D>("Gui/button-up"));
            guiManager["titlePic"].Position = new Vector2(400, 40.0f);
            guiManager["titlePic"].Size = new Vector2(400, 100);

            guiManager.AddButton("btnPlay", "Play", 60, guiManager["titlePic"].Position.Y + 100, 300, 75);
            guiManager.AddButton("btnSurvival", "Survival", 60, guiManager["btnPlay"].Position.Y + 100, 300, 75);
            guiManager.AddButton("btnRules", "Rules", 60, guiManager["btnSurvival"].Position.Y + 100, 300, 75);
            guiManager.AddButton("btnOptions", "Options", 60, guiManager["btnRules"].Position.Y + 100, 300, 75);
            guiManager.AddButton("btnExit", "Exit", 60, guiManager["btnOptions"].Position.Y + 100, 300, 75);

            guiManager.AddPicture("characterPic", gameRef.Content.Load<Texture2D>("Freezling"));
            guiManager["characterPic"].Position = new Vector2(guiManager["titlePic"].Position.X + 75, guiManager["titlePic"].Position.Y + 225);
            guiManager["characterPic"].Size = new Vector2(450, 450);

            btnPlay = guiManager["btnPlay"] as Button;
            btnPlay.Click += (control, button) =>
                {
                    GameState Play = this.parent[GameStateType.Playing];
                    if (Play != null)
                    {
                        this.parent.PushState(Play);

                        Play playState = new Play(this.gameRef, this.renderer, this.parent);
                        playState.Initialize();
                        this.parent.PushState(playState);

                    }

                };

            btnOptions = guiManager["btnOptions"] as Button;
            btnOptions.Click += (control, button) =>
            {
                GameState Options = this.parent[GameStateType.OptionsMenu];
                if (Options != null)
                {
                    this.parent.PushState(Options);

                    EndState endState = new EndState(this.gameRef, this.renderer, this.parent);
                    endState.Initialize();
                    this.parent.PushState(endState);

                }

            };

            btnExit = guiManager["btnExit"] as Button;
            btnExit.Click += (control, button) =>
            {
                gameRef.Exit();
            };
        }
コード例 #2
0
ファイル: BoundingBox.cs プロジェクト: jl4312/Meteor-Freeze
 /// <summary>
 /// Creates a new picture box.
 /// </summary>
 /// <param name="game">The game this control belongs to.</param>
 /// <param name="image">The image.</param>
 public BoundingBox(Game game, GuiManager manager)
     : base(game, manager)
 {
     this.image = game.Content.Load<Texture2D>("Graphics/GUI/BoundingBox");
     characterIcon = null;
 }
コード例 #3
0
ファイル: GuiManager.cs プロジェクト: jl4312/Meteor-Freeze
 public void AddPicture(string name, Texture2D image)
 {
     Picture picture = new Picture(game, this, image);
     picture.Name = name;
     controls[name] = picture;
 }
コード例 #4
0
ファイル: GuiManager.cs プロジェクト: jl4312/Meteor-Freeze
 public void AddPicture(string name, Texture2D image, Vector2 loc, Boolean movable)
 {
     Picture picture = new Picture(game, this, image);
     picture.PermanentPosition = loc;
     picture.Name = name;
     picture.Movable = true;
     controls[name] = picture;
 }
コード例 #5
0
ファイル: BoundingBox.cs プロジェクト: jl4312/Meteor-Freeze
 /// <summary>
 /// Creates a new picture box.
 /// </summary>
 /// <param name="game">The game this control belongs to.</param>
 /// <param name="image">The image.</param>
 public BoundingBox(Game game, GuiManager manager)
     : base(game, manager)
 {
     this.image    = game.Content.Load <Texture2D>("Graphics/GUI/BoundingBox");
     characterIcon = null;
 }