Example #1
0
        private void SetupUsernameMenu()
        {
            UsernameLabel = new Gwen.Control.Label(BaseCanvas);
            UsernameLabel.SetText("Enter Desired Username" +
                                  "\n(This is how your score will be represented in the Highscores page.)" +
                                  "\n(Name must be between 1 and 16 characters, and be ASCII encodable.(0-9, a-Z))");
            UsernameLabel.AutoSizeToContents = true;
            UsernameLabel.SetPosition(300, 150);

            UsernameBox = new Gwen.Control.TextBox(BaseCanvas);
            UsernameBox.SetSize(180, 35);
            UsernameBox.SetPosition(300, 200);

            UsernameContinue = new Gwen.Control.Button(BaseCanvas);
            UsernameContinue.SetText("Continue");
            UsernameContinue.SetSize(150, 30);
            UsernameContinue.SetPosition(300, 260);
            UsernameContinue.Clicked += (B, Args) =>
            {
                if (UsernameBox.Text != "" && UsernameBox.Text.Length <= 16)
                {
                    ActiveScreen = Screen.Menu;
                }
            };
        }
Example #2
0
        public void SetupMenu()
        {
            SingleplayerButton = new Gwen.Control.Button(BaseCanvas);
            SingleplayerButton.SetText("Singleplayer");
            SingleplayerButton.SetSize(300, 100);
            SingleplayerButton.SetPosition(200, 100);
            SingleplayerButton.Clicked += (B, Args) =>
            {
                ActiveScreen      = Screen.Game;
                ActiveSessionType = SessionType.Singleplayer;
            };

            MultiplayerButton = new Gwen.Control.Button(BaseCanvas);
            MultiplayerButton.SetText("Multiplayer");
            MultiplayerButton.SetSize(300, 100);
            MultiplayerButton.SetPosition(200, 240);
            MultiplayerButton.Clicked += (B, Args) =>
            {
                ActiveScreen      = Screen.NetworkedSessionMenu;
                ActiveSessionType = SessionType.Multiplayer;
            };

            HighscoresButton = new Gwen.Control.Button(BaseCanvas);
            HighscoresButton.SetText("Highscores");
            HighscoresButton.SetSize(300, 100);
            HighscoresButton.SetPosition(200, 380);
            HighscoresButton.Clicked += (B, Args) =>
            {
                GetHighscoresCallback();
                ActiveScreen = Screen.Highscores;
            };
        }
Example #3
0
        public ControlToolbox(Gwen.Control.Base parent)
            : base(parent)
        {
            Width = 150;
            Margin = new Gwen.Margin( 5, 5, 5, 5 );
            SetText( "Controls" );

            var pTileLayout = new Gwen.Control.Layout.Tile( this );
            pTileLayout.SetTileSize(22, 22);

            foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
                foreach (var controlType in assembly.GetTypes().Where<Type>(type => type.IsSubclassOf(typeof(Gwen.Control.Base))))
                {

                    if (controlType == typeof(DesignerBase)) continue;

                    var pButton = new Gwen.Control.Button(pTileLayout);
                    pButton.SetSize( 20, 20 );
                    pButton.SetToolTipText(controlType.Name);
                    //pButton.SetImage("img/controls/" + controlType.Name + ".png");
                    pButton.ShouldDrawBackground = true;

                    //
                    // Make drag and droppable. Pass the ControlFactory as the userdata
                    //
                    pButton.DragAndDrop_SetPackage(true, "ControlSpawn", controlType);//,pControlFactory );
                }
        }
Example #4
0
        public ControlToolbox(Gwen.Control.Base parent)
            : base(parent)
        {
            Width  = 150;
            Margin = new Gwen.Margin(5, 5, 5, 5);
            SetText("Controls");

            var pTileLayout = new Gwen.Control.Layout.Tile(this);

            pTileLayout.SetTileSize(22, 22);

            foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                foreach (var controlType in assembly.GetTypes().Where <Type>(type => type.IsSubclassOf(typeof(Gwen.Control.Base))))
                {
                    if (controlType == typeof(DesignerBase))
                    {
                        continue;
                    }

                    var pButton = new Gwen.Control.Button(pTileLayout);
                    pButton.SetSize(20, 20);
                    pButton.SetToolTipText(controlType.Name);
                    //pButton.SetImage("img/controls/" + controlType.Name + ".png");
                    pButton.ShouldDrawBackground = true;

                    //
                    // Make drag and droppable. Pass the ControlFactory as the userdata
                    //
                    pButton.DragAndDrop_SetPackage(true, "ControlSpawn", controlType);//,pControlFactory );
                }
            }
        }
Example #5
0
        public void SetupNetworkedSessionMenu()
        {
            ServerSelectorLabel = new Gwen.Control.Label(BaseCanvas);
            ServerSelectorLabel.SetText("Server");
            ServerSelectorLabel.AutoSizeToContents = true;
            ServerSelectorLabel.SetPosition(50, 0);

            ServerSelector = new Gwen.Control.ComboBox(BaseCanvas);
            ServerSelector.AddItem("Server A");
            ServerSelector.AddItem("Server B");
            ServerSelector.AddItem("Server C");
            ServerSelector.AddItem("Server D");
            ServerSelector.AddItem("Server E");
            ServerSelector.AddItem("Server F");
            ServerSelector.AddItem("Server G");
            ServerSelector.AddItem("Server H");
            ServerSelector.AddItem("Server I");
            ServerSelector.AddItem("Server J");
            ServerSelector.AddItem("Custom Server...");
            ServerSelector.SetSize(200, 50);
            ServerSelector.SetPosition(50, 20);
            ServerSelector.TextColor = Color.Black;
            ServerSelector.UpdateColors();

            CustomServerLabel = new Gwen.Control.Label(BaseCanvas);
            CustomServerLabel.SetText("Address                                           Port");
            CustomServerLabel.AutoSizeToContents = true;
            CustomServerLabel.SetPosition(50, 180);

            CustomServerAddress = new Gwen.Control.TextBox(BaseCanvas);
            CustomServerAddress.SetSize(200, 30);
            CustomServerAddress.SetPosition(50, 200);

            CustomServerPort = new Gwen.Control.TextBox(BaseCanvas);
            CustomServerPort.SetSize(70, 30);
            CustomServerPort.SetPosition(254, 200);

            SessionConnect = new Gwen.Control.Button(BaseCanvas);
            SessionConnect.SetText("Connect");
            SessionConnect.SetSize(200, 50);
            SessionConnect.SetPosition(260, 380);
            SessionConnect.Clicked += (B, Args) =>
            {
                ActiveScreen = Screen.Connecting;
            };

            BackButton = new Gwen.Control.Button(BaseCanvas);
            BackButton.SetText("Back");
            BackButton.AutoSizeToContents = true;
            BackButton.SetPosition(50, 450);
            BackButton.Clicked += (B, Args) =>
            {
                ActiveScreen = Screen.Menu;
            };
        }
Example #6
0
 private void LoadPowders()
 {
     _bottomMenuBox.DeleteAllChildren();
     Gwen.Control.Button _sandButton = new Gwen.Control.Button(_bottomMenuBox);
     _sandButton.Font.Size = 12;
     _sandButton.SetSize(80, 28);
     _sandButton.SetText("Sand");
     _sandButton.SetToolTipText("Sand");
     _sandButton.SetPosition(2, 7);
     _sandButton.Name     = "SandElement";
     _sandButton.Clicked += OnButtonClick;
 }
Example #7
0
        private void LoadElementCatagories()
        {
            Gwen.Control.Button _powdersButton = new Gwen.Control.Button(_sideMenuBox);
            _powdersButton.Font      = _powdersButton.Font.Copy();
            _powdersButton.Font.Size = 8;
            _powdersButton.SetSize(80, 20);
            _powdersButton.SetToolTipText("Powders");
            _powdersButton.SetText("Powders");
            _powdersButton.SetPosition(0, 0);
            _powdersButton.Name     = "PowdersMenu";
            _powdersButton.Clicked += OnButtonClick;

            Gwen.Control.Button _liquidsButton = new Gwen.Control.Button(_sideMenuBox);

            _liquidsButton.Font      = _liquidsButton.Font.Copy();
            _liquidsButton.Font.Size = 8;
            _liquidsButton.SetSize(80, 20);
            _liquidsButton.SetToolTipText("Liquids");
            _liquidsButton.SetText("Liquids");
            _liquidsButton.SetPosition(0, 22);
            _liquidsButton.Name     = "LiquidsMenu";
            _liquidsButton.Clicked += OnButtonClick;
        }
Example #8
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     m_testButton = new Gwen.Control.Button(m_glRenderBuffer.GetCanvas());
     m_testButton.SetPosition(0, 0);
     m_testButton.SetSize(1, 1);
 }