Inheritance: XGControl
Esempio n. 1
0
        public frmSettings(AzmythGame game, GraphicsDeviceManager graphics)
            : base(new Rectangle(0, 0, 300, 300), true)
        {
            Game = game;
            m_graphicsManager = graphics;

            Rectangle = new Rectangle((game.GraphicsDevice.Viewport.Width / 2)-150, (game.GraphicsDevice.Viewport.Height / 2) - 120, 300, 240);

            XnaGUIManager.Controls.Add(this);

            pnlMain = new XGPanel(new Rectangle(0, 0, 300, 240));
            lstResolutions = new XGListBox(new Rectangle(10, 10, 280, 150));

            foreach (DisplayMode mode in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes)
            {
                if(mode.Width >= 800 && mode.Height >=600)
                lstResolutions.Items.Add(mode.Width + " x " + mode.Height);
            }

            lstResolutions.SelectedIndex = 0;
            chkFullScreen = new XGCheckBox(new Rectangle(10, 170, 25, 25), "Fullscreen");
            chkFullScreen.Checked = false;

            btnApply = new XGButton(new Rectangle(300-220, 200, 100, 30), "Apply", this.btnApply_Clicked);
            btnExit = new XGButton(new Rectangle(300-110, 200, 100, 30), "Exit", this.btnExit_Clicked);

            Children.Add(pnlMain);
            pnlMain.Children.Add(lstResolutions);
            pnlMain.Children.Add(chkFullScreen);
            pnlMain.Children.Add(btnApply);
            pnlMain.Children.Add(btnExit);
        }
Esempio n. 2
0
        public frmMainMenu(AzmythGame game)
            : base(new Rectangle(0, 0, 300, 300), true)
        {
            Game = game;

            Rectangle = new Rectangle((game.GraphicsDevice.Viewport.Width / 2)-150, (game.GraphicsDevice.Viewport.Height / 2) - 105, 300, 210);

            XnaGUIManager.Controls.Add(this);

            pnlMain = new XGPanel(new Rectangle(0, 0, 300, 210));
            btnCreateWorld = new XGButton(new Rectangle(10, 10, 280, 30), "Create World", this.btnCreateWorld_Clicked);
            btnSaveWorld = new XGButton(new Rectangle(10, 50, 280, 30), "Save World", this.btnCreateWorld_Clicked);
            btnLoadWorld = new XGButton(new Rectangle(10, 90, 280, 30), "Load World", this.btnCreateWorld_Clicked);
            btnSettings = new XGButton(new Rectangle(10, 130, 280, 30), "Settings", this.btnSettings_Clicked);
            btnExit = new XGButton(new Rectangle(10, 170, 280, 30), "Exit", this.btnExit_Clicked);

            pnlMain.CanFocus = false;
            btnSaveWorld.Enabled = false;
            btnLoadWorld.Enabled = false;

            Children.Add(pnlMain);

            pnlMain.Children.Add(btnCreateWorld);
            pnlMain.Children.Add(btnSaveWorld);
            pnlMain.Children.Add(btnLoadWorld);
            pnlMain.Children.Add(btnSettings);
            pnlMain.Children.Add(btnExit);

            focusControl = pnlMain;

            this.ActivateFirst();
        }
Esempio n. 3
0
        //private XGListBoxItem liPerlin = new XGListBoxItem("Perlin Noise", NoiseTypes.Perlin);
        //private XGListBoxItem liSimplex = new XGListBoxItem("Simplex Noise", NoiseTypes.Simplex);
        public frmCreatePlayer(AzmythGame game)
            : base(new Rectangle(0, 0, 300, 300), true)
        {
            Game = game;
            m_viewport = game.GraphicsDevice.Viewport;

            Rectangle = new Rectangle(0, 0, m_viewport.Width, m_viewport.Height);

            m_world = new World(new VectorID(1, 1), new Random().Next(500, 9999));

            XnaGUIManager.Controls.Add(this);

            pnlMain             = new XGPanel(        new Rectangle(20, 20, 600, 600));
            pnlTitle            = new XGPanel(        new Rectangle(20, 20, 600, 600));
            lblTitle            = new XGLabel(        new Rectangle(20, 30, 50, 30), "Generate a New Adventure");
            lblPlayerName        = new XGLabel(        new Rectangle(20, 20, 100, 30), "Name:");
            txtPlayerName        = new XGTextBox(      new Rectangle(140, 20, pnlMain.Rectangle.Width- 300 , 30));
            btnRandomName       = new XGButton(       new Rectangle(pnlMain.Rectangle.Width, 20, 125, 30), "Random Name", this.btnRandomName_Clicked);
            btnCreatePlayer     = new XGButton(       new Rectangle(m_viewport.Width - 210, m_viewport.Height - 40, 200, 30), "Create World", this.btnCreatePlayer_Clicked);

            pnlMain.CanFocus = false;
            lblPlayerName.CanFocus = false;

            nameGenerator = new MarkovNameGenerator("Acalia,Aldaire,Aldebron,Vulcan,Earth,Romulus,Andor,Adair,Adara,Adriel,Alaire,Alixandra,Altair,Amara,Anatola,Arcadia,Aurelia,Aurelian,Aurelius,Avalon,Bastian,Breen,Briallan,Brielle,Briseis,Cambria,Caspian,Cassia,Cassiel,Cassiopeia,Cassius,Chaniel,Cora,Corbin,Cyprian,Dagen,Daire,Darius,Destin,Devlin,Devlyn,Drake,Drystan,Eira,Eirian,Eliron,Elysia,Eoin,Evadne,Evanth,Fineas,Finian,Fyodor,Gaerwn,Gareth,Gavriel,Ginerva,Griffin,Guinevere,Hadriel,Hannelore,Hermione,Hesperos,Iagan,Ianthe,Ignacia,Ignatius,Iseult,Isolde,Jessalyn,Kara,Katriel,Kerensa,Korbin,Kyler,Kyra,Kyrielle,Leala,Leila,Leira,Lilith,Liora,Liriene,Liron,Lucien,Lyra,Maia,Marius,Mathieu,Maylea,Meira,Mireille,Mireya,Natania,Neirin,Nerys,Nuriel,Nyfain,Nyssa,Oisin,Oleisa,Oralie,Orinthea,Orion,Orpheus,Ozara,Peregrine,Persephone,Perseus,Petronela,Phelan,Pryderi,Pyralia,Pyralis,Qadira,Quinevere,Quintessa,Raisa,Remus,Renfrew,Rhyan,Rhydderch,Riona,Saira,Saoirse,Sarai,Sarielle,Sebastian,Seraphim,Seraphina,Serian,Sirius,Sorcha,Severin,Tavish,Tearlach,Terra,Thalia,Thaniel,Theia,Torian,Torin,Tressa,Tristana,Ulyssia,Uriela,Urien,Vanora,Vasilis,Vespera,Xanthus,Xara,Xylia,Yadira,Yakira,Yeira,Yeriel,Yestin,Yseult,Zaira,Zaniel,Zarek,Zephyr,Zora,Zorion".Split(','), 3);

            lblTitle.Alignment = GUIAlignment.HCenter | GUIAlignment.VCenter;
            txtPlayerName.Text = Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(nameGenerator.Next());

            Children.Add(pnlMain);
            Children.Add(pnlTitle);
            pnlTitle.Children.Add(lblTitle);
            pnlMain.Children.Add(lblPlayerName);
            pnlMain.Children.Add(txtPlayerName);
            pnlMain.Children.Add(btnRandomName);
            pnlMain.Children.Add(btnCreatePlayer);

            focusControl = pnlMain;

            pnlMain.ActivateFirst();

            XnaGUIManager.ActivateNext();
        }