コード例 #1
0
 public State()
 {
     if (gui == null)
     {
         inputListener = new InputListenerComponent(GameApp);
         inputManager  = new MonoGame.Extended.NuclexGui.GuiInputService(inputListener);
         gui           = new GuiManager(GameApp.Services, inputManager);
         gui.Initialize();
     }
     gui.Screen = new GuiScreen();
 }
コード例 #2
0
ファイル: TitleState.cs プロジェクト: lkingsford/7drl18
        public TitleState()
        {
            background = AppContentManager.Load <Texture2D>("Title/Title");


            if (gui == null)
            {
                inputListener = new InputListenerComponent(GameApp);
                inputManager  = new MonoGame.Extended.NuclexGui.GuiInputService(inputListener);
                gui           = new GuiManager(GameApp.Services, inputManager);
                gui.Initialize();
            }
            gui.Screen   = new GuiScreen();
            btnStartGame = new GuiButtonControl
            {
                Name   = "Start Game",
                Bounds = new UniRectangle(new UniVector(new UniScalar(540), new UniScalar(200)), new UniVector(new UniScalar(200), new UniScalar(70))),
                Text   = "Start Game"
            };
            btnQuitGame = new GuiButtonControl
            {
                Name   = "Quit Game",
                Bounds = new UniRectangle(new UniVector(new UniScalar(540), new UniScalar(300)), new UniVector(new UniScalar(200), new UniScalar(70))),
                Text   = "Quit Game"
            };
            btnQuitGame.Pressed += BtnQuitGame_Pressed;
            gui.Screen.Desktop.Children.Add(btnQuitGame);

            windowStarting = new GuiWindowControl()
            {
                Name   = "Starting",
                Bounds = new UniRectangle(new UniVector(new UniScalar(240), new UniScalar(200)), new UniVector(new UniScalar(800), new UniScalar(100))),
                Title  = "Starting Game..."
            };

            btnStartGame.Pressed += OnStartGamePressed;
            gui.Screen.Desktop.Children.Add(btnStartGame);

            lblStatus = new GuiLabelControl()
            {
                Bounds = new UniRectangle(new UniVector(new UniScalar(10), new UniScalar(0)), new UniVector(new UniScalar(800), new UniScalar(100))),
                Text   = ""
            };

            windowStarting.Children.Add(lblStatus);
        }