This advertising slot is open! To have a paragraph here featuring your company (doesn't have to be tech related), go to http://www.fiverr.com/armmaster17/mention-your-company-in-a-blog-post.
Hey blog readers! we have a new Facebook page! Check it out at http://on.fb.me/U9s2Ld
using System;
using System.Collections.Generic;
using System.Text;
using Sys = Cosmos.System;
using Cosmos.Hardware;
namespace TOS
{
public class Kernel : Sys.Kernel
{
VGAScreen screen;
Mouse mouse;
protected override void BeforeRun()
{
screen = new VGAScreen();
//screen.SetMode320x200x8();
screen.SetGraphicsMode(VGAScreen.ScreenSize.Size320x200, VGAScreen.ColorDepth.BitDepth8);
screen.Clear(15);
mouse = new Mouse();
mouse.Initialize(320, 200);
}
protected override void Run()
{
screen.SetPixel320x200x8((uint)mouse.X, (uint)mouse.Y, 0);
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Sys = Cosmos.System;
using Cosmos.Hardware;
namespace TOS
{
public class Kernel : Sys.Kernel
{
VGAScreen screen;
Mouse mouse;
protected override void BeforeRun()
{
screen = new VGAScreen();
//screen.SetMode320x200x8();
screen.SetGraphicsMode(VGAScreen.ScreenSize.Size320x200, VGAScreen.ColorDepth.BitDepth8);
screen.Clear(15);
mouse = new Mouse();
mouse.Initialize(320, 200);
}
protected override void Run()
{
screen.Clear(15);
screen.SetPixel320x200x8((uint)mouse.X, (uint)mouse.Y, 0);
screen.SetPixel320x200x8((uint)mouse.X - 1, (uint)mouse.Y, 0);
screen.SetPixel320x200x8((uint)mouse.X, (uint)mouse.Y - 1, 0);
screen.SetPixel320x200x8((uint)mouse.X - 2, (uint)mouse.Y, 0);
screen.SetPixel320x200x8((uint)mouse.X, (uint)mouse.Y - 2, 0);
}
}
}
Now go ahead and run it. Now you should see a single black pixel that acts as your mouse. Congratulations! You have created a GUI! This is what it should look like (minus the red circle):
It might be really laggy, but that's probably because you aren't on a computer that supports hyper-v. If you want to see your new OS run at it's true speed, follow these instructions.
EDIT: the built-in Cosmos tools for making bootable media are broken. I will upload a tutorial as soon as I have found a work-around.
For even more fun, check out part 4 here -> (link under construction). And feel free to edit the code as much as you like. If you run into trouble, just leave a comment below and any of the authors here will be happy to help. Have Fun!
Joshua: http://fiverr.com/armmaster17
Brandon: http://fiverr.com/maltzy
No comments:
Post a Comment