SpriteController Constructor (PictureBox, EventHandler) |
Create a sprite controller, specifying the picturebox on which the sprites
will be displayed.
Namespace:
SpriteLibrary
Assembly:
SpriteLibrary (in SpriteLibrary.dll) Version: 1.0.0.5 (1.0.0.5)
Syntaxpublic SpriteController(
PictureBox Area,
EventHandler TimerTickMethod
)
Parameters
- Area
- Type: System.Windows.FormsPictureBox
The picturebox that the sprites will be drawn in - TimerTickMethod
- Type: SystemEventHandler
A function on the form that you want to have run every tick
Examples
This is an example of a Form class that defines a SpriteController. The MainDrawingArea is a
PictureBox. While defining the SpriteController, we
are also setting a function used for the
DoTick. event.
public partial class ShootingFieldForm : Form
{
public ShootingFieldForm()
{
InitializeComponent();
MainDrawingArea.BackgroundImage = Properties.Resources.Background;
MainDrawingArea.BackgroundImageLayout = ImageLayout.Stretch;
MySpriteController = new SpriteController(MainDrawingArea, CheckForKeyPress);
}
private void CheckForKeyPress(object sender, EventArgs e)
{
}
}
See Also