Exemplo n.º 1
0
 public EntityContextMenu(GlobalUIState state, Guid entityGuid)
 {
     _state = state;
     //_state.OpenWindows.Add(this);
     //IsActive = true;
     _entityState = state.MapRendering.IconEntityStates[entityGuid];
 }
Exemplo n.º 2
0
        public TranslateMoveOrderWidget(GlobalUIState state, Entity orderingEntity)
        {
            _state           = state;
            _currentDateTime = _state.CurrentSystemDateTime;

            _movingEntity = orderingEntity;

            Setup();
        }
Exemplo n.º 3
0
 public NameIcon(ref EntityState entityState, GlobalUIState state) : base(entityState.Entity.GetDataBlob <PositionDB>())
 {
     _state               = state;
     _entityGuid          = entityState.Entity.Guid;
     _nameDB              = entityState.Entity.GetDataBlob <NameDB>();
     NameString           = _nameDB.GetName(state.Faction);
     entityState.Name     = NameString;
     entityState.NameIcon = this;
 }
Exemplo n.º 4
0
 internal SystemMapRendering(Sdl2Window window, GlobalUIState state)
 {
     _state      = state;
     _camera     = _state.Camera;
     _window     = window;
     windowPtr   = window.Handle;
     surfacePtr  = SDL.SDL_GetWindowSurface(windowPtr);
     rendererPtr = SDL.SDL_GetRenderer(windowPtr);
     //UIWidgets.Add(new CursorCrosshair(new Vector4())); //used for debugging the cursor world position.
     foreach (var item in TestDrawIconData.GetTestIcons())
     {
         _testIcons.Add(Guid.NewGuid(), item);
     }
 }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            // Create window, GraphicsDevice, and all resources necessary for the demo.
            //VeldridStartup.CreateWindowAndGraphicsDevice(
            VeldridStartup.CreateWindowAndGraphicsDevice(
                new WindowCreateInfo(50, 50, 1280, 720, WindowState.Normal, "ImGui.NET Sample Program"),
                new GraphicsDeviceOptions(true, null, true),
                GraphicsBackend.OpenGL,
                out _window,
                out _gd);
            _window.Resized += () =>
            {
                _gd.MainSwapchain.Resize((uint)_window.Width, (uint)_window.Height);
                _controller.WindowResized(_window.Width, _window.Height);
            };
            _cl         = _gd.ResourceFactory.CreateCommandList();
            _controller = new ImGuiController(_gd, _gd.MainSwapchain.Framebuffer.OutputDescription, _window.Width, _window.Height);
            //_memoryEditor = new MemoryEditor();
            //Random random = new Random();
            //_memoryEditorData = Enumerable.Range(0, 1024).Select(i => (byte)random.Next(255)).ToArray();
            _state = new GlobalUIState(_window);
            // Main application loop
            while (_window.Exists)
            {
                InputSnapshot snapshot = _window.PumpEvents();
                if (!_window.Exists)
                {
                    break;
                }
                _controller.Update(1f / 60f, snapshot); // Feed the input events to our ImGui controller, which passes them through to ImGui.

                SubmitUI();

                _cl.Begin();
                _cl.SetFramebuffer(_gd.MainSwapchain.Framebuffer);
                _cl.ClearColorTarget(0, new RgbaFloat(_clearColor.X, _clearColor.Y, _clearColor.Z, 1f));
                _controller.Render(_gd, _cl);
                _cl.End();
                _gd.SubmitCommands(_cl);
                _gd.SwapBuffers(_gd.MainSwapchain);
            }

            // Clean up Veldrid resources
            _gd.WaitForIdle();
            _controller.Dispose();
            _cl.Dispose();
            _gd.Dispose();
        }