This project is read-only.

Open Source Screen Driver for COSMOS?

Sep 3, 2011 at 10:56 PM

Sorry if this is a simplequestion/covered before, but I was wondering how I would use the latest COSMOS source (http://cosmos.codeplex.com/SourceControl/changeset/changes/83209) to modify a pixel on the screen? I really just need some simple functionality; setting a pixel's color, getting/setting the resolution, and that's pretty much it. Is there any open source code for that, or would I need to start from scratch ?

Sep 3, 2011 at 11:00 PM

The actual drawing is done in the VGAScreen class in Cosmos.Hardware, but if your looking for code demonstrating how to draw various things, as well as how to make a window system, you want the Orvid.Graphics, and OForms folders in the Orvid folder, in the Users folder.

Sep 3, 2011 at 11:05 PM
blah38621 wrote:

The actual drawing is done in the VGAScreen class in Cosmos.Hardware, but if your looking for code demonstrating how to draw various things, as well as how to make a window system, you want the Orvid.Graphics, and OForms folders in the Orvid folder, in the Users folder.


When I look through VGAScreen, all I see is GetPixelDelegate, SetPixelDelegate, and TextSize...which one would I use to modify a pixel?

 

Thanks!

Sep 3, 2011 at 11:08 PM

You should also have a method in there to set a mode as well, after you've done that, the SetPixel and GetPixel delegates are callable like normal methods.

Sep 3, 2011 at 11:19 PM
blah38621 wrote:

You should also have a method in there to set a mode as well, after you've done that, the SetPixel and GetPixel delegates are callable like normal methods.


Ah, thanks!

Sep 4, 2011 at 12:44 AM
blah38621 wrote:

You should also have a method in there to set a mode as well, after you've done that, the SetPixel and GetPixel delegates are callable like normal methods.


bargh...i'm new to tis :P

so I first do...

 

var screen = new Cosmos.Hardware.VGAScreen();

screen.SetPixel(uint x, uint y, uint c);

 

I'm assuming x/y are the coordinates of the pixel, but what's c ? thanks for all the help :)

Sep 4, 2011 at 12:47 AM

you have to setup the mode before you can set any pixels.

 Also, the c is the index on the 256 color palette (which you have to setup, look in the vgadriver class in Orvid.Graphics.Cosmos for a mathmatical setup for the palette)

Sep 4, 2011 at 1:02 AM
blah38621 wrote:

you have to setup the mode before you can set any pixels.

 Also, the c is the index on the 256 color palette (which you have to setup, look in the vgadriver class in Orvid.Graphics.Cosmos for a mathmatical setup for the palette)


OK, so it looks like this is above my simple head :P but i'll try once last time to understand this. could you provide some code on how to setup the mode ? i've tried

screen.SetMode320x200x8();

 

but that just shows a bunch of random lines O.-

Sep 4, 2011 at 1:14 AM

Which is exactly what it's supposed to due, those lines are the data that was already in the buffer. you need to clear the buffer if you want those to go away. (there should be a clear method in the class.)

Mar 12, 2012 at 9:58 PM
Edited Mar 12, 2012 at 9:58 PM

What arguments do you use for the clear() class? It requires an integer that represents a color...

Mar 13, 2012 at 10:58 PM
Nickersoft wrote:

What arguments do you use for the clear() class? It requires an integer that represents a color...

Yeah it wants to know what color to clear the screen to. =). - Matt