Syndicate the Cosmos Blog Feed.

Mouse Support

Cosmos now has mouse support...

... and a sample simple drawing app :)

I'm no artist. Daniel Story will draw better soon ;)

Comments:

mansi on 9/13/2009 wrote: can u please let me know where the source code of this mouse support application available?
Geis-OS on 10/5/2009 wrote: yeah this is so cool. Mouse support. Can you do this with Milestone 3? Or did you used a beta from Milestone 4?
Stephen Remde on 10/6/2009 wrote: private static void MouseDemo() { VGAScreen.SetMode320x200x8(); VGAScreen.SetPaletteEntry(0, 0, 0, 0); VGAScreen.SetPaletteEntry(1, 63, 0, 0); VGAScreen.SetPaletteEntry(2, 63, 63, 63); VGAScreen.Clear(0); uint x = (uint)Mouse.X; uint y = (uint)Mouse.Y; uint oc = 0; while (true) { uint mx = (uint)Mouse.X; uint my = (uint)Mouse.Y; if (mx != x || my != y) { if (Mouse.Buttons == Mouse.MouseState.Left) VGAScreen.SetPixel320x200x8(x, y, 1); else if (Mouse.Buttons == Mouse.MouseState.Right) VGAScreen.SetPixel320x200x8(x, y, 0); else VGAScreen.SetPixel320x200x8(x, y, oc); x = mx; y = my; oc = VGAScreen.GetPixel320x200x8(x, y); VGAScreen.SetPixel320x200x8(x, y, 2); } } }
Stephen Remde on 10/6/2009 wrote: Errr, didnt seem to format right. but thats the code i used to draw the picture above.
Geis-OS on 10/6/2009 wrote: using System; using Cosmos.Compiler.Builder; namespace CosmosBoot { class Program { #region Cosmos Builder logic // Most users wont touch this. This will call the Cosmos Build tool [STAThread] static void Main(string[] args) { BuildUI.Run(); } #endregion private static void MouseDemo() { VGAScreen.SetMode320x200x8(); VGAScreen.SetPaletteEntry(0, 0, 0, 0); VGAScreen.SetPaletteEntry(1, 63, 0, 0); VGAScreen.SetPaletteEntry(2, 63, 63, 63); VGAScreen.Clear(0); uint x = (uint)Mouse.X; uint y = (uint)Mouse.Y; uint oc = 0; while (true) { uint mx = (uint)Mouse.X; uint my = (uint)Mouse.Y; if (mx != x || my != y) { if (Mouse.Buttons == Mouse.MouseState.Left) VGAScreen.SetPixel320x200x8(x, y, 1); else if (Mouse.Buttons == Mouse.MouseState.Right) VGAScreen.SetPixel320x200x8(x, y, 0); else VGAScreen.SetPixel320x200x8(x, y, oc); x = mx; y = my; oc = VGAScreen.GetPixel320x200x8(x, y); VGAScreen.SetPixel320x200x8(x, y, 2); } } } } }
Geis-OS on 10/6/2009 wrote: I dont know why, but it says VGAScreen is wrong. I'm new with cosmos. What i have to do? I use Visual C# Express edition with milestone 3.
Stephen Remde on 10/6/2009 wrote: Try using Cosmos.Hardware if not, get the dev kit
Stephen Remde on 10/6/2009 wrote: Try "using Cosmos.Hardware;". If that doesn't work, use the devkit. Urg can we sort the formatting here Chad? xD
Tomi on 11/11/2009 wrote: Hi guys! You should make a package what keeps anykind of tutorials and demos inside of it. Not just a devkit. Greetings from Finland!
Tomi on 11/11/2009 wrote: By the way, is possible to run .com or .bat -console programs inside of this?
Jammy on 12/4/2009 wrote: I can't seem to get the mouse working...The VGA is fine, but the mouse just doesn't work. It's always reported as 0,0. :( Was there any Mouse.Initialize or something that I needed to do?
Jammy on 12/5/2009 wrote: And even though I said the VGA is fine, i meant that the mode you used is fine. All the other modes don't work.

Post a comment