Why does COSMOS crash after trying to draw a pixel?

45 Views Asked by At

I'm am new to making Operating Systems with COSMOS. I am trying to add a pixel on the screen, but every time I open the GUI (done by typing "cos") it crashes. I have no idea why, but that's what happens.

Here is my code:

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using Cosmos.System.Graphics;
using Sys = Cosmos.System;

namespace COS_v0._01
{
    public class Kernel : Sys.Kernel
    {
        VGAScreen screen;
        private static Canvas canvas;

        public static void init()
        {
            canvas = FullScreenCanvas.GetFullScreenCanvas();
            canvas.Mode = new Mode(1200, 700, ColorDepth.ColorDepth32);

        }

        protected override void BeforeRun()
        {
            Console.WriteLine("Welcome!");
            init();
        }

        protected override void Run()
        {
                Pen pen = new Pen(Color.White);
                canvas.DrawPoint(pen, 10, 10);
        }
    }
}
0

There are 0 best solutions below