//Actually does the draw. private void DoDraw(int X, int Y, VMWareSVGAII vgaDriver, uint[][] mouseCol, bool allowBlack) { for (ushort x = 0; x < 20; x++) { for (ushort y = 0; y < 20; y++) { if (allowBlack || mouseCol[y][x] != 0) { vgaDriver.SetPixel((ushort)(X + x), (ushort)(Y + y), mouseCol[y][x]); } } } }
//Draws the mouse public void Draw(VMWareSVGAII vgaDriver) { //If the mouse hasn't moved, don't reset. if (lastDrawX != X || lastDrawY != Y) { //Clear the old mouse draw location. DoDraw(lastDrawX, lastDrawY, vgaDriver, lastDrawPosCols, true); //Store the existing colours where the mouse will now be. for (ushort x = 0; x < 20; x++) { for (ushort y = 0; y < 20; y++) { lastDrawPosCols[y][x] = vgaDriver.GetPixel((ushort)(X + x), (ushort)(Y + y)); } } //Updtae the last draw mouse position to the new position lastDrawX = X; lastDrawY = Y; } //Draw the mouse in it's current position - ensure it's always on top. DoDraw(X, Y, vgaDriver, mouseCols, false); }