VGAScreen does not works

Aug 7, 2011 at 7:33 AM

Hi. I have problem. I'm using this code:

VGAScreen.Setpixel(x, y, color);
But it does not works. must I use some 'using' command ? Please what I need for setpixel method? 

Aug 7, 2011 at 1:23 PM

At the top put using Cosmos.Hardware; and add tht to ur references

On Aug 7, 2011 3:33 AM, "Redge" <notifications@codeplex.com> wrote:

From: Redge

Hi. I have problem. I'm using this code:

VGAScreen.Setpixel(x, y, color);
But it does not works. must I use some 'using' command ? Please what I need for setpixel method?

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Aug 7, 2011 at 1:25 PM

I have done it, but that still not works. And whats tht?

Aug 7, 2011 at 1:32 PM

Did u right click references and add one called Cosmos.Hardware?

On Aug 7, 2011 9:26 AM, "Redge" <notifications@codeplex.com> wrote:

From: Redge

I have done it, but that still not works. And whats tht?



Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@di...

Aug 7, 2011 at 2:44 PM
Edited Aug 7, 2011 at 2:46 PM

I have it default. here's printscreen:

http://prntscr.com/2k2yj

Developer
Aug 7, 2011 at 6:41 PM

Your not going to just be able to do that, because VGAScreen is an instanced class, not a static class.

VGAScreen v = new VGAScreen();
v.SetMode320x200x8();

Then you need to setup the palette, I use the following function to create a mathmatically based palette, which allows me to quantize it much faster than against the standard VGA palette (I can't find the math behind the standard palette)

SetPaletteEntry(0, 0, 0, 0);
SetPaletteEntry(1, 255, 255, 255);
int i = 2;
for (int r = 0; r < 6; r++)
{
      for (int g = 0; g < 6; g++)
      {
          SetPaletteEntry(i, getForPallet((byte)(r * 42)), getForPallet((byte)(g * 42)), 0);
          i++;
          SetPaletteEntry(i, getForPallet((byte)(r * 42)), getForPallet((byte)(g * 42)), 42);
          i++;
          SetPaletteEntry(i, getForPallet((byte)(r * 42)), getForPallet((byte)(g * 42)), 84);
          i++;
          SetPaletteEntry(i, getForPallet((byte)(r * 42)), getForPallet((byte)(g * 42)), 126);
          i++;
          SetPaletteEntry(i, getForPallet((byte)(r * 42)), getForPallet((byte)(g * 42)), 168);
          i++;
          SetPaletteEntry(i, getForPallet((byte)(r * 42)), getForPallet((byte)(g * 42)), 210);
          i++;
          if (i < 256)
          {
                SetPaletteEntry(i, getForPallet((byte)(r * 42)), getForPallet((byte)(g * 42)), 255);
                i++;
          }
      }
}


private byte getForPallet(byte i)
{
    if (i > 210)
    {
        return 255;
    }
    else
    {
          return i;
    }
}


That gives me a palette which is much easier to work with.

SetPaletteEntry(0, 0, 0, 0);
SetPaletteEntry(1, 255, 255, 255);
int i = 2;
for (int r = 0; r < 6; r++)
{
for (int g = 0; g < 6; g++)
{
SetPaletteEntry(i, getForPallet((byte)(r * 42)), getForPallet((byte)(g * 42)), 0);
i++;
SetPaletteEntry(i, getForPallet((byte)(r * 42)), getForPallet((byte)(g * 42)), 42);
i++;
SetPaletteEntry(i, getForPallet((byte)(r * 42)), getForPallet((byte)(g * 42)), 84);
i++;
SetPaletteEntry(i, getForPallet((byte)(r * 42)), getForPallet((byte)(g * 42)), 126);
i++;
SetPaletteEntry(i, getForPallet((byte)(r * 42)), getForPallet((byte)(g * 42)), 168);
i++;
SetPaletteEntry(i, getForPallet((byte)(r * 42)), getForPallet((byte)(g * 42)), 210);
i++;
if (i < 256)
{
SetPaletteEntry(i, getForPallet((byte)(r * 42)), getForPallet((byte)(g * 42)), 255);
i++;
}
}
}
Aug 8, 2011 at 5:20 AM

VGAScreen class still does not works. 

Developer
Aug 9, 2011 at 9:52 PM

If VGAScreen is working fine in the latest build.
If you do as blah38621 says, everything should be fine.

 

Simplest way to test is:

 

VGAScreen v = new VGAScreen();
v.SetMode320x200x8();

 

Remember you need to have some kind of loop in as your main function.

Developer
Aug 9, 2011 at 9:53 PM
Edited Aug 9, 2011 at 11:25 PM

/Double Posted