Ejemplo n.º 1
0
        /// <summary>
        /// メインメソッド
        /// </summary>
        internal static void Main()
        {
            /*前処理*/
            DX.SetOutApplicationLogValidFlag(DX.FALSE);                     //ログを出力しない
            DX.SetMainWindowText("MachShooting");                           //タイトル設定
            DX.ChangeWindowMode(Config.Instance.Full ? DX.FALSE : DX.TRUE); //ウィンドウモード

            /*DXライブラリの読み込み*/
            if (DX.DxLib_Init() == -1)
            {
                DX.DxLib_End();
                Environment.Exit(0);
            }

            /*ライブラリの設定*/
            DX.SetDrawScreen(DX.DX_SCREEN_BACK);//裏画面に描画する設定
            DX.SetDrawMode(DX.DX_DRAWMODE_BILINEAR);

            title = new Title();
            while (true)
            {
                int startTime = DX.GetNowCount();                                                         //フレームの始まった時間を取得
                Fps.Instance.Update();
                string fpsString = "FPS:" + Fps.Instance.FPS.ToString("#0.0");                            //FPS取得
                uint   fpsColor  = Fps.Instance.FPS > 55 ? DXColor.Instance.White : DXColor.Instance.Red; //FPSが55以下なら赤で描画

                if (count % Config.Instance.FrameSkip == 0)
                {
                    if (DX.ClearDrawScreen() != 0)//画面消去。×が押されたら終了
                    {
                        DX.DxLib_End();
                        Environment.Exit(0);
                    }
                }

                SE.Instance.Update();

                Key.Instance.Update();

                Update();
                if (count % Config.Instance.FrameSkip == 0)
                {
                    DX.DrawStringToHandle(0, 0, fpsString, fpsColor, Font.Instance.Font16);
                }


                if (count % Config.Instance.FrameSkip == 0)
                {
                    DX.ScreenFlip();                                        //裏画面を表画面に表示
                }
                if (DX.ProcessMessage() != 0)
                {
                    DX.DxLib_End();
                    Environment.Exit(0);
                }

                while (DX.GetNowCount() - startTime < 17)
                {
                    ;                                         //1周の処理が17ミリ秒になるまで待つ
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// タイトル画面、ゲーム画面等を場合に応じて呼び出します
 /// </summary>
 private static void Update()
 {
     if (Program.title != null)//タイトル画面なら
     {
         Program.title.Process();
         if (count % Config.Instance.FrameSkip == 0)
         {
             Program.title.Draw();
         }
         if (!Program.title.Need)
         {
             Program.title         = null;
             Program.equipmentMenu = new TreeMenu <PlayerHeader>(Program.ZIKI_MSG, Script.PlayerH);
         }
     }
     else if (Program.equipmentMenu != null)//装備選択画面なら
     {
         Program.equipmentMenu.Process();
         if (count % Config.Instance.FrameSkip == 0)
         {
             Program.equipmentMenu.Draw();
         }
         if (!Program.equipmentMenu.Need)
         {
             Program.equipment     = Program.equipmentMenu.Header;
             Program.equipmentMenu = null;
             Program.missionMenu   = new TreeMenu <EnemyHeader>("敵を選択して下さい。", Script.EnemyH);
         }
     }
     else if (Program.missionMenu != null)//敵選択画面なら
     {
         Program.missionMenu.Process();
         if (count % Config.Instance.FrameSkip == 0)
         {
             Program.missionMenu.Draw();
         }
         if (!Program.missionMenu.Need)
         {
             if (Program.missionMenu.Decision)
             {
                 Program.missionData = Program.missionMenu.Header;//ミッションデータ取得
                 Program.missionMenu = null;
                 Program.game        = new Game(Program.missionData, Program.equipment);
             }
             else
             {
                 Program.missionMenu   = null;
                 Program.equipmentMenu = new TreeMenu <PlayerHeader>(Program.ZIKI_MSG, Script.PlayerH);
             }
         }
     }
     else//ゲーム画面なら
     {
         Program.game.Process();
         if (count % Config.Instance.FrameSkip == 0)
         {
             Program.game.Draw();
         }
         if (!Program.game.Need)
         {
             DX.SetBackgroundColor(0, 0, 0);
             Program.game          = null;
             Program.equipmentMenu = new TreeMenu <PlayerHeader>(Program.ZIKI_MSG, Script.PlayerH);
         }
     }
     count++;
 }