fixed multi input
This commit is contained in:
@@ -32,12 +32,14 @@ public partial class Main : Node2D {
|
||||
public override void _Input(InputEvent @event) {
|
||||
if (@event is InputEventMouseButton eventMouseButton) {
|
||||
|
||||
Vector2 mouse = GetViewport().GetMousePosition();
|
||||
if (eventMouseButton.IsPressed()) {
|
||||
Vector2 mouse = GetViewport().GetMousePosition();
|
||||
|
||||
float mappedX = mouse.X / (GetViewportRect().Size.X / mLevel.Resolution.X);
|
||||
float mappedY = mouse.Y / (GetViewportRect().Size.Y / mLevel.Resolution.Y);
|
||||
float mappedX = mouse.X / (GetViewportRect().Size.X / mLevel.Resolution.X);
|
||||
float mappedY = mouse.Y / (GetViewportRect().Size.Y / mLevel.Resolution.Y);
|
||||
|
||||
mLevel.WritePixel<Dirt>((int)mappedX, (int)mappedY, BrushSize);
|
||||
mLevel.WritePixel<Dirt>((int)mappedX, (int)mappedY, BrushSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user