FillRectangle 4 Comments
public static void FillRectangle(uint lx, uint ly, uint sx, uint sy, uint colour)
{
for (uint xx = lx; xx < sx + lx; xx++)
{
for (uint yy = ly; yy < sy + ly; yy++)
{
if(xx <= 319 && xx >= 0)
screenbuffer[yy * 320 + xx] = colour; //If you are using a uint[] as a screen buffer, use this, otherwise use this:
//Screen.SetPixel320x200x8(xx, yy, colour);
}
}
}
for this to work you use have
using Cosmos.Hardware;
using Screen = Cosmos.Hardware.VGAScreen;
private static uint[] screenbuffer = new uint[512000]; //Optional, you don’t need a buffer, but I recommend it;
and have added colors to the palette and added:
Screen.SetMode320x200x8();
before the main loop.
Very nice function; any ideas for drawing ellipses? You could make a COSMOS graphics library
Ah, I saw something on them a while ago…
http://www.brackeen.com/vga/source/djgpp20/circle.c.html
It’s written in C, but I don’t think it should be too hard to port to C#
what the hell dude? dont spam!
Yeah, sorry for the spam. People hate me… D; I try to clean it up everyday…