A MonoGame 3.8.* sample demonstrating multi-touch input and drawing functionality. This sample allows users to draw on the screen using touch input or mouse, with support for multiple simultaneous touch points.
- Multi-touch drawing support
- Colorful brush strokes for multiple touch points
- Screen clearing functionality (Space key or gamepad A button)
- Cross-platform support for Windows, DesktopGL, iOS, and Android
This sample uses a modern, multi-project structure:
/Core— Shared game logic (Game1.cs,MultiTouch.Core.csproj)/Platforms/Windows— Windows DirectX entry point and project/Platforms/Desktop— DesktopGL entry point and project/Platforms/Android— Android entry point and project/Platforms/iOS— iOS entry point and project/Content— Game assets (textures)
Each platform folder contains its own .csproj and entry point, referencing the shared /Core project.
- .NET 8.0 or later
- MonoGame 3.8.* (installed via NuGet packages)
- For Android: Android SDK and appropriate build tools
- For iOS: Xcode and iOS development tools (macOS only)
- Open
MultiTouch.slnin Visual Studio - Set the desired platform project as the startup project (e.g.,
Platforms/Windows/MultiTouch.Windows.csproj) - Build and run (F5)
- Open the project folder in VS Code
- Use Ctrl+Shift+P and run "Tasks: Run Task"
- Select one of:
build-windows/run-windowsbuild-desktopgl/run-desktopglbuild-android/run-androidbuild-ios/run-ios
Or use the launch configurations in .vscode/launch.json for debugging.
dotnet build Platforms/Windows/MultiTouch.Windows.csproj
dotnet run --project Platforms/Windows/MultiTouch.Windows.csproj dotnet build Platforms/Desktop/MultiTouch.DesktopGL.csproj
dotnet run --project Platforms/Desktop/MultiTouch.DesktopGL.csproj dotnet build Platforms/Android/MultiTouch.Android.csproj
# Deploy to connected device or emulator
dotnet build Platforms/Android/MultiTouch.Android.csproj -t:Run dotnet build Platforms/iOS/MultiTouch.iOS.csproj
# Deploy to connected device or simulator
dotnet build Platforms/iOS/MultiTouch.iOS.csproj -t:Run- Touch/Mouse: Draw on the screen
- Space or Gamepad A: Clear the screen
- Escape or Gamepad Back: Exit the application
/Core
Game1.cs
MultiTouch.Core.csproj
/Platforms
/Windows
MultiTouch.Windows.csproj
Program.cs
/Desktop
MultiTouch.DesktopGL.csproj
Program.cs
/Android
MultiTouch.Android.csproj
MainActivity.cs
/iOS
MultiTouch.iOS.csproj
Program.cs
/Content
sqbrush.png
circle.png
The sample uses the following content files:
sqbrush.png— Brush texture for drawingcircle.png— Circle texture (unused in current implementation)
These are included as .xnb files and loaded directly without requiring MonoGame Content Pipeline compilation.
- This project has been modernized to use:
- .NET 8.0 target frameworks
- SDK-style project files
- MonoGame 3.8.* NuGet packages
- Modern C# code patterns
- Platform-specific folders and entry points (no more
#if/#endifblocks)
- The accelerometer functionality from the original sample has been replaced with keyboard/gamepad input for cross-platform compatibility