protected override void LoadContent() { var viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, 800, 480); _camera = new OrthographicCamera(viewportAdapter); var skin = GuiSkin.FromFile(Content, @"Raw/adventure-gui-skin.json"); var guiRenderer = new GuiSpriteBatchRenderer(GraphicsDevice, _camera.GetViewMatrix); _guiSystem = new GuiSystem(viewportAdapter, guiRenderer) { Screens = { new GuiLayoutScreen(skin, GraphicsDevice) } }; }
protected override void LoadContent() { ViewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, 800, 480); var skin = GuiSkin.FromFile(Content, @"Raw/adventure-gui-skin.json"); var guiRenderer = new GuiSpriteBatchRenderer(GraphicsDevice, ViewportAdapter.GetScaleMatrix); _guiSystem = new GuiSystem(ViewportAdapter, guiRenderer) { Screens = { new SelectDemoScreen(skin, _demos, LoadDemo) } }; //LoadDemo(_demoIndex); }
protected override void LoadContent() { IsMouseVisible = false; // _viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, _graphicsDeviceManager.PreferredBackBufferWidth, _graphicsDeviceManager.PreferredBackBufferHeight); _viewportAdapter = new WindowViewportAdapter(Window, GraphicsDevice); _skin = GuiSkin.FromFile(Content, @"Content/adventure-gui-skin.json", typeof(MyPanel)); var guiRenderer = new GuiSpriteBatchRenderer(GraphicsDevice, _viewportAdapter.GetScaleMatrix); var viewModel = new ViewModel(); LoadGuiButtonScreen(); //_screen = GuiScreen.FromFile(Content, "Content/test-addition-screen.json", typeof(MyPanel)); //Window.ClientSizeChanged += OnClientSizeChanged; //_screen = GuiScreen.FromFile(Content, "Content/adventure-gui-screen.json", typeof(MyPanel)); //var listBox = _screen.FindControl<GuiListBox>("Listbox"); //listBox.Items.Add(new { Name = "Hello World 1" }); //listBox.Items.Add(new { Name = "Hello World 2" }); //listBox.Items.Add(new { Name = "Hello World 3" }); //listBox.Items.Add(new { Name = "Hello World 4" }); //var comboBox = _screen.FindControl<GuiComboBox>("ComboBox"); //comboBox.Items.Add(new { Name = "Hello World 1" }); //comboBox.Items.Add(new { Name = "Hello World 2" }); //comboBox.Items.Add(new { Name = "Hello World 3" }); //comboBox.Items.Add(new { Name = "Hello World 4" }); //var submit = _screen.FindControl<GuiSubmit>("FormSubmit"); //submit.SetBinding(nameof(GuiButton.Text), nameof(viewModel.Name)); //submit.Clicked += OnFormSubmitClicked; //submit.Clicked += (s, e) => { viewModel.Name = viewModel.Name == "Change" ? "Alistrasza" : "Change"; }; _screen.BindingContext = viewModel; _guiSystem = new GuiSystem(_viewportAdapter, guiRenderer) { Screens = { _screen // new BindingScreen(_skin, viewModel) } }; }
public GuiManager(ContentManager contentManager, GameWindow gameWindow, GraphicsDevice graphicsDevice, string defaultSkinFileName) { this.contentManager = contentManager; this.gameWindow = gameWindow; this.graphicsDevice = graphicsDevice; int width = (int)(DEFAULT_GUI_HEIGHT * graphicsDevice.Viewport.AspectRatio); int height = DEFAULT_GUI_HEIGHT; viewportAdapter = new BoxingViewportAdapter(gameWindow, graphicsDevice, width, height, width, 0); //Fixed height, any width guiCamera = new Camera2D(viewportAdapter); guiRenderer = new GuiSpriteBatchRenderer(graphicsDevice, guiCamera.GetViewMatrix); guiSystem = new GuiSystem(viewportAdapter, guiRenderer); DefaultSkin = GuiSkin.FromFile(contentManager, defaultSkinFileName); DefaultSkin.Cursor = null; }
protected override void LoadContent() { IsMouseVisible = false; _viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, _graphicsDeviceManager.PreferredBackBufferWidth, _graphicsDeviceManager.PreferredBackBufferHeight); var skin = GuiSkin.FromFile(Content, @"Content/adventure-gui-skin.json", typeof(MyPanel)); var guiRenderer = new GuiSpriteBatchRenderer(GraphicsDevice, _viewportAdapter.GetScaleMatrix); var viewModel = new ViewModel(); _guiSystem = new GuiSystem(_viewportAdapter, guiRenderer) { Screens = { new BindingScreen(skin, viewModel) } }; }