feat: Added wiimote support and cleaned up the project
This commit is contained in:
parent
36574bdf46
commit
baf15cdb0f
25 changed files with 263 additions and 69 deletions
27
SlidePresenter/ControllerSelector.cs
Normal file
27
SlidePresenter/ControllerSelector.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
namespace SwitchSlidePresenter;
|
||||
|
||||
public static class ControllerSelector {
|
||||
public static IGamepadReader? GetReader() {
|
||||
Console.WriteLine("Write a number to select controller type:");
|
||||
Console.WriteLine("[1] - JoyCon");
|
||||
Console.WriteLine("[2] - Wiimote");
|
||||
|
||||
string? line = Console.ReadLine();
|
||||
if (line == null) {
|
||||
Console.WriteLine("Invalid input.");
|
||||
return null;
|
||||
}
|
||||
if (!int.TryParse(line, out int id)) {
|
||||
Console.WriteLine("Invalid number.");
|
||||
return null;
|
||||
}
|
||||
|
||||
return GetReader(id);
|
||||
}
|
||||
|
||||
private static IGamepadReader? GetReader(int id) => id switch {
|
||||
1 => new JoyConRead(),
|
||||
2 => new WiimoteRead(),
|
||||
_ => null
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue