Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
 public override void SetY(float value)
 {
     image.SetY(value);
 }