Thraka/SadConsole

Console doesn't fully draw after increasing size and resizing with custom font

CubicMelon opened this issue · 4 comments

Love this project! Thanks for your hard work!

I might be missing something, but after I load a custom font, increase the size of a console, then resize the graphics device, it still only draws the part of the console that used to be visible. It only starts to draw portions outside of the original window size after I manually resize the window.

Code used for this example:

        static void Init() {
            var fm = SadConsole.Global.LoadFont("assets/newfont.font");
            SadConsole.Global.FontDefault = fm.GetFont(Font.FontSizes.Two);

            console = new Console(80, 40);
            console.FillWithRandomGarbage();
            SadConsole.Global.CurrentScreen = console;

            Global.FontDefault.ResizeGraphicsDeviceManager(Global.GraphicsDeviceManager, 80, 40, 0, 0);
        }

See attached for what it looks like before and after a very slight manual resizing of the window.
If it matters, this is on Win10.
before_resize
after_resize

Try adding

SadConsole.Global.ResetRendering();

After you resize the device manager.

Also, feel free to join us in discord! :) https://discord.gg/mttxqAs

Aha, that's the solution I was looking for. That fixed the issue. Thanks!

I feel foolish in hindsight; I could have just provided the correct width/height in cells in my call to SadConsole.Game.Create() and that would have prevented the problem from the start. Still, good to know how to force the screen to update after a resize.

@Terumoc It does but since you were using a 2x sized font, I didn't think that would really work for you.