Skip to content

Creating a GUI: Calculating the screen size

ShiningLea edited this page Jun 10, 2021 · 3 revisions

(Completely backed by research that was done during the making of the System Shell)

Calculating the screen size is quite difficult, for there are no Height and Width properties on the canvas. We'll have to go through the mode instead.

using CGS = Cosmos.System.Graphics;
namespace Cosmos.System
{
    public static class DisplaySizeManager
    {
        public int Height
        {
            get
            {
                return Canvas.Mode.Rows;
            }
        }
        public int Width
        {
            get
            {
                return Canvas.Mode.Columns;
            }
        }
        public CGS.Canvas Canvas
        {
            get;
            set;
        }
    }
}
Clone this wiki locally