protected override void OnNewSettingsLoaded() { _sections.Clear(); _sections.AddRange(EmitterSettings.TextureSections ?? Array.Empty <TextureSectionCoords>()); if (string.IsNullOrWhiteSpace(EmitterSettings.TextureFileName)) { if (_imguiTextureId != null) { MonoGameImGuiRenderer.UnbindTexture(_imguiTextureId.Value); } _texture = null; _imguiTextureId = null; } else { _texture = TextureFileLoader.LoadTexture2D(EmitterSettings.TextureFileName); _imguiTextureId = MonoGameImGuiRenderer.BindTexture(_texture); } if (_texture != null) { // Since we have no texture, there's no point to the section editor existing, so don't bother // doing anything until we actually have a texture loaded _textureSectionEditor.ApplicationState = ApplicationState; _textureSectionEditor.CommandHandler = CommandHandler; _textureSectionEditor.MonoGameImGuiRenderer = MonoGameImGuiRenderer; _textureSectionEditor.AppOperationQueue = AppOperationQueue; _textureSectionEditor.TextureFileLoader = TextureFileLoader; _textureSectionEditor.EmitterSettings = EmitterSettings; } }
public EmitterSettingsController(ImGuiManager imGuiManager, SettingsCommandHandler commandHandler, ApplicationState applicationState, AppOperationQueue appOperationQueue, ITextureFileLoader textureFileLoader, MonoGameImGuiRenderer monoGameImGuiRenderer) { _commandHandler = commandHandler; _applicationState = applicationState; _appOperationQueue = appOperationQueue; _textureFileLoader = textureFileLoader; _monoGameImGuiRenderer = monoGameImGuiRenderer; _workbench = new Workbench(commandHandler) { IsVisible = false }; imGuiManager.AddElement(_workbench); _activeEditorWindow = new ActiveEditorWindow() { IsVisible = false }; imGuiManager.AddElement(_activeEditorWindow); _workbench.PropertyChanged += WorkbenchOnPropertyChanged; _workbench.ModifierRemovalRequested += WorkbenchOnModifierRemovalRequested; }
protected override void Initialize() { var imGuiRenderer = new MonoGameImGuiRenderer(this); imGuiRenderer.Initialize(); _imGuiManager = new ImGuiManager(imGuiRenderer); _imGuiManager.AddElement(_demoWindowElement); _imGuiManager.AddElement(_entityDataWindow); _entityDataWindow.IsVisible = true; base.Initialize(); }
protected override void OnNewSettingsLoaded() { _texture = TextureFileLoader.LoadTexture2D(EmitterSettings.TextureFileName); _imguiTextureId = MonoGameImGuiRenderer.BindTexture(_texture); _textureSections.Clear(); _textureSections.AddRange(EmitterSettings.TextureSections); if (_currentSection != null) { if (_currentSection.Index >= _textureSections.Count) { _currentSection = null; } else { var section = _textureSections[_currentSection.Index]; _currentSection = new TextureSection(_currentSection.Index, section); } } }
public EditorUiController(ImGuiManager imGuiManager, SettingsCommandHandler commandHandler, AppOperationQueue appOperationQueue, ApplicationState applicationState, ITextureFileLoader textureFileLoader, MonoGameImGuiRenderer monoGameImGuiRenderer) { _imGuiManager = imGuiManager; _appOperationQueue = appOperationQueue; _applicationState = applicationState; _imguiDemoWindow = new DemoWindow { IsVisible = false }; _imGuiManager.AddElement(_imguiDemoWindow); var appToolbar = new AppToolbar(_appOperationQueue, _applicationState); _imGuiManager.AddElement(appToolbar); _newFileDialog = new NewFileDialog(); _newFileDialog.CreateButtonClicked += NewFileDialogOnCreateButtonClicked; _newFileDialog.ModalClosed += NewFileDialogOnModalClosed; _imGuiManager.AddElement(_newFileDialog); _messagePopup = new MessagePopup(); _messagePopup.ModalClosed += MessagePopupOnModalClosed; _imGuiManager.AddElement(_messagePopup); _emitterSettingsController = new EmitterSettingsController(imGuiManager, commandHandler, applicationState, appOperationQueue, textureFileLoader, monoGameImGuiRenderer); appToolbar.NewMenuItemClicked += AppToolbarOnNewMenuItemClicked; appToolbar.OpenMenuItemClicked += AppToolbarOnOpenMenuItemClicked; appToolbar.SaveMenuItemClicked += AppToolbarOnSaveMenuItemClicked; }
protected override void Initialize() { _applicationState = new ApplicationState(_graphicsDeviceManager.GraphicsDevice); _emitterSpriteBatchHandler = new EmitterSpriteBatchHandler(_graphicsDeviceManager.GraphicsDevice); _graphicsDeviceManager.PreferredBackBufferWidth = 1024; _graphicsDeviceManager.PreferredBackBufferHeight = 768; _graphicsDeviceManager.ApplyChanges(); _gridTexture = SetupGridTexture(GraphicsDevice, 32); _spriteBatch = new SpriteBatch(GraphicsDevice); _textureFileLoader = new TextureFileLoader(GraphicsDevice, _applicationState); _emitterRenderGroup = new MonoGameEmitterRenderGroup(GraphicsDevice); ResetRenderTarget(); ResetCamera(); _applicationState.Zoom = 1; var monoGameImGuiRenderer = new MonoGameImGuiRenderer(this); _imGuiManager = new ImGuiManager(monoGameImGuiRenderer); _uiController = new EditorUiController(_imGuiManager, _commandHandler, _appOperationQueue, _applicationState, _textureFileLoader, monoGameImGuiRenderer); _inputHandler = new InputHandler(_uiController, _camera, _commandHandler, _appOperationQueue, _applicationState); _inputHandler.ResetCameraAndEmitterRequested += (sender, args) => ResetCamera(true); _uiController.WindowResized(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height); _appOperationQueue.Enqueue(new UpdateMiscOptionsRequested { UpdatedSamplerState = SamplerState.PointClamp, }); base.Initialize(); }
public PlotterUi(Game game, AppSettings appSettings, ScriptManager scriptManager, OnScreenLogger onScreenLogger) { _appSettings = appSettings; _scriptManager = scriptManager; _onScreenLogger = onScreenLogger; var renderer = new MonoGameImGuiRenderer(game); renderer.Initialize(); _imGuiManager = new ImGuiManager(renderer); _imGuiDemoWindow = new ImGuiDemoWindow(); _imGuiManager.AddElement(_imGuiDemoWindow); var messageOverlay = new MessageOverlay(onScreenLogger) { IsVisible = true }; messageOverlay.DismissMostRecentMessageClicked += (sender, args) => _onScreenLogger.RemoveMostRecentMessage(); _imGuiManager.AddElement(messageOverlay); AppToolbar = new AppToolbar(_scriptManager, _appSettings) { IsVisible = true }; _imGuiManager.AddElement(AppToolbar); _imGuiManager.AddElement(new ImGuiSettings { IsVisible = true }); AppToolbar.SettingsClicked += (sender, args) => CreateSettingsWindow(); AppToolbar.NewClicked += (sender, args) => CreateNewFileDialog(); AppToolbar.OpenClicked += (sender, args) => OpenScriptFile(args); }
public ImageTestWindow(GraphicsDevice graphicsDevice, MonoGameImGuiRenderer monoGameImGuiRenderer) { _texture = Texture2D.FromFile(graphicsDevice, "SampleParticles.png"); _textureId = monoGameImGuiRenderer.BindTexture(_texture); }