Esempio n. 1
0
        private static void MixInput(Button button)
        {
            bool keyDown = 1 <= DDKey.GetInput(button.KeyId);
            bool btnDown = 1 <= DDPad.GetInput(DDGround.PrimaryPadId, button.BtnId);

            DDUtils.UpdateInput(ref button.Status, keyDown || btnDown);
        }
Esempio n. 2
0
        //
        //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
        //
        public void PadConfig()
        {
            ButtonInfo[] btnInfos = new ButtonInfo[]
            {
                // 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
            };

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