示例#1
0
 public static void DrawCursor(bool cursorShow)
 {
     if (cursorShow)
     {
         do
         {
         }while(MouseCtrl.ShowCursor(true) < 0);
     }
     else
     {
         do
         {
         }while(MouseCtrl.ShowCursor(false) >= 0);
     }
 }
示例#2
0
 private void ToggleFullScreen()
 {
     this.fullWindow = !this.fullWindow;
     this.GlobalData.presentParams.Windowed = !this.fullWindow;
     if (this.fullWindow && this.verticalSync)
     {
         if (this.presentInterval == 2)
         {
             this.GlobalData.presentParams.PresentationInterval = PresentInterval.Two;
         }
         else if (this.presentInterval == 3)
         {
             this.GlobalData.presentParams.PresentationInterval = PresentInterval.Three;
         }
     }
     else if (this.presentInterval == 2 || this.presentInterval == 3)
     {
         this.GlobalData.presentParams.PresentationInterval = PresentInterval.Immediate;
     }
     this.GlobalData.OnLostDevice();
     this.GlobalData.OnResetDevice();
     MouseCtrl.DrawCursor(!this.fullWindow);
 }
示例#3
0
 public Game_Main()
 {
     this.Form_Main              = new RenderForm_Main();
     this.Form_Main.FormClosing += new FormClosingEventHandler(this.Form_Main_FormClosing);
     this.Form_Main.Deactivate  += new EventHandler(this.Form_Main_Deactivate);
     this.Form_Main.Activated   += new EventHandler(this.Form_Main_Activated);
     MouseCtrl.DrawCursor(!this.fullWindow);
     Dpi.GetDpi();
     try
     {
         INI_RW iniRw = new INI_RW(".\\Setting.INI");
         if (iniRw.ExistINIFile())
         {
             this.fullWindow       = iniRw.IniReadValue("DirectX", "FullWindow") == "1";
             this.antiAlias        = iniRw.IniReadValue("DirectX", "AntiAlias") == "1";
             this.verticalSync     = iniRw.IniReadValue("DirectX", "VerticalSync") == "1";
             this.useDirectInput   = iniRw.IniReadValue("DirectInput", "UseDirectInput") == "1";
             this.GlobalData.Clear = iniRw.IniReadValue("Mode", "Clear") == "yes";
             this.singleThreaded   = iniRw.IniReadValue("Mode", "SingleThreaded") == "1";
             this.fixedFPS         = iniRw.IniReadValue("Mode", "FixedFPS") == "1";
             this.delayTolerance   = (int)Convert.ToInt16(iniRw.IniReadValue("Mode", "DelayTolerance"));
             this.windowSize       = (int)Convert.ToInt16(iniRw.IniReadValue("Mode", "WindowSize"));
             this.presentInterval  = (int)Convert.ToInt16(iniRw.IniReadValue("Mode", "PresentInterval"));
             this.mapkey.Left      = iniRw.IniReadValue("Key", "Left");
             this.mapkey.Right     = iniRw.IniReadValue("Key", "Right");
             this.mapkey.Up        = iniRw.IniReadValue("Key", "Up");
             this.mapkey.Down      = iniRw.IniReadValue("Key", "Down");
             this.mapkey.Slow      = iniRw.IniReadValue("Key", "Slow");
             this.mapkey.Shoot     = iniRw.IniReadValue("Key", "Shoot");
             this.mapkey.Bomb      = iniRw.IniReadValue("Key", "Bomb");
             MapJoyStick.Skip      = (int)Convert.ToInt16(iniRw.IniReadValue("JoyStick", "Skip"));
             MapJoyStick.Pause     = (int)Convert.ToInt16(iniRw.IniReadValue("JoyStick", "Pause"));
             MapJoyStick.Slow      = (int)Convert.ToInt16(iniRw.IniReadValue("JoyStick", "Slow"));
             MapJoyStick.Shoot     = (int)Convert.ToInt16(iniRw.IniReadValue("JoyStick", "Shoot"));
             MapJoyStick.Bomb      = (int)Convert.ToInt16(iniRw.IniReadValue("JoyStick", "Bomb"));
             MapJoyStick.C         = (int)Convert.ToInt16(iniRw.IniReadValue("JoyStick", "C"));
             this.bgmVolume        = (int)Convert.ToInt16(iniRw.IniReadValue("Volume", "BGMVolume"));
             this.seVolume         = (int)Convert.ToInt16(iniRw.IniReadValue("Volume", "SEVolume"));
             this.fontType         = iniRw.IniReadValue("Game", "FontType");
         }
     }
     catch
     {
         int num = (int)MessageBox.Show("读取配置文件失败", "Setting Load Error");
     }
     if (this.windowSize == 1)
     {
         this.Form_Main.ClientSize = new Size(800, 600);
     }
     else if (this.windowSize == 2)
     {
         this.Form_Main.ClientSize = new Size(1024, 768);
     }
     if (!this.Direct3DInit())
     {
         Application.ExitThread();
     }
     else
     {
         this.initSuccess = true;
         if (this.useDirectInput)
         {
             this.KCapture = new KeyboardCapture(this.Form_Main.Handle);
             this.JCapture = new JoystickCapture(this.Form_Main.Handle);
         }
         else
         {
             this.Form_Main.KeyDown += new KeyEventHandler(this.Form_Main_KeyDown);
             this.Form_Main.KeyUp   += new KeyEventHandler(this.Form_Main_KeyUp);
         }
         this.PresentState = (IGameState) new GameState_SplashScreen(this.GlobalData);
         this.PresentState.Init();
         this.PresentState.BGM_ON();
         this.GlobalData.LoadResources1();
         this.LoadingThread = new Thread(new ThreadStart(this.AddState));
         this.LoadingThread.Start();
     }
     //    SourseForm sourseForm = new SourseForm();
     //    sourseForm.Show();
 }