-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add monogamedebugger config to template (when monogame and using proj…
… refs)
- Loading branch information
Showing
3 changed files
with
50 additions
and
14 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
templates/template_code/SadConsole.Examples.Demo.CSharp/Configuration/MonoGameDebugger.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
namespace SadConsole.Configuration; | ||
|
||
internal static class MonoGameDebuggerExtensions | ||
{ | ||
public static Builder KeyhookMonoGameDebugger(this Builder builder) | ||
{ | ||
builder.GetOrCreateConfig<MonoGameDebugger>(); | ||
return builder; | ||
} | ||
|
||
internal static void Game_FrameUpdate(object? sender, GameHost e) | ||
{ | ||
if (e.Keyboard.IsKeyPressed(Input.Keys.F12)) | ||
{ | ||
#if PROJREFS && MONOGAME | ||
SadConsole.Debug.MonoGame.Debugger.Start(); | ||
#endif | ||
} | ||
} | ||
} | ||
|
||
internal class MonoGameDebugger : IConfigurator | ||
{ | ||
public void Run(Builder config, Game game) => | ||
game.FrameUpdate += MonoGameDebuggerExtensions.Game_FrameUpdate; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters