Exemple #1
0
        public int Perform(string title, string[] items, int selectIndex, bool ポーズボタンでメニュー終了 = false, bool noPound = false)
        {
            DDCurtain.SetCurtain();
            DDEngine.FreezeInput();

            for (; ;)
            {
                // ★★★ キー押下は 1 マウス押下は -1 で判定する。

                if (this.MouseUsable)
                {
                    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;
                    }
                }

                if (ポーズボタンでメニュー終了 && DDInput.PAUSE.GetInput() == 1)
                {
                    selectIndex = items.Length - 1;
                    break;
                }

                bool chgsel = false;

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

                    selectIndex = items.Length - 1;
                    chgsel      = true;
                }
                if (noPound ? DDInput.DIR_8.GetInput() == 1 : DDInput.DIR_8.IsPound())
                {
                    selectIndex--;
                    chgsel = true;
                }
                if (noPound ? DDInput.DIR_2.GetInput() == 1 : 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.PosChanged();
                }

                this.DrawWall();

                if (this.Color != null)
                {
                    DDPrint.SetColor(this.Color.Value);
                }

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

                DDPrint.SetPrint(DDConsts.Screen_W - 45, 2);
                DDPrint.Print("[M:" + (this.MouseUsable ? "E" : "D") + "]");

                DDPrint.SetPrint(this.X, this.Y, this.YStep);
                //DDPrint.SetPrint(16, 16, 32); // old
                DDPrint.PrintLine(title);

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

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

            return(selectIndex);
        }
Exemple #2
0
        public static void EachFrame()
        {
            //Ground.EL.ExecuteAllTask();

            DDGround.EL.ExecuteAllTask();
            DDGround.SystemTasks.ExecuteAllTask();
            DispDebug();
            DDMouse.PosChanged_Delay();
            DDCurtain.EachFrame();

            if (!DDSEUtils.EachFrame())
            {
                DDMusicUtils.EachFrame();
            }

            DDSubScreenUtils.ChangeDrawScreen(DX.DX_SCREEN_BACK);

            if (DDGround.RealScreenDraw_W == -1)
            {
                bool mosaicFlag =
                    DDConfig.DrawScreen_MosaicFlag &&
                    DDGround.RealScreen_W % DDConsts.Screen_W == 0 &&
                    DDGround.RealScreen_H % DDConsts.Screen_H == 0;

                if (mosaicFlag)
                {
                    DX.SetDrawMode(DX.DX_DRAWMODE_NEAREST);
                }

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

                if (mosaicFlag)
                {
                    DX.SetDrawMode(DDConsts.DEFAULT_DX_DRAWMODE);                     // restore
                }
            }
            else
            {
                if (DX.DrawBox(0, 0, DDGround.RealScreen_W, DDGround.RealScreen_H, DX.GetColor(0, 0, 0), 1) != 0)                 // ? 失敗
                {
                    throw new DDError();
                }

                bool mosaicFlag =
                    DDConfig.DrawScreen_MosaicFlag &&
                    DDGround.RealScreenDraw_W % DDConsts.Screen_W == 0 &&
                    DDGround.RealScreenDraw_H % DDConsts.Screen_H == 0;

                if (mosaicFlag)
                {
                    DX.SetDrawMode(DX.DX_DRAWMODE_NEAREST);
                }

                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();
                }

                if (mosaicFlag)
                {
                    DX.SetDrawMode(DDConsts.DEFAULT_DX_DRAWMODE);                     // restore
                }
            }

            GC.Collect(0);

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

            if (FrameProcessingMillis_Worst < FrameProcessingMillis || !DDUtils.CountDown(ref FrameProcessingMillis_WorstFrame))
            {
                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 (SCommon.IMAX < ProcFrame)             // 192.9日程度でカンスト
            {
                ProcFrame = SCommon.IMAX;             // 2bs
                throw new DDError();
            }

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

            // Swap MainScreen
            {
                DDSubScreen tmp = DDGround.MainScreen;
                DDGround.MainScreen     = DDGround.LastMainScreen;
                DDGround.LastMainScreen = tmp;
            }

            DDGround.MainScreen.ChangeDrawScreen();

            // ? ALT + ENTER -> フルスクリーン切り替え
            if ((1 <= DDKey.GetInput(DX.KEY_INPUT_LALT) || 1 <= DDKey.GetInput(DX.KEY_INPUT_RALT)) && DDKey.GetInput(DX.KEY_INPUT_RETURN) == 1)
            {
                // ? 現在フルスクリーン -> フルスクリーン解除
                if (
                    DDGround.RealScreen_W == DDGround.MonitorRect.W &&
                    DDGround.RealScreen_H == DDGround.MonitorRect.H
                    )
                {
                    DDMain.SetScreenSize(DDGround.UnfullScreen_W, DDGround.UnfullScreen_H);
                }
                else                 // ? 現在フルスクリーンではない -> フルスクリーンにする
                {
                    DDGround.UnfullScreen_W = DDGround.RealScreen_W;
                    DDGround.UnfullScreen_H = DDGround.RealScreen_H;

                    DDMain.SetFullScreen();
                }
                DDEngine.FreezeInput(30);                 // エンターキー押下がゲームに影響しないように
            }

            DX.ClearDrawScreen();
        }
Exemple #3
0
        public int Perform(int x, int y, int yStep, int fontSize, string title, string[] items, int selectIndex, bool ポーズボタンでメニュー終了 = false, bool noPound = false)
        {
            DDCurtain.SetCurtain();
            DDEngine.FreezeInput();

            for (; ;)
            {
                // ★★★ キー押下は 1 マウス押下は -1 で判定する。

                if (this.MouseUsable)
                {
                    int musSelIdxY = DDMouse.Y - (y + yStep);
                    int musSelIdx  = musSelIdxY / yStep;

                    DDUtils.ToRange(ref musSelIdx, 0, items.Length - 1);

                    selectIndex = musSelIdx;

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

                if (ポーズボタンでメニュー終了 && DDInput.PAUSE.GetInput() == 1)
                {
                    selectIndex = items.Length - 1;
                    break;
                }

                bool chgsel = false;

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

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

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

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

                    DDMouse.PosChanged();
                }

                this.WallDrawer();
                this.ResetPrint();

                // old
                //DDPrint.SetPrint(DDConsts.Screen_W - 45, 2);
                //DDPrint.Print("[M:" + (this.MouseUsable ? "E" : "D") + "]");

                DDPrint.SetPrint(x, y, yStep, fontSize);
                //DDPrint.SetPrint(16, 16, 32); // old
                DDPrint.PrintLine(title);

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

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

            return(selectIndex);
        }