CosmosOS / Cosmos

Cosmos is an operating system "construction kit". Build your own OS using managed languages such as C#, VB.NET, and more!
https://www.goCosmos.org
BSD 3-Clause "New" or "Revised" License
2.94k stars 552 forks source link

UI isn't working, the text side of Cosmos OS, is working, the UI/Canvas isn't working, i write my code always but I legitimately got ChatGPT to write code, but it just goes black, even canvas.clear into yellow shows absolutely nothing, it doesn't work across all UI, not just the one project, i tested. I AM LOSING MY MIND #2962

Closed OOFMAN29803 closed 9 months ago

OOFMAN29803 commented 9 months ago
using System;
using System.Drawing;
using Sys = Cosmos.System;
using Cosmos.System.Graphics;
using Cosmos.System;

namespace FieOSUIVersion
{
    public class Kernel : Sys.Kernel
    {
        private Canvas canvas;

        protected override void BeforeRun()
        {
            // Set up the canvas and mouse once before running
            var mode = new Mode(800, 600, ColorDepth.ColorDepth32);
            canvas = FullScreenCanvas.GetFullScreenCanvas(mode);
            canvas.Clear(Color.Yellow);

            MouseManager.ScreenWidth = 800;
            MouseManager.ScreenHeight = 600;
        }

        protected override void Run()
        {
            DrawUI();
        }

        private void DrawUI()
        {
            // Ideally, you would have some kind of loop here, but be careful.
            // An infinite loop without proper yielding can freeze the system.
            // You would need to implement a way to exit this loop based on some condition.
            try
            {
                    canvas.DrawFilledRectangle(new Pen(Color.LightBlue), 0, 100, 800, 100);
                    canvas.DrawFilledRectangle(new Pen(Color.Gray), 0, 550, 800, 50); // The height should be the height of the rectangle, not the y-coordinate
                    canvas.DrawPoint(new Pen(Color.White), MouseManager.X, MouseManager.Y);
                    canvas.Display();
            }
            catch (Exception ex)
            {
                // Handle exceptions here
                System.Console.WriteLine("An error occurred: " + ex.Message);
            }
        }
    }
}

Output: In Cosmos.System.Kernel..ctor Starting kernel HW Bootstrap Init Creating Console Creating Keyboard HW Init Creating Primary ATA IOGroup Creating Secondary ATA IOGroup Before Core.Global.Init PCI Devices ACPI Init PS/2 Controller Init ATA device with speclevel ATA found. Creating Secondary ATA IOGroup ATAPI: Primary controller: False Bus postion: IsMaster: True ATA device with speclevel ATAPI found Network Devices Init Done initializing Cosmos.HAL.Global Network Stack Init KeyboardManager.AddKeyboard Cls Before Run Run Not yet stopped

I REALLY NEED HELP. PLEASE

9xbt commented 9 months ago

that is very weird, i dont see anything wrong with that code

9xbt commented 9 months ago

also what hypervisor are you using to run your OS on? vmware, vbox, qemu...

OOFMAN29803 commented 9 months ago

also what hypervisor are you using to run your OS on? vmware, vbox, qemu...

I am using VMWare Player and I updated it, and Visual Studio 2022. It will only work in Administrator as well, the whole Cosmos thing and it stopped working, but even before the update as well

OOFMAN29803 commented 9 months ago

For anyone going to ask me, No, again to reiterate, this is system Wide, I have tried other things in other projects. I am just met with a black screen