Beispiel #1
0
 protected GBaseButton(IGame game) : base(game)
 {
     image = new GImage(game);
     image.SetScaleX(1f);
     image.SetScaleY(1f);
     IsVisible = true;
 }
Beispiel #2
0
        public GTopPanel(IGame game) : base(game)
        {
            buttons = new List <GBaseButton>();

            BackgroundImage = new GImage(game);
            BackgroundImage.SetX(game.GetWindowWidth() / 2);
            BackgroundImage.SetY(15);
            BackgroundImage.SetHeight(30);
            BackgroundImage.SetWidth(game.GetWindowWidth());
            BackgroundImage.SetImage(GameResource.rect_2);

            CreateButton(30, 15, 15, GameResource.button_menu).onClick += (e) =>
            {
                onCommand?.Invoke(CommandTopPanel.menu);
            };
            CreateButton(game.GetWindowWidth() - 45, 15, 15, GameResource.button_pause).onClick += (e) =>
            {
                buttons[1].SetVisible(false);
                buttons[2].SetVisible(true);

                onCommand?.Invoke(CommandTopPanel.pause);
            };
            CreateButton(game.GetWindowWidth() - 45, 15, 15, GameResource.button_play).onClick += (e) =>
            {
                buttons[1].SetVisible(true);
                buttons[2].SetVisible(false);

                onCommand?.Invoke(CommandTopPanel.play);
            };
            buttons[buttons.Count - 1].SetVisible(false);

            stringFormat               = new StringFormat();
            stringFormat.Alignment     = StringAlignment.Center;
            stringFormat.LineAlignment = StringAlignment.Center;
            font       = new Font("Calibri", 13f, FontStyle.Bold);
            solidBrush = new SolidBrush(Color.White);
        }
Beispiel #3
0
 public void SetImage(GImage image)
 {
     this.image = image;
 }