WidowPushed
Introduction
Code Example
void CustomInitialize()
{
FlatRedBallServices.Game.IsMouseVisible = true;
}
void CustomActivity(bool firstTimeCalled)
{
var cursor = GuiManager.Cursor;
// This code is not necessary, but displays the WindowPushed in real time, which
// can help with debugging.
FlatRedBall.Debugging.Debugger.Write(cursor.WindowPushed);
if(cursor.PrimaryClick)
{
float worldX = cursor.WorldXAt(0);
float worldY = cursor.WorldYAt(0);
if(cursor.WindowPushed == RectangleButton)
{
var rectangle = new AxisAlignedRectangle();
rectangle.X = worldX;
rectangle.Y = worldY;
rectangle.Width = 32;
rectangle.Height = 32;
rectangle.Visible = true;
}
else if(cursor.WindowPushed == CircleButton)
{
var circle = new Circle();
circle.X = worldX;
circle.Y = worldY;
circle.Radius = 16;
circle.Visible = true;
}
}
}
Last updated
Was this helpful?