3

I have been using Cosmos in Microsoft Visual C# 2008 to make primitive, TUI, operating systems. I wonder how to make a GUI in Cosmos. I know that it's possible, but I just want to know how to make it. Constructive criticism appreciated, insults not! Please reply with code (and comments in the code), because I am an absolute beginner, with only some knowledge of basic c# commands. Thanks!

leppie
  • 115,091
  • 17
  • 196
  • 297
smilinggoomba
  • 91
  • 1
  • 2
  • 11
  • 2
    Last I looked, several years ago, mouse and VGA support were to-do items. They still are. Can't make a GUI without them. – Hans Passant Jul 03 '11 at 01:03

3 Answers3

1

I do not know what milestone your using, but I think this might work for you. You need this class level variable:

 Cosmos.Hardware.VGAScreen screen;

And in your Init method:

 screen = new Cosmos.Hardware.VGAScreen();
 screen.SetMode300x200x8();
 screen.Clear(0);
 //done init vga screen

After that last comment, in your code, you can use this to set the color of a pixel:

 screen.SetPixel300x200x8(uint x, uint y, uint color);

The color parameter is the color of the pixel in 256 color format (numbers 0 through 255). That's all you need to make a GUI. You need lots of math skills to make shapes, though.

pjrader1
  • 491
  • 7
  • 22
0

There are also GUI API's with function's to make shapes. Search on Google/YouTube or visit the discussion page on Cosmos' Codeplex page:

http://cosmos.codeplex.com/discussions

Marcel N.
  • 13,726
  • 5
  • 47
  • 72
Xesau
  • 161
  • 1
  • 9
0

This is for 2020 Because this is a VERY good way todo this in cosmos. (USING CGS)

using System;
using System.Drawing;
using Cosmos.System.Graphics;
using Sys = Cosmos.System;

namespace Graphics
{
    public class Kernel : Sys.Kernel
    {
        Canvas canvas;

        protected override void BeforeRun()
        {
            canvas = FullScreenCanvas.GetFullScreenCanvas();
            canvas.Clear(Color.Black);
        }

        protected override void Run()
        {
            Pen pen = new Pen(Color.White);
            // DRAW stuff see https://www.gocosmos.org/docs/cosmos-graphic-subsystem/
        }
    }
}
Eli Ozcan
  • 412
  • 6
  • 10