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