Example #1
0
        //
        //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
        //
        public int Perform(string title, string[] items, int selectIndex)
        {
            DDCurtain.SetCurtain();
            DDEngine.FreezeInput();

            for (; ;)
            {
                if (this.MouseUsable)
                {
                    DDMouse.UpdatePos();

                    int musSelIdxY = DDMouse.Y - (this.Y + this.YStep);

                    if (0 <= musSelIdxY)
                    {
                        int musSelIdx = musSelIdxY / this.YStep;

                        if (musSelIdx < items.Length)
                        {
                            selectIndex = musSelIdx;
                        }
                    }
                    if (DDMouse.L.GetInput() == -1)
                    {
                        break;
                    }
                    if (DDMouse.R.GetInput() == -1)
                    {
                        selectIndex = items.Length - 1;
                        break;
                    }
                }

                bool chgsel = false;

                if (DDInput.A.IsPound())
                {
                    break;
                }
                if (DDInput.B.IsPound())
                {
                    if (selectIndex == items.Length - 1)
                    {
                        break;
                    }

                    selectIndex = items.Length - 1;
                    chgsel      = true;
                }
                if (DDInput.DIR_8.IsPound())
                {
                    selectIndex--;
                    chgsel = true;
                }
                if (DDInput.DIR_2.IsPound())
                {
                    selectIndex++;
                    chgsel = true;
                }

                selectIndex += items.Length;
                selectIndex %= items.Length;

                if (this.MouseUsable && chgsel)
                {
                    DDMouse.X = 0;
                    DDMouse.Y = this.Y + (selectIndex + 1) * this.YStep + this.YStep / 2;

                    DDMouse.ApplyPos();
                }

                DDCurtain.DrawCurtain();

                if (this.WallColor != null)
                {
                    DX.DrawBox(0, 0, DDConsts.Screen_W, DDConsts.Screen_H, DDUtils.GetColor(this.WallColor.Value), 1);
                }

                if (this.WallPicture != null)
                {
                    DDDraw.DrawRect(this.WallPicture, 0, 0, DDConsts.Screen_W, DDConsts.Screen_H);
                    //DDDraw.DrawCenter(this.WallPicture, DDConsts.Screen_W / 2.0, DDConsts.Screen_H / 2.0); // old
                    DDCurtain.DrawCurtain(this.WallCurtain);
                }
                if (this.Color != null)
                {
                    DDPrint.SetColor(this.Color.Value);
                }

                if (this.BorderColor != null)
                {
                    DDPrint.SetBorder(this.BorderColor.Value);
                }

                DDPrint.SetPrint(this.X, this.Y, this.YStep);
                //DDPrint.SetPrint(16, 16, 32); // old
                DDPrint.Print(title + " (Mouse=" + this.MouseUsable + ")");
                DDPrint.PrintRet();

                for (int c = 0; c < items.Length; c++)
                {
                    DDPrint.Print(string.Format("[{0}] {1}", selectIndex == c ? ">" : " ", items[c]));
                    DDPrint.PrintRet();
                }
                DDPrint.Reset();

                DDEngine.EachFrame();
            }
            DDEngine.FreezeInput();

            return(selectIndex);
        }
Example #2
0
        public static void GameStart()
        {
            foreach (string dllFile in "DxLib.dll:DxLib_x64.dll:DxLibDotNet.dll".Split(':'))             // DxLibDotNet.dll 等の存在確認 (1)
            {
                if (File.Exists(dllFile) == false)
                {
                    throw new DDError();
                }
            }

            DX.GetColor(0, 0, 0);        // DxLibDotNet.dll 等の存在確認 (2)

            DDConfig.Load();             // LogFile, LOG_ENABLED 等を含むので真っ先に

            // Log >

            File.WriteAllBytes(DDConfig.LogFile, BinTools.EMPTY);

            ProcMain.WriteLog = message =>
            {
                if (LogCount < DDConfig.LogCountMax)
                {
                    using (StreamWriter writer = new StreamWriter(DDConfig.LogFile, true, Encoding.UTF8))
                    {
                        writer.WriteLine("[" + DateTime.Now + "] " + message);
                    }
                    LogCount++;
                }
            };

            // < Log

            // *.INIT
            {
                DDGround.INIT();
                DDResource.INIT();
                DDDatStrings.INIT();
                DDUserDatStrings.INIT();
                DDFontRegister.INIT();
                DDKey.INIT();
            }

            DDSaveData.Load();

            // DxLib >

            if (DDConfig.LOG_ENABLED)
            {
                DX.SetApplicationLogSaveDirectory(FileTools.MakeFullPath(DDConfig.ApplicationLogSaveDirectory));
            }

            DX.SetOutApplicationLogValidFlag(DDConfig.LOG_ENABLED ? 1 : 0); // DxLib のログを出力 1: する 0: しない

            DX.SetAlwaysRunFlag(1);                                         // ? 非アクティブ時に 1: 動く 0: 止まる

            SetMainWindowTitle();

            //DX.SetGraphMode(DDConsts.Screen_W, DDConsts.Screen_H, 32);
            DX.SetGraphMode(DDGround.RealScreen_W, DDGround.RealScreen_H, 32);
            DX.ChangeWindowMode(1);             // 1: ウィンドウ 0: フルスクリーン

            //DX.SetFullSceneAntiAliasingMode(4, 2); // フルスクリーンを廃止したので不要

            DX.SetWindowIconHandle(GetAppIcon());             // ウィンドウ左上のアイコン

            if (DDConfig.DisplayIndex != -1)
            {
                DX.SetUseDirectDrawDeviceIndex(DDConfig.DisplayIndex);
            }

            if (DX.DxLib_Init() != 0)             // ? 失敗
            {
                throw new DDError();
            }

            Finalizers.Add(() =>
            {
                if (DX.DxLib_End() != 0)                 // ? 失敗
                {
                    throw new DDError();
                }
            });

            DDUtils.SetMouseDispMode(DDGround.RO_MouseDispMode); // ? マウスを表示する。
            DX.SetWindowSizeChangeEnableFlag(0);                 // ウィンドウの右下をドラッグで伸縮 1: する 0: しない

            DX.SetDrawScreen(DX.DX_SCREEN_BACK);
            DX.SetDrawMode(DX.DX_DRAWMODE_BILINEAR);             // これをデフォルトとする。

            // < DxLib

            {
                int l;
                int t;
                int w;
                int h;
                int p1;
                int p2;
                int p3;
                int p4;

                DX.GetDefaultState(out w, out h, out p1, out p2, out l, out t, out p3, out p4);

                if (
                    w < 1 || IntTools.IMAX < w ||
                    h < 1 || IntTools.IMAX < h ||
                    l < -IntTools.IMAX || IntTools.IMAX < l ||
                    t < -IntTools.IMAX || IntTools.IMAX < t
                    )
                {
                    throw new DDError();
                }

                DDGround.MonitorRect = new I4Rect(l, t, w, h);
            }

            PostSetScreenSize(DDGround.RealScreen_W, DDGround.RealScreen_H);

            DDGround.GeneralResource = new DDGeneralResource();

            DDAdditionalEvents.PostGameStart();
            DDAdditionalEvents.PostGameStart_G2();

            DDSaveData.Load_Delay();
        }
Example #3
0
        //
        //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
        //
        public int IntVolumeConfig(string title, int value, int minval, int maxval, int valStep, int valFastStep, Action <int> valChanged, Action pulse)
        {
            const int PULSE_FRM = 60;

            int origval = value;

            DDCurtain.SetCurtain();
            DDEngine.FreezeInput();

            for (; ;)
            {
                bool chgval = false;

                if (DDInput.A.IsPound() || this.MouseUsable && DDMouse.L.GetInput() == -1)
                {
                    break;
                }
                if (DDInput.B.IsPound() || this.MouseUsable && DDMouse.R.GetInput() == -1)
                {
                    if (value == origval)
                    {
                        break;
                    }

                    value  = origval;
                    chgval = true;
                }
                if (this.MouseUsable)
                {
                    value += DDMouse.Rot;
                    chgval = true;
                }
                if (DDInput.DIR_8.IsPound())
                {
                    value += valFastStep;
                    chgval = true;
                }
                if (DDInput.DIR_6.IsPound())
                {
                    value += valStep;
                    chgval = true;
                }
                if (DDInput.DIR_4.IsPound())
                {
                    value -= valStep;
                    chgval = true;
                }
                if (DDInput.DIR_2.IsPound())
                {
                    value -= valFastStep;
                    chgval = true;
                }
                if (chgval)
                {
                    value = IntTools.ToRange(value, minval, maxval);
                    valChanged(value);
                }
                if (DDEngine.ProcFrame % PULSE_FRM == 0)
                {
                    pulse();
                }

                DDCurtain.DrawCurtain();

                if (this.WallColor != null)
                {
                    DX.DrawBox(0, 0, DDConsts.Screen_W, DDConsts.Screen_H, DDUtils.GetColor(this.WallColor.Value), 1);
                }

                if (this.WallPicture != null)
                {
                    DDDraw.DrawRect(this.WallPicture, 0, 0, DDConsts.Screen_W, DDConsts.Screen_H);
                    DDCurtain.DrawCurtain(this.WallCurtain);
                }
                if (this.Color != null)
                {
                    DDPrint.SetColor(this.Color.Value);
                }

                if (this.BorderColor != null)
                {
                    DDPrint.SetBorder(this.BorderColor.Value);
                }

                DDPrint.SetPrint(this.X, this.Y, this.YStep);
                DDPrint.Print(title);
                DDPrint.PrintRet();

                DDPrint.Print(string.Format("[{0}] 最小={1} 最大={2}", value, minval, maxval));
                DDPrint.PrintRet();

                DDPrint.Print("★ 左=下げる");
                DDPrint.PrintRet();
                DDPrint.Print("★ 右=上げる");
                DDPrint.PrintRet();
                DDPrint.Print("★ 下=速く下げる");
                DDPrint.PrintRet();
                DDPrint.Print("★ 上=速く上げる");
                DDPrint.PrintRet();
                DDPrint.Print("★ 調整が終わったら決定ボタンを押して下さい。");
                DDPrint.PrintRet();

                DDEngine.EachFrame();
            }
            DDEngine.FreezeInput();

            return(value);
        }
Example #4
0
 //
 //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
 //
 public DDSimpleMenu()
     : this(DDUtils.GetMouseDispMode())
 {
 }
Example #5
0
 //
 //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
 //
 public static void DrawString(int x, int y, string str, DDFont font, bool tategakiFlag, I3Color color, I3Color edgeColor)
 {
     DX.DrawStringToHandle(x, y, str, DDUtils.GetColor(color), font.GetHandle(), DDUtils.GetColor(edgeColor), tategakiFlag ? 1 : 0);
 }
Example #6
0
        //
        //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
        //
        public void PadConfig()
        {
            ButtonInfo[] btnInfos = new ButtonInfo[]
            {
#if false // 例
                // discmt >

                new ButtonInfo(DDInput.DIR_2, "下"),
                new ButtonInfo(DDInput.DIR_4, "左"),
                new ButtonInfo(DDInput.DIR_6, "右"),
                new ButtonInfo(DDInput.DIR_8, "上"),
                new ButtonInfo(DDInput.A, "Aボタン"),
                new ButtonInfo(DDInput.B, "Bボタン"),
                new ButtonInfo(DDInput.C, "Cボタン"),
                //new ButtonInfo(DDInput.D, ""), // 使用しないボタン
                //new ButtonInfo(DDInput.E, ""), // 使用しないボタン
                //new ButtonInfo(DDInput.F, ""), // 使用しないボタン
                new ButtonInfo(DDInput.L, "Lボタン"),
                new ButtonInfo(DDInput.R, "Rボタン"),
                //new ButtonInfo(DDInput.PAUSE, ""), // 使用しないボタン
                //new ButtonInfo(DDInput.START, ""), // 使用しないボタン

                // < discmt
#else
                // app > @ btnInfos

                new ButtonInfo(DDInput.DIR_2, "下"),
                new ButtonInfo(DDInput.DIR_4, "左"),
                new ButtonInfo(DDInput.DIR_6, "右"),
                new ButtonInfo(DDInput.DIR_8, "上"),
                new ButtonInfo(DDInput.A, "ショットボタン"),
                new ButtonInfo(DDInput.B, "低速ボタン"),
                new ButtonInfo(DDInput.C, "ボムボタン"),
                //new ButtonInfo(DDInput.D, ""),
                //new ButtonInfo(DDInput.E, ""),
                //new ButtonInfo(DDInput.F, ""),
                //new ButtonInfo(DDInput.L, ""),
                //new ButtonInfo(DDInput.R, ""),
                new ButtonInfo(DDInput.PAUSE, "ポーズボタン"),
                //new ButtonInfo(DDInput.START, ""),

                // < app
#endif
            };

            foreach (ButtonInfo btnInfo in btnInfos)
            {
                btnInfo.Button.Backup();
            }

            try
            {
                foreach (ButtonInfo btnInfo in btnInfos)
                {
                    btnInfo.Button.BtnId = -1;
                }

                DDCurtain.SetCurtain();
                DDEngine.FreezeInput();

                int currBtnIndex = 0;

                while (currBtnIndex < btnInfos.Length)
                {
                    if (DDKey.GetInput(DX.KEY_INPUT_SPACE) == 1)
                    {
                        return;
                    }
                    if (DDKey.GetInput(DX.KEY_INPUT_Z) == 1)
                    {
                        currBtnIndex++;
                        goto endInput;
                    }

                    {
                        int pressBtnId = -1;

                        for (int padId = 0; padId < DDPad.GetPadCount(); padId++)
                        {
                            for (int btnId = 0; btnId < DDPad.PAD_BUTTON_MAX; btnId++)
                            {
                                if (DDPad.GetInput(padId, btnId) == 1)
                                {
                                    pressBtnId = btnId;
                                }
                            }
                        }

                        for (int c = 0; c < currBtnIndex; c++)
                        {
                            if (btnInfos[c].Button.BtnId == pressBtnId)
                            {
                                pressBtnId = -1;
                            }
                        }

                        if (pressBtnId != -1)
                        {
                            btnInfos[currBtnIndex].Button.BtnId = pressBtnId;
                            currBtnIndex++;
                        }
                    }
endInput:

                    DDCurtain.DrawCurtain();

                    if (this.WallColor != null)
                    {
                        DX.DrawBox(0, 0, DDConsts.Screen_W, DDConsts.Screen_H, DDUtils.GetColor(this.WallColor.Value), 1);
                    }

                    if (this.WallPicture != null)
                    {
                        DDDraw.DrawRect(this.WallPicture, 0, 0, DDConsts.Screen_W, DDConsts.Screen_H);
                        //DDDraw.DrawCenter(this.WallPicture, DDConsts.Screen_W / 2.0, DDConsts.Screen_H / 2.0); // old
                        DDCurtain.DrawCurtain(this.WallCurtain);
                    }
                    if (this.Color != null)
                    {
                        DDPrint.SetColor(this.Color.Value);
                    }

                    if (this.BorderColor != null)
                    {
                        DDPrint.SetBorder(this.BorderColor.Value);
                    }

                    DDPrint.SetPrint(this.X, this.Y, this.YStep);
                    //DDPrint.SetPrint(16, 16, 32); // old
                    DDPrint.Print("ゲームパッドのボタン設定");
                    DDPrint.PrintRet();

                    for (int c = 0; c < btnInfos.Length; c++)
                    {
                        DDPrint.Print(string.Format("[{0}] {1}", currBtnIndex == c ? ">" : " ", btnInfos[c].Name));

                        if (c < currBtnIndex)
                        {
                            int btnId = btnInfos[c].Button.BtnId;

                            DDPrint.Print(" -> ");

                            if (btnId == -1)
                            {
                                DDPrint.Print("割り当てナシ");
                            }
                            else
                            {
                                DDPrint.Print("" + btnId);
                            }
                        }
                        DDPrint.PrintRet();
                    }
                    DDPrint.Print("★ カーソルの機能に割り当てるボタンを押して下さい。");
                    DDPrint.PrintRet();
                    DDPrint.Print("★ [Z]を押すとボタンの割り当てをスキップします。");
                    DDPrint.PrintRet();
                    DDPrint.Print("★ スペースを押すとキャンセルします。");
                    DDPrint.PrintRet();

                    if (this.MouseUsable)
                    {
                        DDPrint.Print("★ 右クリックするとキャンセルします。");
                        DDPrint.PrintRet();

                        if (DDMouse.R.GetInput() == -1)
                        {
                            return;
                        }
                    }

                    DDEngine.EachFrame();
                }
                btnInfos = null;
            }
            finally
            {
                if (btnInfos != null)
                {
                    foreach (ButtonInfo info in btnInfos)
                    {
                        info.Button.Restore();
                    }
                }

                DDEngine.FreezeInput();
            }
        }
Example #7
0
        //
        //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
        //
        public static void Load()
        {
            if (File.Exists(DDConsts.SaveDataFile) == false)
            {
                return;
            }

            byte[][] blocks = BinTools.Split(DDJammer.Decode(File.ReadAllBytes(DDConsts.SaveDataFile)));
            int      bc     = 0;

            string[] lines = DDUtils.Split(blocks[bc++]);
            int      c     = 0;

            if (lines[c++] != Program.APP_IDENT)
            {
                throw new DDError();
            }

            if (lines[c++] != Program.APP_TITLE)
            {
                throw new DDError();
            }

            // アプリのアップデートによって項目の更新・増減があっても処理を続行するように try ~ catch しておく。

            try             // Donut3 のセーブデータ
            {
                // TODO int.Parse -> IntTools.ToInt

                DDGround.RealScreen_W = int.Parse(lines[c++]);
                DDGround.RealScreen_H = int.Parse(lines[c++]);

                DDGround.RealScreenDraw_L = int.Parse(lines[c++]);
                DDGround.RealScreenDraw_T = int.Parse(lines[c++]);
                DDGround.RealScreenDraw_W = int.Parse(lines[c++]);
                DDGround.RealScreenDraw_H = int.Parse(lines[c++]);

                DDGround.MusicVolume = long.Parse(lines[c++]) / (double)IntTools.IMAX;
                DDGround.SEVolume    = long.Parse(lines[c++]) / (double)IntTools.IMAX;

                DDInput.DIR_2.BtnId = int.Parse(lines[c++]);
                DDInput.DIR_4.BtnId = int.Parse(lines[c++]);
                DDInput.DIR_6.BtnId = int.Parse(lines[c++]);
                DDInput.DIR_8.BtnId = int.Parse(lines[c++]);
                DDInput.A.BtnId     = int.Parse(lines[c++]);
                DDInput.B.BtnId     = int.Parse(lines[c++]);
                DDInput.C.BtnId     = int.Parse(lines[c++]);
                DDInput.D.BtnId     = int.Parse(lines[c++]);
                DDInput.E.BtnId     = int.Parse(lines[c++]);
                DDInput.F.BtnId     = int.Parse(lines[c++]);
                DDInput.L.BtnId     = int.Parse(lines[c++]);
                DDInput.R.BtnId     = int.Parse(lines[c++]);
                DDInput.PAUSE.BtnId = int.Parse(lines[c++]);
                DDInput.START.BtnId = int.Parse(lines[c++]);

                DDInput.DIR_2.KeyId = int.Parse(lines[c++]);
                DDInput.DIR_4.KeyId = int.Parse(lines[c++]);
                DDInput.DIR_6.KeyId = int.Parse(lines[c++]);
                DDInput.DIR_8.KeyId = int.Parse(lines[c++]);
                DDInput.A.KeyId     = int.Parse(lines[c++]);
                DDInput.B.KeyId     = int.Parse(lines[c++]);
                DDInput.C.KeyId     = int.Parse(lines[c++]);
                DDInput.D.KeyId     = int.Parse(lines[c++]);
                DDInput.E.KeyId     = int.Parse(lines[c++]);
                DDInput.F.KeyId     = int.Parse(lines[c++]);
                DDInput.L.KeyId     = int.Parse(lines[c++]);
                DDInput.R.KeyId     = int.Parse(lines[c++]);
                DDInput.PAUSE.KeyId = int.Parse(lines[c++]);
                DDInput.START.KeyId = int.Parse(lines[c++]);

                DDGround.RO_MouseDispMode = int.Parse(lines[c++]) != 0;

                // 新しい項目をここへ追加...
            }
            catch (Exception e)
            {
                ProcMain.WriteLog(e);
            }

            Load_Delay = () =>
            {
                lines = DDUtils.Split(blocks[bc++]);
                c     = 0;

                try                 // アプリ固有のセーブデータ
                {
                    // app > @ Load

                    DDUtils.Noop(lines[c++]);                     // Dummy

                    // 新しい項目をここへ追加...

                    // < app
                }
                catch (Exception e)
                {
                    ProcMain.WriteLog(e);
                }

                Load_Delay = () => { };                 // reset
            };
        }
Example #8
0
        //
        //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
        //
        public static void Save()
        {
            List <byte[]> blocks = new List <byte[]>();

            // Donut3 用のセーブデータ
            {
                List <string> lines = new List <string>();

                lines.Add(Program.APP_IDENT);
                lines.Add(Program.APP_TITLE);

                lines.Add("" + DDGround.RealScreen_W);
                lines.Add("" + DDGround.RealScreen_H);

                lines.Add("" + DDGround.RealScreenDraw_L);
                lines.Add("" + DDGround.RealScreenDraw_T);
                lines.Add("" + DDGround.RealScreenDraw_W);
                lines.Add("" + DDGround.RealScreenDraw_H);

                lines.Add("" + DoubleTools.ToLong(DDGround.MusicVolume * IntTools.IMAX));
                lines.Add("" + DoubleTools.ToLong(DDGround.SEVolume * IntTools.IMAX));

                lines.Add("" + DDInput.DIR_2.BtnId);
                lines.Add("" + DDInput.DIR_4.BtnId);
                lines.Add("" + DDInput.DIR_6.BtnId);
                lines.Add("" + DDInput.DIR_8.BtnId);
                lines.Add("" + DDInput.A.BtnId);
                lines.Add("" + DDInput.B.BtnId);
                lines.Add("" + DDInput.C.BtnId);
                lines.Add("" + DDInput.D.BtnId);
                lines.Add("" + DDInput.E.BtnId);
                lines.Add("" + DDInput.F.BtnId);
                lines.Add("" + DDInput.L.BtnId);
                lines.Add("" + DDInput.R.BtnId);
                lines.Add("" + DDInput.PAUSE.BtnId);
                lines.Add("" + DDInput.START.BtnId);

                lines.Add("" + DDInput.DIR_2.KeyId);
                lines.Add("" + DDInput.DIR_4.KeyId);
                lines.Add("" + DDInput.DIR_6.KeyId);
                lines.Add("" + DDInput.DIR_8.KeyId);
                lines.Add("" + DDInput.A.KeyId);
                lines.Add("" + DDInput.B.KeyId);
                lines.Add("" + DDInput.C.KeyId);
                lines.Add("" + DDInput.D.KeyId);
                lines.Add("" + DDInput.E.KeyId);
                lines.Add("" + DDInput.F.KeyId);
                lines.Add("" + DDInput.L.KeyId);
                lines.Add("" + DDInput.R.KeyId);
                lines.Add("" + DDInput.PAUSE.KeyId);
                lines.Add("" + DDInput.START.KeyId);

                lines.Add("" + (DDGround.RO_MouseDispMode ? 1 : 0));

                // 新しい項目をここへ追加...

                blocks.Add(DDUtils.SplitableJoin(lines.ToArray()));
            }

            // アプリ固有のセーブデータ
            {
                List <string> lines = new List <string>();

                // app > @ Save

                lines.Add("G4Dungeon-SaveData");                 // Dummy

                // 新しい項目をここへ追加...

                // < app

                blocks.Add(DDUtils.SplitableJoin(lines.ToArray()));
            }

            File.WriteAllBytes(DDConsts.SaveDataFile, DDJammer.Encode(BinTools.SplittableJoin(blocks.ToArray())));
        }
Example #9
0
        //
        //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
        //
        public static void EachFrame()
        {
            // app > @ enter EachFrame

            //Ground.EL.ExecuteAllTask();

            // < app

            DDGround.EL.ExecuteAllTask();
            DDMouse.ApplyPosNowIfNeeded();
            DDCurtain.EachFrame();

            if (DDSEUtils.EachFrame() == false)
            {
                DDMusicUtils.EachFrame();
            }
            if (DDGround.MainScreen != null && DDSubScreenUtils.CurrDrawScreenHandle == DDGround.MainScreen.GetHandle())
            {
                DDSubScreenUtils.ChangeDrawScreen(DX.DX_SCREEN_BACK);

                if (DDGround.RealScreenDraw_W == -1)
                {
                    if (DX.DrawExtendGraph(0, 0, DDGround.RealScreen_W, DDGround.RealScreen_H, DDGround.MainScreen.GetHandle(), 0) != 0)                     // ? 失敗
                    {
                        throw new DDError();
                    }
                }
                else
                {
                    if (DX.DrawBox(0, 0, DDGround.RealScreen_W, DDGround.RealScreen_H, DX.GetColor(0, 0, 0), 1) != 0)                     // ? 失敗
                    {
                        throw new DDError();
                    }

                    if (DX.DrawExtendGraph(
                            DDGround.RealScreenDraw_L,
                            DDGround.RealScreenDraw_T,
                            DDGround.RealScreenDraw_L + DDGround.RealScreenDraw_W,
                            DDGround.RealScreenDraw_T + DDGround.RealScreenDraw_H, DDGround.MainScreen.GetHandle(), 0) != 0)                     // ? 失敗
                    {
                        throw new DDError();
                    }
                }
            }

            GC.Collect(0);

            FrameProcessingMillis = (int)(DDUtils.GetCurrTime() - FrameStartTime);

            if (FrameProcessingMillis_Worst < FrameProcessingMillis || DDUtils.CountDown(ref FrameProcessingMillis_WorstFrame) == false)
            {
                FrameProcessingMillis_Worst      = FrameProcessingMillis;
                FrameProcessingMillis_WorstFrame = 120;
            }

            // DxLib >

            DX.ScreenFlip();

            if (DX.CheckHitKey(DX.KEY_INPUT_ESCAPE) == 1 || DX.ProcessMessage() == -1)
            {
                throw new DDCoffeeBreak();
            }

            // < DxLib

            CheckHz();

            ProcFrame++;
            DDUtils.CountDown(ref FreezeInputFrame);
            WindowIsActive = DDUtils.IsWindowActive();

            if (IntTools.IMAX < ProcFrame)             // 192.9日程度でカンスト
            {
                ProcFrame = IntTools.IMAX;             // 2bs
                throw new DDError();
            }

            DDPad.EachFrame();
            DDKey.EachFrame();
            DDInput.EachFrame();
            DDMouse.EachFrame();

            if (DDGround.RealScreen_W != DDConsts.Screen_W || DDGround.RealScreen_H != DDConsts.Screen_H || DDGround.RealScreenDraw_W != -1)
            {
                if (DDGround.MainScreen == null)
                {
                    DDGround.MainScreen = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H);
                }

                DDGround.MainScreen.ChangeDrawScreen();
            }
            else
            {
                if (DDGround.MainScreen != null)
                {
                    DDGround.MainScreen.Dispose();
                    DDGround.MainScreen = null;
                }
            }

            // app > @ leave EachFrame

            Charlotte.Games.NamedCrashMgr.Clear();

            // < app
        }
Example #10
0
 public static bool IsPound(int keyId)
 {
     return(DDUtils.IsPound(GetInput(keyId)));
 }
Example #11
0
 public bool IsPound()
 {
     return(DDUtils.IsPound(this.GetInput()));
 }