Пример #1
0
        public override void Render(float time, float deltaTime)
        {
            _shaderProgram.SetUniform("projection", ref Window.ProjectionMatrix);

            RenderContext.Clear(_backgroundColor);

            _spriteBatch.Begin(_shaderProgram);

            _spriteBatch.DrawString(_roboto, _str, new Vector2(100, 100), _textColor, _scale);

            _spriteBatch.End();

            ImGui.Begin("Font--");

            ImGui.InputInt("Height", ref _height);
            ImGui.InputText("Display String", ref _str, 128);
            ImGui.DragFloat("Text Scale", ref _scale);

            ImGui.Separator();

            ImGuiHelper.ColorEdit4("Text Color", ref _textColor);
            ImGuiHelper.ColorEdit4("Background Color", ref _backgroundColor);

            ImGui.Separator();

            if (ImGui.Button("Reload"))
            {
                ImGuiHelper.UnbindTexture(_textureHandle);
                _roboto.Dispose();
                _roboto        = new Font(RenderContext, "./Assets/Fonts/Roboto-Medium.ttf", (uint)_height);
                _textureHandle = ImGuiHelper.BindTexture(_roboto.FontAtlas);
            }

            ImGui.Separator();
            ImGuiHelper.Image(_textureHandle, new Vector2(_roboto.FontAtlas.Width, _roboto.FontAtlas.Height));

            ImGui.End();

            ImGui.ShowMetricsWindow();
        }