Example #1
0
        public EditorApp(
            ImGuiRenderer imGuiRenderer,
            GameWindow gameWindow,
            IReadOnlyList <IWindow> windows,
            GameClock gameClock,
            WorldSystem worldSystem,
            EditTileMapState editTileMapState,
            IAssetsDatabase assetsDatabase
            )
        {
            _imGuiRenderer  = imGuiRenderer;
            _windows        = windows;
            _gameClock      = gameClock;
            _worldSystem    = worldSystem;
            _editorAppState = editTileMapState;
            _assetsDatabase = assetsDatabase;

            _imGuiRenderer.RebuildFontAtlas();
            var imGuiIo = ImGui.GetIO();

            imGuiIo.ConfigWindowsMoveFromTitleBarOnly = true;
            imGuiIo.ConfigFlags |= ImGuiConfigFlags.DockingEnable;

            gameWindow.AllowUserResizing = true;

            _worldSystem.CreateNewWorld();
        }
Example #2
0
        public override void Initialize()
        {
            _imGuiRenderer = new ImGuiRenderer(_game);
            _imGuiRenderer.RebuildFontAtlas();

            base.Initialize();
        }
Example #3
0
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            imGuiRenderer = new ImGuiRenderer(this, platform, platformFunctions);

            if (platform == Platform.Android)
            {
                AndroidCopyToDisk("OpenSans-Regular.ttf");
            }

            fonts.NormalFont = ImGui.GetIO().Fonts.AddFontFromFileTTF(
                PlatformContentPath("OpenSans-Regular.ttf"), 32 * platformFunctions.ScreenDensity());

            fonts.LargeFont = ImGui.GetIO().Fonts.AddFontFromFileTTF(
                PlatformContentPath("OpenSans-Regular.ttf"), 48 * platformFunctions.ScreenDensity());

            fonts.SmallFont = ImGui.GetIO().Fonts.AddFontFromFileTTF(
                PlatformContentPath("OpenSans-Regular.ttf"), 24 * platformFunctions.ScreenDensity());

            imGuiRenderer.RebuildFontAtlas();

            frame.SetScreenWidth(GraphicsDevice.Viewport.Width);
            frame.SetScreenHeight(GraphicsDevice.Viewport.Height);

            base.Initialize();
        }
Example #4
0
        public ImFontPtr LoadFont(string path, int pixelSize)
        {
            var font = ImGui.GetIO().Fonts.AddFontFromFileTTF(path, pixelSize);

            _imGuiRenderer.RebuildFontAtlas();

            return(font);
        }
Example #5
0
        protected override void Initialize()
        {
            // ....
            IsMouseVisible = true;                    // So you can see the mouse pointer over the controls
            _imGuiRenderer = new ImGuiRenderer(this); // Initialize the ImGui renderer
            _imGuiRenderer.RebuildFontAtlas();        // Required so fonts are available for rendering

            base.Initialize();
        }
Example #6
0
        public static void Begin()
        {
            if (!loadedFont)
            {
                loadedFont = true;
                Renderer.RebuildFontAtlas();
            }

            Renderer.BeforeLayout(Engine.GameTime);
        }
Example #7
0
 protected override void Initialize()
 {
     // TODO: Add your initialization logic here
     _imGuiRenderer = new ImGuiRenderer(this);
     _imGuiRenderer.RebuildFontAtlas();
     SetupDarkStyle();
     Camera        = new PerspectiveCamera(new Vector3(-10, 5, -15), Vector3.Zero);
     _renderer     = new Renderer.Renderer(Camera);
     CurrentFolder = AppContext.BaseDirectory;
     base.Initialize();
 }
        protected override void LoadContent()
        {
            _imguiRenderer = new ImGuiRenderer(this);
            ImGuiEx.IcoMoon.AddIconsToDefaultFont(16f);
            _imguiRenderer.RebuildFontAtlas();

            _spriteBatch    = new SpriteBatch(GraphicsDevice);
            _primitiveBatch = new PrimitiveBatch(GraphicsDevice);

            base.LoadContent();
        }
Example #9
0
        public DebugUIRenderSystem(Game1 game, GraphicsDevice graphicsDevice, PhysicsSystem physicsSystem, ViewportRenderSystem viewportRenderSystem) : base(Aspect.Exclude())
        {
            _graphicsDevice       = graphicsDevice;
            _physicsSystem        = physicsSystem;
            _viewportRenderSystem = viewportRenderSystem;
            _game = game;

            _imGuiRenderer = new ImGuiRenderer(_graphicsDevice);
            ImGui.GetIO().ConfigWindowsMoveFromTitleBarOnly = true;
            _imGuiRenderer.RebuildFontAtlas();

            _componentTypes = typeof(IComponent).Assembly.GetTypes().Where(
                t => typeof(IComponent).IsAssignableFrom(t) && !t.IsInterface && !t.IsAbstract);
        }
Example #10
0
        public override void Initialize()
        {
            Console.WriteLine("Initializing!");

            _imGuiRenderer = new ImGuiRenderer(Game);
            _imGuiRenderer.RebuildFontAtlas();

            _camera = new OrthographicCamera(GraphicsDevice);
            _camera.LookAt(new Vector2(GraphicsDevice.Viewport.Width / 2.0f, GraphicsDevice.Viewport.Height / 2.0f));
            _camera.Zoom = 0.5f;

            _playerTurnsContainer = new PlayerTurnsContainer(_field, _gameStateManager);
            SetUpCommands();

            base.Initialize();
        }
Example #11
0
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            imGuiRenderer = new ImGuiRenderer(this, platform, platformFunctions);

            if (platform == Platform.Android)
            {
                AndroidCopyToDisk("OpenSans-Regular.ttf");
            }

            font = ImGui.GetIO().Fonts.AddFontFromFileTTF(
                PlatformContentPath("OpenSans-Regular.ttf"), 24 * platformFunctions.ScreenDensity());

            imGuiRenderer.RebuildFontAtlas();

            base.Initialize();
        }
Example #12
0
        public void ChangeInstance(Game game)
        {
            if (game == EditorApp.game)
            {
                return;
            }

            if (game == null)
            {
                game = this;
            }
            else
            {
                game.Focus();
                EditorApp.game = game;
            }

            ImGuiRenderer = new ImGuiRenderer(game);
            ImGuiRenderer.RebuildFontAtlas();
            EditorGUI.Initialize();
        }
Example #13
0
        protected override void Initialize()
        {
            var sw = Stopwatch.StartNew();

            _logger.Information("App: Initializing...");

            _imGuiRenderer = new ImGuiRenderer(this);
            _imGuiRenderer.RebuildFontAtlas();

            _previousKeyboardState = Keyboard.GetState();
            _previousMouseState    = Mouse.GetState();

            base.Initialize();

            _currentWorld = _worldProvider.GetWorld(_clientStartParameters.ProjectId);

            _spriteBatch = new SpriteBatch(GraphicsDevice);

            sw.Stop();
            _logger.Information("App: Initializing...Done. Took {@TotalSeconds}s", sw.Elapsed.TotalSeconds);
        }
Example #14
0
        protected override void Initialize()
        {
            base.Initialize();             // (calls LoadContent)

            _imgui = new ImGuiRenderer(this);
            _imgui.RebuildFontAtlas();

            InputModules = new List <IGameplayModule>();

            if (GraphicsDevice.Viewport.Width < 640 || GraphicsDevice.Viewport.Height < 480)
            {
                ScaleFactor = 0.5f;
            }
            else if (GraphicsDevice.Viewport.Width < 978 || GraphicsDevice.Viewport.Height < 720)
            {
                ScaleFactor = 1.0f;
            }
            else
            {
                ScaleFactor = 1.5f;
            }

            Camera = new Camera(GraphicsDevice.Viewport.AspectRatio, 70.0f, 0.1f, 1000.0f);
            UpdateCamera();

            WhitePixel = new Texture2D(GraphicsDevice, 1, 1);
            WhitePixel.SetData(new[] { Color.White });

            Audio = new AudioManager();
            Audio.LoadDefaultPacks(Content);

            SkyModule       = new SkyModule(this);
            ChunkModule     = new ChunkModule(this);
            HighlightModule = new HighlightModule(this);
            DebugInfoModule = new DebugInfoModule(this, Pixel);
            ChatModule      = new ChatModule(this, Pixel);
            HudModule       = new HUDModule(this, Pixel);
            WindowModule    = new WindowModule(this, Pixel);
            ControlModule   = new PlayerControlModule(this);

            InputModules.Add(WindowModule);
            InputModules.Add(DebugInfoModule);
            InputModules.Add(ChatModule);
            InputModules.Add(HudModule);
            InputModules.Add(ControlModule);

            Client.PropertyChanged += HandleClientPropertyChanged;
            Client.Connect(EndPoint);

            BlockProvider.BlockRepository = BlockRepository;
            var itemRepository = new ItemRepository();

            itemRepository.DiscoverItemProviders();
            ItemRepository = itemRepository;
            BlockProvider.ItemRepository = ItemRepository;

            IconRenderer.CreateBlocks(this, BlockRepository);

            var centerX = GraphicsDevice.Viewport.Width / 2;
            var centerY = GraphicsDevice.Viewport.Height / 2;

            Mouse.SetPosition(centerX, centerY);

            MouseComponent.Scroll       += OnMouseComponentScroll;
            MouseComponent.Move         += OnMouseComponentMove;
            MouseComponent.ButtonDown   += OnMouseComponentButtonDown;
            MouseComponent.ButtonUp     += OnMouseComponentButtonUp;
            KeyboardComponent.KeyDown   += OnKeyboardKeyDown;
            KeyboardComponent.KeyUp     += OnKeyboardKeyUp;
            GamePadComponent.ButtonDown += OnGamePadButtonDown;
            GamePadComponent.ButtonUp   += OnGamePadButtonUp;

            CreateRenderTarget();
            SpriteBatch = new SpriteBatch(GraphicsDevice);
            ThreadId    = Thread.CurrentThread.ManagedThreadId;
        }
 /// <summary>
 ///     Initialize imgui to be able to build the menu.
 /// </summary>
 public void LoadImgGUI()
 {
     ImGuiRenderer = new ImGuiRenderer(Game);
     ImGuiRenderer.RebuildFontAtlas();
 }
Example #16
0
 public void Initialize()
 {
     _renderer.RebuildFontAtlas();
 }