示例#1
0
        internal GlobalUIState(ImGuiSDL2CSWindow viewport)
        {
            ViewPort = viewport;
            PulsarGuiWindow._state = this;
            var windowPtr = viewport.Handle;

            SDL.SDL_SetHint(SDL.SDL_HINT_RENDER_DRIVER, "opengl");
            //var surfacePtr = SDL.SDL_GetWindowSurface(windowPtr);
            rendererPtr = SDL.SDL_CreateRenderer(windowPtr, -1, SDL.SDL_RendererFlags.SDL_RENDERER_ACCELERATED);



            for (int i = 0; i < (int)UserOrbitSettings.OrbitBodyType.NumberOf; i++)
            {
                UserOrbitSettingsMtx.Add(new List <UserOrbitSettings>());
                DrawNameZoomLvl.Add(100f);
                for (int j = 0; j < (int)UserOrbitSettings.OrbitTrajectoryType.NumberOf; j++)
                {
                    UserOrbitSettingsMtx[i].Add(new UserOrbitSettings());
                }
            }


            Camera = new Camera(viewport);

            MainMenuItems.GetInstance().IsActive = true;

            string rf = "Resources";

            LoadImg("Logo", Path.Combine(rf, "PulsarLogo.bmp"));
            LoadImg("PlayImg", Path.Combine(rf, "Play.bmp"));
            LoadImg("PauseImg", Path.Combine(rf, "Pause.bmp"));
            LoadImg("OneStepImg", Path.Combine(rf, "OneStep.bmp"));
            LoadImg("UpImg", Path.Combine(rf, "UpArrow.bmp"));
            LoadImg("DnImg", Path.Combine(rf, "DnArrow.bmp"));
            LoadImg("RepeatImg", Path.Combine(rf, "RepeatIco.bmp"));
            LoadImg("CancelImg", Path.Combine(rf, "CancelIco.bmp"));

            /*
             * int gltxtrID;
             * GL.GenTextures(1, out gltxtrID);
             * GL.BindTexture(GL.Enum.GL_TEXTURE_2D, gltxtrID);
             * GL.PixelStorei(GL.Enum.GL_UNPACK_ROW_LENGTH, 0);
             * GL.TexImage2D(GL.Enum.GL_TEXTURE_2D, 0, (int)GL.Enum.GL_RGBA, 16, 16, 0, GL.Enum.GL_RGBA, GL.Enum.GL_UNSIGNED_BYTE, playImgPtr);
             *
             * GLImageDictionary["PlayImg"] = gltxtrID;
             * GL.Enable(GL.Enum.GL_TEXTURE_2D);
             */
        }
示例#2
0
        internal SystemMapRendering(ImGuiSDL2CSWindow 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.TryAdd(Guid.NewGuid(), item);
            }
        }
示例#3
0
        internal static GalaxyMap GetInstance(ImGuiSDL2CSWindow window, Entity faction)
        {
            GalaxyMap instance;

            if (!_state.LoadedWindows.ContainsKey(typeof(GalaxyMap)))
            {
                instance = new GalaxyMap(faction);
            }
            else
            {
                instance = (GalaxyMap)_state.LoadedWindows[typeof(GalaxyMap)];
            }
            instance._window = window;

            return(instance);
        }
示例#4
0
        public GalacticMapRender(ImGuiSDL2CSWindow window, GlobalUIState state)
        {
            _state  = state;
            _window = window;
            _camera = state.Camera;

            var windowPtr  = window.Handle;
            var surfacePtr = SDL.SDL_GetWindowSurface(windowPtr);

            _renderPtr = SDL.SDL_GetRenderer(windowPtr);

            var size     = window.Size;
            int cellSize = 16;
            int gridwid  = (int)size.X / cellSize;
            int gridhig  = (int)size.Y / cellSize;

            grid = new CollisionGrid(gridwid, gridhig, cellSize);
            _state.EntityClickedEvent += _state_EntityClickedEvent;
        }
示例#5
0
        internal GlobalUIState(ImGuiSDL2CSWindow viewport)
        {
            ViewPort = viewport;
            PulsarGuiWindow._uiState = this;
            var windowPtr = viewport.Handle;

            SDL.SDL_SetHint(SDL.SDL_HINT_RENDER_DRIVER, "opengl");
            //var surfacePtr = SDL.SDL_GetWindowSurface(windowPtr);
            rendererPtr = SDL.SDL_CreateRenderer(windowPtr, -1, SDL.SDL_RendererFlags.SDL_RENDERER_ACCELERATED);



            for (int i = 0; i < (int)UserOrbitSettings.OrbitBodyType.NumberOf; i++)
            {
                UserOrbitSettingsMtx.Add(new List <UserOrbitSettings>());
                DrawNameZoomLvl.Add(100f);
                for (int j = 0; j < (int)UserOrbitSettings.OrbitTrajectoryType.NumberOf; j++)
                {
                    UserOrbitSettingsMtx[i].Add(new UserOrbitSettings());
                }
            }


            Camera = new Camera(viewport);

            MainMenuItems.GetInstance().SetActive();

            string rf = "Resources";

            LoadImg("Logo", Path.Combine(rf, "PulsarLogo.bmp"));
            LoadImg("PlayImg", Path.Combine(rf, "Play.bmp"));
            LoadImg("PauseImg", Path.Combine(rf, "Pause.bmp"));
            LoadImg("OneStepImg", Path.Combine(rf, "OneStep.bmp"));
            LoadImg("UpImg", Path.Combine(rf, "UpArrow.bmp"));
            LoadImg("DnImg", Path.Combine(rf, "DnArrow.bmp"));
            LoadImg("RepeatImg", Path.Combine(rf, "RepeatIco.bmp"));
            LoadImg("CancelImg", Path.Combine(rf, "CancelIco.bmp"));
            LoadImg("DesComp", Path.Combine(rf, "DesignComponentIco.bmp"));
            LoadImg("DesShip", Path.Combine(rf, "DesignShipIco.bmp"));
            LoadImg("DesOrd", Path.Combine(rf, "DesignOrdnanceIco.bmp"));
            LoadImg("GalMap", Path.Combine(rf, "GalaxyMapIco.bmp"));
            LoadImg("Research", Path.Combine(rf, "ResearchIco.bmp"));
            LoadImg("Power", Path.Combine(rf, "PowerIco.bmp"));
            LoadImg("Ruler", Path.Combine(rf, "RulerIco.bmp"));
            LoadImg("Cargo", Path.Combine(rf, "CargoIco.bmp"));
            LoadImg("Firecon", Path.Combine(rf, "FireconIco.bmp"));
            LoadImg("Industry", Path.Combine(rf, "IndustryIco.bmp"));
            LoadImg("Pin", Path.Combine(rf, "PinIco.bmp"));
            LoadImg("Rename", Path.Combine(rf, "RenameIco.bmp"));
            LoadImg("Select", Path.Combine(rf, "SelectIco.bmp"));
            LoadImg("Tree", Path.Combine(rf, "TreeIco.bmp"));

            //DEBUG Code: (can be deleted);
            DamageTools.LoadFromBitMap(Path.Combine(rf, "ImgTest.bmp"));

            /*
             * int gltxtrID;
             * GL.GenTextures(1, out gltxtrID);
             * GL.BindTexture(GL.Enum.GL_TEXTURE_2D, gltxtrID);
             * GL.PixelStorei(GL.Enum.GL_UNPACK_ROW_LENGTH, 0);
             * GL.TexImage2D(GL.Enum.GL_TEXTURE_2D, 0, (int)GL.Enum.GL_RGBA, 16, 16, 0, GL.Enum.GL_RGBA, GL.Enum.GL_UNSIGNED_BYTE, playImgPtr);
             *
             * GLImageDictionary["PlayImg"] = gltxtrID;
             * GL.Enable(GL.Enum.GL_TEXTURE_2D);
             */
        }
示例#6
0
 /// <summary>
 /// Construct a new Camera class within the Graphic Control Viewport.
 /// </summary>
 public Camera(ImGuiSDL2CSWindow viewPort)
 {
     _viewPort = viewPort;
     //_viewPort.SizeChanged += _viewPort_SizeChanged;
 }