/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel() { ViewportManager = new ViewportManager(); LayersManager = new LayersManager(ViewportManager); ToolsManager = new ToolsManager(LayersManager, ViewportManager); if (!IsInDesignMode) { ToolsManager.InitInstance(); } RestoreWindowCommand = new RelayCommand(SetWindowActive); DisplaySettings = new RelayCommand(() => { var sw = new SettingsWindow(); sw.Show(); }); CloseAppCommand = new RelayCommand(() => { Application.Current.Shutdown(); }); StartUsingToolCommand = new RelayCommand(() => ToolsManager.ActivateTool()); EndUsingToolCommand = new RelayCommand(() => ToolsManager.DeactivateTool()); MoveMoveCommand = new RelayCommand(() => ToolsManager.ReactOnMouseMove()); }
public override void Initialize(IApplication application) { base.Initialize(application); GameStorage gameStorage; if (WaveServices.Storage.Exists <GameStorage>()) { gameStorage = WaveServices.Storage.Read <GameStorage>(); } else { gameStorage = new GameStorage(); } Catalog.RegisterItem(gameStorage); ViewportManager vm = WaveServices.ViewportManager; vm.Activate(1024, 768, ViewportManager.StretchMode.UniformToFill); ScreenContext screenContext = new ScreenContext(new GamePlayScene()) { Behavior = ScreenContextBehaviors.DrawInBackground }; WaveServices.ScreenContextManager.To(screenContext); }
public override void Initialize(IApplication application) { base.Initialize(application); GameStorage gameStorage; if (WaveServices.Storage.Exists <GameStorage>()) { gameStorage = WaveServices.Storage.Read <GameStorage>(); } else { gameStorage = new GameStorage(); } Catalog.RegisterItem(gameStorage); application.Adapter.DefaultOrientation = DisplayOrientation.Portrait; application.Adapter.SupportedOrientations = DisplayOrientation.Portrait; ViewportManager vm = WaveServices.ViewportManager; vm.Activate(768, 1024, ViewportManager.StretchMode.Uniform); ScreenContext screenContext = new ScreenContext(new MainMenuScene()); // Play background music WaveServices.MusicPlayer.Play(new MusicInfo(WaveContent.Assets.Sounds.bg_music_mp3)); WaveServices.MusicPlayer.IsRepeat = true; WaveServices.ScreenContextManager.To(screenContext); }
private static void OpenLayoutSettings() { using (var dlg = new LayoutSettings(ViewportManager.GetWindowConfigurations())) { dlg.ShowDialog(); } }
protected override void Load() { Title = "Thn Player"; LibreLancer.Shaders.AllShaders.Compile(); guiHelper = new ImGuiHelper(this); FileDialog.RegisterParent(this); Viewport = new ViewportManager(this.RenderState); Viewport.Push(0, 0, 800, 600); Billboards = new Billboards(); Nebulae = new NebulaVertices(); Resources = new GameResourceManager(this); Renderer2D = new Renderer2D(this.RenderState); Audio = new AudioManager(this); Sounds = new SoundManager(Audio); Services.Add(Sounds); Services.Add(Billboards); Services.Add(Nebulae); Services.Add(Resources); Services.Add(Renderer2D); fontMan = new FontManager(); fontMan.ConstructDefaultFonts(); Services.Add(fontMan); Services.Add(new GameConfig()); Typewriter = new Typewriter(this); Services.Add(Typewriter); Keyboard.KeyDown += KeyboardOnKeyDown; }
public AutoViewportSelectionCommand(ViewportManager viewportManager, List <Car> players, int humanPlayerIndex, int changeInterval = 10000) { this.viewportManager = viewportManager; this.players = players; this.humanPlayerIndex = humanPlayerIndex; this.changeInterval = changeInterval; }
// Called when the AppendDataCommand is invoked via button click on the view private void AppendData() { var newData = _dataSource.GetRandomWalkSeries(50); _dataSeries0.Append(newData.XData, newData.YData); ViewportManager.ZoomExtents(); }
protected override void Load() { Title = "LancerEdit"; guiHelper = new ImGuiHelper(this); Audio = new AudioManager(this); FileDialog.RegisterParent(this); Viewport = new ViewportManager(RenderState); var texturefilters = new List <string>(defaultFilters); if (RenderState.MaxAnisotropy > 0) { anisotropyLevels = RenderState.GetAnisotropyLevels(); foreach (var lvl in anisotropyLevels) { texturefilters.Add(string.Format("Anisotropic {0}x", lvl)); } } filters = texturefilters.ToArray(); Resources = new ResourceManager(this); Commands = new CommandBuffer(); Billboards = new Billboards(); Polyline = new PolylineRender(Commands); DebugRender = new PhysicsDebugRenderer(); Viewport.Push(0, 0, 800, 600); }
private void ZoomExtents() { _viewportManager.BeginInvoke(() => { ViewportManager.AnimateZoomExtents(TimeSpan.FromMilliseconds(500)); }); }
public ModelViewer(string title, string name, IDrawable drawable, RenderState rstate, ViewportManager viewports, CommandBuffer commands, ResourceManager res) { Title = title; Name = name; this.drawable = drawable; this.rstate = rstate; this.vps = viewports; this.res = res; buffer = commands; wireframeMaterial3db = new Material(res); wireframeMaterial3db.Dc = Color4.White; wireframeMaterial3db.DtName = ResourceManager.WhiteTextureName; normalsDebugMaterial = new Material(res); normalsDebugMaterial.Type = "NormalDebugMaterial"; lighting = Lighting.Create(); lighting.Enabled = true; lighting.Ambient = Color4.Black; lighting.Lights.Add(new RenderLight() { Kind = LightKind.Directional, Direction = new Vector3(0, -1, 0), Color = Color4.White }); lighting.Lights.Add(new RenderLight() { Kind = LightKind.Directional, Direction = new Vector3(0, 0, 1), Color = Color4.White }); lighting.NumberOfTilesX = -1; GizmoRender.Init(res); }
private void UpdateDocumentTabs() { if (DocumentTabs.TabPages.Count != DocumentManager.Documents.Count) { DocumentTabs.TabPages.Clear(); foreach (var doc in DocumentManager.Documents) { DocumentTabs.TabPages.Add(doc.MapFileName); } } else { for (var i = 0; i < DocumentManager.Documents.Count; i++) { var doc = DocumentManager.Documents[i]; DocumentTabs.TabPages[i].Text = doc.MapFileName + (doc.History.TotalActionsSinceLastSave > 0 ? " *" : ""); } } if (DocumentManager.CurrentDocument != null) { var si = DocumentManager.Documents.IndexOf(DocumentManager.CurrentDocument); if (si >= 0 && si != DocumentTabs.SelectedIndex) { DocumentTabs.SelectedIndex = si; } } ViewportManager.RefreshClearColour(DocumentTabs.TabPages.Count == 0); }
public CarGame(float length, float agentDensity, bool playerCollision, bool playSound, float timeAcceleration) { _timeAcceleration = timeAcceleration; _agentDensity = agentDensity; _length = length; _playerCollision = playerCollision; _playSound = playSound; _graphics = new GraphicsDeviceManager(this) { PreferredBackBufferWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width, PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height }; _graphics.ApplyChanges(); Content.RootDirectory = "Content"; _agentFactory = new AgentFactory(_gameStateManager); _courseObjectFactory = new CourseObjectFactory(); _playerFactory = new PlayerFactory(playerCollision); _scoreCsvExporter = new ScoreCsvExporter(ResultFilePath); var scoreCsvImporter = new ScoreCsvImporter(ResultFilePath); _scoreCalculator = new ScoreCalculator(scoreCsvImporter); _dashboard = new Dashboard(_scoreCalculator, new ScoreFormatter()); _viewportManager = new ViewportManager(new ViewportFactory(_graphics)); _carSoundEffect = new CarSoundEffect(); }
public ModelViewer(string title, IDrawable drawable, RenderState rstate, ViewportManager viewports) { Title = title; this.drawable = drawable; this.rstate = rstate; this.vps = viewports; buffer = new CommandBuffer(); }
public AutoViewportSelectionCommand(ViewportManager viewportManager, List <Car> players, int humanPlayerIndex, int changeInterval = 6000) { _viewportManager = viewportManager; _players = players; _humanPlayerIndex = humanPlayerIndex; _changeInterval = changeInterval; }
/// <summary> /// インスタンスを生成します。 /// </summary> /// <param name="uiManager">UIManager。</param> public DrawContext(UIManager uiManager) { this.uiManager = uiManager; scissorManager = new ScissorManager(uiManager); viewportManager = new ViewportManager(uiManager); draw3DManager = new Draw3DManager(uiManager); }
/// <summary> /// Performs further custom initialization for this instance. /// </summary> protected override void Initialize() { base.Initialize(); this.viewportManager = WaveServices.ViewportManager; this.drawOrder = this.SkeletalAnimation.Skeleton.DrawOrder; this.spineMeshes = new Mesh[drawOrder.Count]; }
protected override void ResolveDependencies() { base.ResolveDependencies(); this.viewportManager = WaveServices.ViewportManager; this.platform = WaveServices.Platform; this.platform.OnScreenSizeChanged += this.Platform_OnScreenSizeChanged; }
public void Make2D(ViewportBase viewport, Viewport2D.ViewDirection direction) { var vp = ViewportManager.Make2D(viewport, direction); Renderer.Register(new[] { vp }); vp.RenderContext.Add(new ToolRenderable()); vp.RenderContext.Add(new HelperRenderable(this)); Renderer.UpdateGrid(Map.GridSpacing, Map.Show2DGrid, Map.Show3DGrid, false); }
public void Make3D(ViewportBase viewport, Viewport3D.ViewType type) { var vp = ViewportManager.Make3D(viewport, type); vp.RenderContext.Add(new WidgetLinesRenderable()); Renderer.Register(new[] { vp }); vp.RenderContext.Add(new ToolRenderable()); vp.RenderContext.Add(new HelperRenderable(this)); Renderer.UpdateGrid(Map.GridSpacing, Map.Show2DGrid, Map.Show3DGrid, false); }
protected override void DefaultValues() { base.DefaultValues(); this.maxRotation = MathHelper.ToRadians(20); this.inputManager = WaveServices.Input; this.timerFactory = WaveServices.TimerFactory; this.viewportManager = WaveServices.ViewportManager; this.soundManager = WaveServices.GetService<SoundManager>(); }
protected override void Load() { Title = "LancerEdit"; guiHelper = new ImGuiHelper(this); Audio = new AudioManager(this); FileDialog.RegisterParent(this); Viewport = new ViewportManager(RenderState); Resources = new ResourceManager(this); Viewport.Push(0, 0, 800, 600); }
public override void Initialize(IApplication application) { base.Initialize(application); ViewportManager vm = WaveServices.GetService <ViewportManager>(); vm.Activate(800, 480, ViewportManager.StretchMode.Fill); WaveServices.ScreenContextManager.To(new ScreenContext(new MyScene())); }
protected override void DefaultValues() { base.DefaultValues(); this.maxRotation = MathHelper.ToRadians(20); this.inputManager = WaveServices.Input; this.timerFactory = WaveServices.TimerFactory; this.viewportManager = WaveServices.ViewportManager; this.soundManager = WaveServices.GetService <SoundManager>(); }
/// <summary> /// Base class for tool /// </summary> /// <param name="imgKey"> Resource key for tool icon </param> /// <param name="toolTipName"> Resource key for localized resource name </param> /// <param name="groupKey"> Group key for autogrouping feature </param> /// <param name="layersManager"> Reference to application layers manager </param> /// <param name="viewportManager"> Reference to application viewport manager </param> public ToolBase(string imgKey, string toolTipName, string groupKey, LayersManager layersManager, ViewportManager viewportManager) : this() { LayersManager = layersManager; ViewportManager = viewportManager; _toolImageKey = imgKey; _toolNameKey = toolTipName; ToolImagePath = (Path)Application.Current.FindResource(_toolImageKey); ToolName = (string)Application.Current.FindResource(_toolNameKey); ToolGroupKey = groupKey; }
public OptionsWindow(MainWindow win) { config = win.Config; rstate = win.RenderState; guiHelper = win.guiHelper; vps = win.Viewport; var texturefilters = new List <string>(defaultFilters); if (win.RenderState.MaxAnisotropy > 0) { anisotropyLevels = win.RenderState.GetAnisotropyLevels(); foreach (var lvl in anisotropyLevels) { texturefilters.Add(string.Format("Anisotropic {0}x", lvl)); } } var msaa = new List <int> { 0 }; int a = 2; while (a <= win.RenderState.MaxSamples) { msaa.Add(a); a *= 2; } msaaLevels = msaa.ToArray(); switch (config.MSAA) { case 2: cMsaa = 1; break; case 4: cMsaa = 2; break; case 8: cMsaa = 3; break; case 16: cMsaa = 4; break; case 32: cMsaa = 5; break; } filters = texturefilters.ToArray(); cFilter = config.TextureFilter; SetTexFilter(); }
protected override void Initialize() { base.Initialize(); this.followTransform = this.followEntity.FindComponent <Transform2D>(); this.viewportManager = WaveServices.ViewportManager; this.platform = WaveServices.Platform; this.platform.OnScreenSizeChanged += OnScreenSizeChanged; this.RefreshCameraLimits(); }
private static void SettingsChanged() { foreach (var vp in ViewportManager.Viewports.OfType <CBRE.UI.Viewport3D>()) { vp.Camera.FOV = CBRE.Settings.View.CameraFOV; vp.Camera.ClipDistance = CBRE.Settings.View.BackClippingPane; } ViewportManager.RefreshClearColour(Instance.DocumentTabs.TabPages.Count == 0); TextureHelper.EnableTransparency = !CBRE.Settings.View.GloballyDisableTransparency; TextureHelper.DisableTextureFiltering = CBRE.Settings.View.DisableTextureFiltering; TextureHelper.ForceNonPowerOfTwoResize = CBRE.Settings.View.ForcePowerOfTwoTextureResizing; }
protected override void Load() { Title = "InterfaceEdit"; guiHelper = new ImGuiHelper(this); FileDialog.RegisterParent(this); Renderer2D = new Renderer2D(RenderState); Services.Add(Renderer2D); Viewport = new ViewportManager(RenderState); Viewport.Push(0, 0, Width, Height); new MaterialMap(); Fonts = new FontManager(); }
protected override void Initialize() { base.Initialize(); this.followTransform = this.followEntity.FindComponent<Transform2D>(); this.viewportManager = WaveServices.ViewportManager; this.platform = WaveServices.Platform; this.platform.OnScreenSizeChanged += OnScreenSizeChanged; this.RefreshCameraLimits(); }
private static void SettingsChanged() { foreach (var vp in ViewportManager.Viewports.OfType <Sledge.UI.Viewport3D>()) { vp.Camera.FOV = Sledge.Settings.View.CameraFOV; vp.Camera.ClipDistance = Sledge.Settings.View.BackClippingPane; } ViewportManager.RefreshClearColour(); WadProvider.ReplaceTransparentPixels = !Sledge.Settings.View.DisableWadTransparency && !Sledge.Settings.View.GloballyDisableTransparency; TextureHelper.EnableTransparency = !Sledge.Settings.View.GloballyDisableTransparency; TextureHelper.DisableTextureFiltering = Sledge.Settings.View.DisableTextureFiltering; TextureHelper.ForceNonPowerOfTwoResize = Sledge.Settings.View.ForcePowerOfTwoTextureResizing; }
public override void Initialize(IApplication application) { base.Initialize(application); // ViewportManager is used to automatically adapt resolution to fit screen size ViewportManager vm = WaveServices.ViewportManager; vm.Activate(1280, 720, ViewportManager.StretchMode.UniformToFill); ScreenContext screenContext = new ScreenContext(new MyScene(), new JoystickScene()); WaveServices.ScreenContextManager.To(screenContext); }
protected override void Initialize() { base.Initialize(); this.soundManager = this.EntityManager.Find("soundManager").FindComponent<SoundManager>(); this.vm = WaveServices.ViewportManager; this.input = WaveServices.Input; this.initPosition = this.Transform2D.Position; this.RigidBody.OnPhysic2DCollision += OnPhysic2DCollision; this.RigidBody.OnPhysic2DSeparation += OnPhysic2DSeparation; }
public override void Initialize(IApplication application) { base.Initialize(application); this.RegisterServices(); ViewportManager vm = WaveServices.ViewportManager; vm.Activate(1280, 720, ViewportManager.StretchMode.Uniform); ScreenContext screenContext = new ScreenContext(new MainScene()); WaveServices.ScreenContextManager.To(screenContext); }
protected override void Initialize() { base.Initialize(); this.viewportManager = WaveServices.ViewportManager; }
/// <summary> /// Performs further custom initialization for this instance. /// </summary> protected override void Initialize() { base.Initialize(); this.viewportManager = WaveServices.ViewportManager; if (this.texcoord1 == null) { this.texcoord1 = new Vector2[4] { new Vector2(0, 0), new Vector2(1, 0), new Vector2(1, 1), new Vector2(0, 1), }; } if (this.texcoord2 == null) { this.texcoord2 = new Vector2[4] { new Vector2(0, 0), new Vector2(1, 0), new Vector2(1, 1), new Vector2(0, 1), }; } float halfWidth = this.Transform2D.Rectangle.Width; float halfHeight = this.Transform2D.Rectangle.Height; float opacity = this.Transform2D.Opacity; Color color = new Color(opacity, opacity, opacity, opacity); VertexPositionColorDualTexture[] vertices = new VertexPositionColorDualTexture[4]; vertices[0].Position = new Vector3(0f, 0f, this.Transform2D.DrawOrder); vertices[0].Color = color; vertices[0].TexCoord = this.texcoord1[0]; vertices[0].TexCoord2 = this.texcoord2[0]; vertices[1].Position = new Vector3(halfWidth, 0f, this.Transform2D.DrawOrder); vertices[1].Color = color; vertices[1].TexCoord = this.texcoord1[1]; vertices[1].TexCoord2 = this.texcoord2[1]; vertices[2].Position = new Vector3(halfWidth, halfHeight, this.Transform2D.DrawOrder); vertices[2].Color = color; vertices[2].TexCoord = this.texcoord1[2]; vertices[2].TexCoord2 = this.texcoord2[2]; vertices[3].Position = new Vector3(0f, halfHeight, this.Transform2D.DrawOrder); vertices[3].Color = color; vertices[3].TexCoord = this.texcoord1[3]; vertices[3].TexCoord2 = this.texcoord2[3]; this.vertexBuffer = new VertexBuffer(VertexPositionColorDualTexture.VertexFormat); this.vertexBuffer.SetData(vertices, 4); this.GraphicsDevice.BindVertexBuffer(this.vertexBuffer); ushort[] indices = new ushort[6]; indices[0] = 0; indices[1] = 1; indices[2] = 2; indices[3] = 2; indices[4] = 3; indices[5] = 0; this.indexBuffer = new IndexBuffer(indices); this.GraphicsDevice.BindIndexBuffer(this.indexBuffer); }
/// <summary> /// Performs further custom initialization for this instance. /// </summary> protected override void Initialize() { base.Initialize(); this.viewportManager = WaveServices.ViewportManager; this.drawOrder = this.SkeletalAnimation.Skeleton.DrawOrder; this.numIndices = this.drawOrder.Count * 6; this.numPrimitives = this.drawOrder.Count * 2; this.numVertices = this.drawOrder.Count * 4; // Create Indexbuffer ushort[] indices = new ushort[this.numIndices]; for (int i = 0; i < this.drawOrder.Count; i++) { indices[(i * 6) + 0] = (ushort)((i * 4) + 0); indices[(i * 6) + 1] = (ushort)((i * 4) + 2); indices[(i * 6) + 2] = (ushort)((i * 4) + 1); indices[(i * 6) + 3] = (ushort)((i * 4) + 0); indices[(i * 6) + 4] = (ushort)((i * 4) + 3); indices[(i * 6) + 5] = (ushort)((i * 4) + 2); } this.indexBuffer = new IndexBuffer(indices); this.GraphicsDevice.BindIndexBuffer(this.indexBuffer); this.vertices = new VertexPositionColorTexture[this.numVertices]; this.vertexBuffer = new DynamicVertexBuffer(VertexPositionColorTexture.VertexFormat); this.vertexBuffer.SetData(this.vertices, this.numVertices); this.GraphicsDevice.BindVertexBuffer(this.vertexBuffer); }