Пример #1
0
 public void HandleKeyUp(KeyboardKeyEventArgs e, Nes nes)
 {
     if (m_ButtonsByKey.TryGetValue(e.Key, out var button))
     {
         nes.SetControllerButtonPressed(button, false);
     }
 }
Пример #2
0
        public static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine($"Nesemuto v{k_Version}");
                Console.WriteLine("usage: nesemuto pathToGameFile [pathToCheatFile]");
                return;
            }

            Nes nes;

            try
            {
                string gamePath  = args[0];
                string cheatPath = args.Length >= 2 ? args[1] : null;
                nes = new Nes(gamePath, cheatPath);
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine($"Error: {ex.Message}");
                return;
            }

            using (nes)
            {
                using (var window = new EmulatorWindow(nes, VSyncMode.On))
                {
                    const int nesFramesPerSecond = 60;
                    window.Run(0, nesFramesPerSecond);
                }
            }
        }
Пример #3
0
 public EmulatorWindow(Nes nes, VSyncMode vSyncMode) :
     base(k_NesScreenWidth * k_DefaultScreenSizeMultiplier,
          k_NesScreenHeight * k_DefaultScreenSizeMultiplier,
          GraphicsMode.Default, k_Title)
 {
     VSync = vSyncMode;
     m_Nes = nes;
 }