A library to allow for setting individual pixels in a MonoGame project. Is easily extendable with your own functions for more advanced drawing.
- Follow the steps here.
- Search the package namespace seen above.
- Select the package under the
Packages
tab on the right. - Select the version you'd like to install
- Run the command listed above in the directory of the project you wish to install the package in.
Default* Extensions |
---|
SetPoint (this PixelControlLayer pcl, int x, int y, Color colour) |
SetLine (this PixelControlLayer pcl, int x1, int y1, int x2, int y2, Color colour) |
SetBox (this PixelControlLayer pcl, int x1, int y1, int x2, int y2, Color colour) |
SetCircle (this PixelControlLayer pcl, int centreX, int centreY, Color colour) |
*It is possible to add more extensions yourself; read more about the different components you're able to modify in PixelControlLayer
protected override void Initialize()
{
// define the pixel control layer using the graphics device to set the correct internal texture size
_pixelControlLayer = new PixelControlLayer(_graphics.GraphicsDevice);
// OR: define your own size
_pixelControlLayer = new PixelControlLayer(_graphics.GraphicsDevice, 64, 64);
base.Initialize();
}
protected override void Update()
{
// draw something to the pixel control layer
_pixelControlLayer.SetCircle(50, 50, 10, Color.Red);
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.Black);
_spriteBatch.Begin();
_pixelControlLayer.Draw(_spriteBatch); // assumes the default position of (0, 0)
_spriteBatch.End();
_pixelControlLayer.ClearBuffer(); // clear the internal buffer *after* drawing, otherwise it'll fail to draw
base.Draw(gameTime);
}