-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
46 lines (33 loc) · 1.34 KB
/
Program.cs
File metadata and controls
46 lines (33 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using SDL2;
namespace GameControllers2MIDI
{
class Program
{
[STAThread]
static void Main(string[] args)
{
SDL.SDL_Init(SDL.SDL_INIT_GAMECONTROLLER);
// Initialize WinForms
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
DeviceManager deviceManager = new DeviceManager();
deviceManager.StartUpdating();
MappingManager mappingManager = new MappingManager();
MidiManager midiManager = new MidiManager(deviceManager, mappingManager);
UIManager uiManager = new UIManager(mappingManager, deviceManager, midiManager);
deviceManager.ScanDevices();
// Set timer & connect to events
var timer = new System.Timers.Timer(300); // Check device connecting status every 300ms
timer.Elapsed += (sender, e) =>
{
deviceManager.UpdateControllerList();
deviceManager.CheckActiveController();
};
deviceManager.ControllerListUpdated += uiManager.UpdateControllerDropdown;
deviceManager.ControllerDisconnected += uiManager.ShowControllerDisconnectedWarning;
timer.Start();
// Execute UI
Application.Run(uiManager);
}
}
}