public MainWindow() { InitializeComponent(); DX.SetAlwaysRunFlag(DX.TRUE); DX.SetDrawScreen(DX.DX_SCREEN_BACK); DX.SetUseFPUPreserveFlag(DX.TRUE); DX.SetWaitVSyncFlag(DX.FALSE); DX.SetOutApplicationLogValidFlag(DX.FALSE); DX.SetDoubleStartValidFlag(DX.TRUE); DX.SetMouseDispFlag(DX.TRUE); DX.SetUseDXArchiveFlag(DX.TRUE); DX.SetUserWindow(Handle); DX.SetWindowVisibleFlag(DX.FALSE); if (DX.DxLib_Init() < 0) { System.Windows.MessageBox.Show("初期化エラー"); return; } Opacity = 0; _timer3.Interval = 20; _timer3.Tick += delegate { double num = double.Parse(Opacity.ToString()); double ha = num + 0.1; Opacity = ha; if (Opacity == 1) { _timer3.Stop(); } }; _timer3.Start(); slider.Maximum = 10; slider.Value = 7; slider.Minimum = 1; slider.ValueChanged += delegate { Timer_Main(); }; Volume_V.Maximum = 255; Volume_V.Minimum = 0; Volume_V.Value = 175; Volume_V.ValueChanged += delegate { DX.ChangeVolumeSoundMem((int)Volume_V.Value, SHandle); }; mediaElement.MaxWidth = 4096; mediaElement.MaxHeight = 2160; mediaElement.LoadedBehavior = System.Windows.Controls.MediaState.Manual; mediaElement.UnloadedBehavior = System.Windows.Controls.MediaState.Stop; mediaElement.Stretch = System.Windows.Media.Stretch.Fill; button2.Visibility = Visibility.Hidden; Minus_B.Visibility = Visibility.Hidden; Plas_B.Visibility = Visibility.Hidden; slider.Visibility = Visibility.Hidden; Volume_V.Visibility = Visibility.Hidden; Stop_B.Visibility = Visibility.Hidden; Start_B.Visibility = Visibility.Hidden; Main_Timer.Interval = 100; Main_Timer.Tick += delegate { string Time_01; string Time_02; string Time_03; int a1 = mediaElement.Position.Hours; int a2 = mediaElement.Position.Minutes; int a3 = mediaElement.Position.Seconds; if (a1 < 10) { Time_01 = "0" + a1.ToString(); } else { Time_01 = a1.ToString(); } if (a2 < 10) { Time_02 = "0" + a2.ToString(); } else { Time_02 = a2.ToString(); } if (a3 < 10) { Time_03 = "0" + a3.ToString(); } else { Time_03 = a3.ToString(); } textBlock.Text = Time_01 + ":" + Time_02 + ":" + Time_03; }; Main_Timer.Start(); Loop(); }
// DX.* > public static bool IsWindowActive() { return(DX.GetActiveFlag() != 0); }
public static uint GetColor(I3Color color) { return(DX.GetColor(color.R, color.G, color.B)); }
//FPSを画面に表示する public static void FpsShow() { DX.DrawString(0, 0, "FPS" + fps.ToString("F"), DX.GetColor(255, 255, 255)); }
public override void Draw() { DX.DrawString(0, 0, "たいとる", DX.GetColor(255, 255, 0)); DX.DrawString(0, 15, "globaltimer:" + globalTimer.Elapsed, DX.GetColor(255, 255, 0)); DX.DrawString(0, 30, "localtimer:" + localTimer.Elapsed, DX.GetColor(255, 255, 0)); //menu関連///////////////////////////////////////// DX.DrawStringToHandle(Frame.WindowSizeX - 200, Frame.WindowSizeY - 100 + 25 * this.PosSelectMenu, ">", DX.GetColor(255, 255, 0), fontHandleHowToUse); DX.DrawStringToHandle(Frame.WindowSizeX - 165, Frame.WindowSizeY - 100, "Start", DX.GetColor(255, 255, 0), fontHandleHowToUse); DX.DrawStringToHandle(Frame.WindowSizeX - 165, Frame.WindowSizeY - 70, "End", DX.GetColor(255, 255, 0), fontHandleHowToUse); ////////////////////////////////////////////////// }
public static bool GetMouseDispMode() { return(DX.GetMouseDispFlag() != 0); }
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); }
// // 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 }
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(); } }
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); }
void _Update_KeyInput() { var game_main = GameMain.GetInstance(); var user_interface = game_main.user_interface; var game_base = game_main.game_base; var g3d_camera = game_main.g3d_camera; var g3d_map = game_main.g3d_map; var unit_manager = game_main.unit_manager; user_interface.Update(game_base.input.mouse_sutatus.position); if (game_main.action_manager.IsControlFreese()) { g3d_map.is_draw_cursor_turn_owner = false; return; } else { g3d_map.is_draw_cursor_turn_owner = true; } // if (DX.CheckHitKey(DX.KEY_INPUT_Q) == DX.TRUE) { g3d_camera.AddRot(0.03f); } if (DX.CheckHitKey(DX.KEY_INPUT_E) == DX.TRUE) { g3d_camera.AddRot(-0.03f); } if (DX.CheckHitKey(DX.KEY_INPUT_A) == DX.TRUE) { g3d_camera.MoveYRot(1.00f, 90); } if (DX.CheckHitKey(DX.KEY_INPUT_D) == DX.TRUE) { g3d_camera.MoveYRot(1.00f, -90); } if (DX.CheckHitKey(DX.KEY_INPUT_S) == DX.TRUE) { g3d_camera.MoveFront(-1.0f); } if (DX.CheckHitKey(DX.KEY_INPUT_W) == DX.TRUE) { g3d_camera.MoveFront(1.0f); } if (DX.CheckHitKey(DX.KEY_INPUT_F) == DX.TRUE) { //g3d_camera.MoveFront(1.0f); g3d_map.SetMoveRouteEffect(g3d_map.map_cursor_x, g3d_map.map_cursor_y); } if (game_base.input.GetKeyInputStatus((int)GameMain.KeyCode.DebugView) == Input.KeyInputStatus.Up) { game_main.debug_is_view = !game_main.debug_is_view; } if (game_base.input.mouse_sutatus.left.key_status == Input.MouseButtonKeyStatus.OneCrick) { var keys = tool_window.select_tool_key_word.Split(' '); if (keys.Count() >= 0) { switch (keys[0]) { case "ground": if (g3d_map.map_cursor_x >= 0 && g3d_map.map_cursor_y >= 0) { g3d_map.SetGroundMaterial(g3d_map.map_cursor_x, g3d_map.map_cursor_y, keys[1]); } break; case "wall": if (g3d_map.map_cursor_wall != null) { g3d_map.SetWallMaterial(g3d_map.map_cursor_wall, keys[1]); } break; case "ground_up": if (g3d_map.map_cursor_x >= 0 && g3d_map.map_cursor_y >= 0) { var height = g3d_map.GetHeight(g3d_map.map_cursor_x, g3d_map.map_cursor_y) + 1; g3d_map.SetMapHeight(g3d_map.map_cursor_x, g3d_map.map_cursor_y, height); } break; case "ground_down": if (g3d_map.map_cursor_x >= 0 && g3d_map.map_cursor_y >= 0) { var height = g3d_map.GetHeight(g3d_map.map_cursor_x, g3d_map.map_cursor_y) - 1; if (height < 0) { height = 0; } g3d_map.SetMapHeight(g3d_map.map_cursor_x, g3d_map.map_cursor_y, height); } break; } } } switch (tool_window.select_tool_key_word) { case "save": { var sfd = new SaveFileDialog(); sfd.FileName = "新しいファイル_map.nst"; //sfd.InitialDirectory = @"C:\"; //sfd.Filter = "HTMLファイル(*.html;*.htm)|*.html;*.htm|すべてのファイル(*.*)|*.*"; sfd.Filter = "nst|*.nst|すべてのファイル(*.*)|*.*"; sfd.FilterIndex = 1; //1番目の「nst」が選択されているようにする sfd.Title = "保存先のファイルを選択してください"; sfd.RestoreDirectory = true; //ダイアログボックスを閉じる前に現在のディレクトリを復元するようにする sfd.OverwritePrompt = true; //既に存在するファイル名を指定したとき警告する //デフォルトでTrueなので指定する必要はない sfd.CheckPathExists = true; //存在しないパスが指定されたとき警告を表示する //デフォルトでTrueなので指定する必要はない //ダイアログを表示する if (sfd.ShowDialog() == DialogResult.OK) { //OKボタンがクリックされたとき、選択されたファイル名を表示する //Console.WriteLine(sfd.FileName); g3d_map.Save(sfd.FileName); } tool_window.select_tool_key_word = ""; } break; case "load": { var ofd = new OpenFileDialog(); //sfd.FileName = "新しいファイル_map.nst"; //sfd.InitialDirectory = @"C:\"; //sfd.Filter = "HTMLファイル(*.html;*.htm)|*.html;*.htm|すべてのファイル(*.*)|*.*"; ofd.Filter = "nst|*.nst|すべてのファイル(*.*)|*.*"; ofd.FilterIndex = 1; //1番目の「nst」が選択されているようにする ofd.Title = "開くファイルを選択してください"; ofd.RestoreDirectory = true; //ダイアログボックスを閉じる前に現在のディレクトリを復元するようにする //ofd.OverwritePrompt = true; //既に存在するファイル名を指定したとき警告する //デフォルトでTrueなので指定する必要はない ofd.CheckFileExists = true; ofd.CheckPathExists = true; //存在しないパスが指定されたとき警告を表示する //デフォルトでTrueなので指定する必要はない //ダイアログを表示する if (ofd.ShowDialog() == DialogResult.OK) { //OKボタンがクリックされたとき、選択されたファイル名を表示する //Console.WriteLine(sfd.FileName); //g3d_map.Save(sfd.FileName); g3d_map.Load(ofd.FileName); } tool_window.select_tool_key_word = ""; } break; case "resize_h_m1": { g3d_map.Resize(g3d_map.map_w, g3d_map.map_h - 1, 0, 0); tool_window.select_tool_key_word = ""; } break; case "resize_h_m1b": { g3d_map.Resize(g3d_map.map_w, g3d_map.map_h - 1, 0, 1); tool_window.select_tool_key_word = ""; } break; case "resize_w_m1": { g3d_map.Resize(g3d_map.map_w - 1, g3d_map.map_h, 1, 0); tool_window.select_tool_key_word = ""; } break; case "resize_w_m1b": { g3d_map.Resize(g3d_map.map_w - 1, g3d_map.map_h, 0, 0); tool_window.select_tool_key_word = ""; } break; case "resize_h_p1": { g3d_map.Resize(g3d_map.map_w, g3d_map.map_h + 1, 0, 0); tool_window.select_tool_key_word = ""; } break; case "resize_h_p1b": { g3d_map.Resize(g3d_map.map_w, g3d_map.map_h + 1, 0, -1); tool_window.select_tool_key_word = ""; } break; case "resize_w_p1": { g3d_map.Resize(g3d_map.map_w + 1, g3d_map.map_h, -1, 0); tool_window.select_tool_key_word = ""; } break; case "resize_w_p1b": { g3d_map.Resize(g3d_map.map_w + 1, g3d_map.map_h, 0, 0); tool_window.select_tool_key_word = ""; } break; } }
public static bool IsWindowActive() // ret: ? このウィンドウはアクティブ { return(DX.GetActiveFlag() != 0); }
static void Main(string[] args) { Thread.CurrentThread.Priority = ThreadPriority.Highest; // スレッドの優先度を上げておく // 画面リフレッシュレートと目標フレームレートが等しい場合は垂直同期を有効に、等しくない場合は垂直同期を無効にする DX.SetWaitVSyncFlag(DX.GetRefreshRate() == TargetFPS ? DX.TRUE : DX.FALSE); DX.SetWindowText("ヘルプ!!くまさん!!"); // ウィンドウのタイトル DX.SetGraphMode(640, 480, 32); // ウィンドウサイズ(画面解像度)の指定 DX.ChangeWindowMode(DX.TRUE); // ウィンドウモードにする(DX.FALSEを指定するとフルスクリーンになる) DX.SetAlwaysRunFlag(DX.TRUE); // ウィンドウが非アクティブでも動作させる DX.DxLib_Init(); // DXライブラリの初期化 DX.SetMouseDispFlag(DX.TRUE); // マウスを表示する(DX.FALSEを指定すると非表示になる) DX.SetDrawScreen(DX.DX_SCREEN_BACK); // 描画先を裏画面とする(ダブルバッファ) game = new Game(); game.Init(); DX.ScreenFlip(); stopwatch.Start(); while (DX.ProcessMessage() == 0) // ウィンドウが閉じられるまで繰り返す { // FPSの計測 fpsFrameCount++; if (fpsFrameCount >= 60) { long elapsedTicks = stopwatch.Elapsed.Ticks - fpsTicks; float elapsedSec = elapsedTicks / 10000000f; CurrentFPS = fpsFrameCount / elapsedSec; fpsFrameCount = 0; fpsTicks = stopwatch.Elapsed.Ticks; } game.Update(); if (DX.GetWaitVSyncFlag() == DX.TRUE) { if (EnableFrameSkip) { long waitTicks = nextFrameTicks - stopwatch.Elapsed.Ticks; // 余った時間 if (waitTicks < 0) // 目標時刻をオーバーしている { if (skipCount < MaxAllowSkipCount) // 連続フレームスキップ数が最大スキップ数を超えていなければ { skipCount++; // フレームスキップ(描画処理を飛ばす) } else { // 最大スキップ数を超えてるので、フレームスキップしないで描画 nextFrameTicks = stopwatch.Elapsed.Ticks; Draw(); } } else { Draw(); } nextFrameTicks += IntervalTicks; } else { Draw(); } } else { long waitTicks = nextFrameTicks - stopwatch.Elapsed.Ticks; // 余った時間(待機が必要な時間) if (EnableFrameSkip && waitTicks < 0) { if (skipCount < MaxAllowSkipCount) { skipCount++; // フレームスキップ(描画処理を飛ばす) } else { nextFrameTicks = stopwatch.Elapsed.Ticks; Draw(); } } else { if (waitTicks > 20000) // あと2ミリ秒以上待つ必要がある { // Sleep()は指定した時間でピッタリ戻ってくるわけではないので、 // 余裕を持って、「待たなければならない時間-2ミリ秒」Sleepする int waitMillsec = (int)(waitTicks / 10000) - 2; Thread.Sleep(waitMillsec); } // 時間が来るまで何もしないループを回して待機する while (stopwatch.Elapsed.Ticks < nextFrameTicks) { } Draw(); } nextFrameTicks += IntervalTicks; } } DX.DxLib_End(); // DXライブラリ終了処理 }
public static void PlayDialoge(DX dx){ switch(dx){ case DX.AnotherPoorSoul: dXPlayer.clip = dXFiles[0]; break; case DX.AsteroidCowboy: dXPlayer.clip = dXFiles[1]; break; case DX.GatherAllTheSouls: dXPlayer.clip = dXFiles[2]; break; case DX.HaveYouSeen: dXPlayer.clip = dXFiles[3]; break; case DX.HesDead: dXPlayer.clip = dXFiles[4]; break; case DX.LookAtTheMonk: dXPlayer.clip = dXFiles[5]; break; case DX.OldEnough: dXPlayer.clip = dXFiles[6]; break; case DX.TagYoureIt: dXPlayer.clip = dXFiles[7]; break; case DX.TapInto: dXPlayer.clip = dXFiles[8]; break; case DX.TheWheel: dXPlayer.clip = dXFiles[9]; break; case DX.TheyreAttacking: dXPlayer.clip = dXFiles[10]; break; case DX.WatchOut: dXPlayer.clip = dXFiles[11]; break; } dXPlayer.Play(); }
// 最新の入力状況に更新する処理。 // 毎フレームの最初に(ゲームの処理より先に)呼んでください。 public static void Update() { prevState = currentState; currentState = DX.GetJoypadInputState(DX.DX_INPUT_KEY_PAD1); }
/// <inheritdoc /> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; if (Type != null) { hashCode = hashCode * 59 + Type.GetHashCode(); } if (Visible != null) { hashCode = hashCode * 59 + Visible.GetHashCode(); } if (ShowLegend != null) { hashCode = hashCode * 59 + ShowLegend.GetHashCode(); } if (LegendGroup != null) { hashCode = hashCode * 59 + LegendGroup.GetHashCode(); } if (Opacity != null) { hashCode = hashCode * 59 + Opacity.GetHashCode(); } if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (UId != null) { hashCode = hashCode * 59 + UId.GetHashCode(); } if (Ids != null) { hashCode = hashCode * 59 + Ids.GetHashCode(); } if (CustomData != null) { hashCode = hashCode * 59 + CustomData.GetHashCode(); } if (Meta != null) { hashCode = hashCode * 59 + Meta.GetHashCode(); } if (MetaArray != null) { hashCode = hashCode * 59 + MetaArray.GetHashCode(); } if (HoverInfo != null) { hashCode = hashCode * 59 + HoverInfo.GetHashCode(); } if (HoverInfoArray != null) { hashCode = hashCode * 59 + HoverInfoArray.GetHashCode(); } if (HoverLabel != null) { hashCode = hashCode * 59 + HoverLabel.GetHashCode(); } if (Stream != null) { hashCode = hashCode * 59 + Stream.GetHashCode(); } if (Transforms != null) { hashCode = hashCode * 59 + Transforms.GetHashCode(); } if (UiRevision != null) { hashCode = hashCode * 59 + UiRevision.GetHashCode(); } if (Z != null) { hashCode = hashCode * 59 + Z.GetHashCode(); } if (X != null) { hashCode = hashCode * 59 + X.GetHashCode(); } if (X0 != null) { hashCode = hashCode * 59 + X0.GetHashCode(); } if (DX != null) { hashCode = hashCode * 59 + DX.GetHashCode(); } if (Y != null) { hashCode = hashCode * 59 + Y.GetHashCode(); } if (Y0 != null) { hashCode = hashCode * 59 + Y0.GetHashCode(); } if (Dy != null) { hashCode = hashCode * 59 + Dy.GetHashCode(); } if (Text != null) { hashCode = hashCode * 59 + Text.GetHashCode(); } if (HoverText != null) { hashCode = hashCode * 59 + HoverText.GetHashCode(); } if (Transpose != null) { hashCode = hashCode * 59 + Transpose.GetHashCode(); } if (XType != null) { hashCode = hashCode * 59 + XType.GetHashCode(); } if (YType != null) { hashCode = hashCode * 59 + YType.GetHashCode(); } if (ZHoverFormat != null) { hashCode = hashCode * 59 + ZHoverFormat.GetHashCode(); } if (HoverTemplate != null) { hashCode = hashCode * 59 + HoverTemplate.GetHashCode(); } if (HoverTemplateArray != null) { hashCode = hashCode * 59 + HoverTemplateArray.GetHashCode(); } if (HoverOnGaps != null) { hashCode = hashCode * 59 + HoverOnGaps.GetHashCode(); } if (ConnectGaps != null) { hashCode = hashCode * 59 + ConnectGaps.GetHashCode(); } if (FillColor != null) { hashCode = hashCode * 59 + FillColor.GetHashCode(); } if (AutoContour != null) { hashCode = hashCode * 59 + AutoContour.GetHashCode(); } if (NContours != null) { hashCode = hashCode * 59 + NContours.GetHashCode(); } if (Contours != null) { hashCode = hashCode * 59 + Contours.GetHashCode(); } if (Line != null) { hashCode = hashCode * 59 + Line.GetHashCode(); } if (ZAuto != null) { hashCode = hashCode * 59 + ZAuto.GetHashCode(); } if (ZMin != null) { hashCode = hashCode * 59 + ZMin.GetHashCode(); } if (ZMax != null) { hashCode = hashCode * 59 + ZMax.GetHashCode(); } if (ZMid != null) { hashCode = hashCode * 59 + ZMid.GetHashCode(); } if (ColorScale != null) { hashCode = hashCode * 59 + ColorScale.GetHashCode(); } if (AutoColorScale != null) { hashCode = hashCode * 59 + AutoColorScale.GetHashCode(); } if (ReverseScale != null) { hashCode = hashCode * 59 + ReverseScale.GetHashCode(); } if (ShowScale != null) { hashCode = hashCode * 59 + ShowScale.GetHashCode(); } if (ColorBar != null) { hashCode = hashCode * 59 + ColorBar.GetHashCode(); } if (ColorAxis != null) { hashCode = hashCode * 59 + ColorAxis.GetHashCode(); } if (XCalendar != null) { hashCode = hashCode * 59 + XCalendar.GetHashCode(); } if (YCalendar != null) { hashCode = hashCode * 59 + YCalendar.GetHashCode(); } if (XAxis != null) { hashCode = hashCode * 59 + XAxis.GetHashCode(); } if (YAxis != null) { hashCode = hashCode * 59 + YAxis.GetHashCode(); } if (IdsSrc != null) { hashCode = hashCode * 59 + IdsSrc.GetHashCode(); } if (CustomDataSrc != null) { hashCode = hashCode * 59 + CustomDataSrc.GetHashCode(); } if (MetaSrc != null) { hashCode = hashCode * 59 + MetaSrc.GetHashCode(); } if (HoverInfoSrc != null) { hashCode = hashCode * 59 + HoverInfoSrc.GetHashCode(); } if (ZSrc != null) { hashCode = hashCode * 59 + ZSrc.GetHashCode(); } if (XSrc != null) { hashCode = hashCode * 59 + XSrc.GetHashCode(); } if (YSrc != null) { hashCode = hashCode * 59 + YSrc.GetHashCode(); } if (TextSrc != null) { hashCode = hashCode * 59 + TextSrc.GetHashCode(); } if (HoverTextSrc != null) { hashCode = hashCode * 59 + HoverTextSrc.GetHashCode(); } if (HoverTemplateSrc != null) { hashCode = hashCode * 59 + HoverTemplateSrc.GetHashCode(); } return(hashCode); } }
public void Draw(double[] spectra) { if (spectra.Length != SP_LEN) { throw null; // souteigai !!! } if (this.ShadowSpectra == null) { this.ShadowSpectra = new ShadowSpectraData(); } this.ShadowSpectra.Projection(spectra); DDSubScreenUtils.ChangeDrawScreen(this.GraphScreen); DX.ClearDrawScreen(); for (int layer = 0; layer < 2; layer++) { for (int bi = 0; bi < this.BarNum; bi++) { int c1 = (SP_LEN * (bi + 0)) / this.BarNum; int c2 = (SP_LEN * (bi + 1)) / this.BarNum; double v = 0.0; for (int c = c1; c < c2; c++) { v += (layer == 0 ? this.ShadowSpectra.ShadowSpectra : spectra)[c]; } v /= c2 - c1; int x1 = ((this.GraphScreen.GetSize().W - this.Bar_W) * bi) / (this.BarNum - 1); int x2 = x1 + this.Bar_W; int y1 = (int)((1.0 - v) * this.GraphScreen.GetSize().H); int y2 = this.GraphScreen.GetSize().H; if (y1 + 1 < y2) { double bright = layer == 0 ? 0.5 : 1.0; DDDraw.SetBright( bright * (this.BarColor.R / 255.0), bright * (this.BarColor.G / 255.0), bright * (this.BarColor.B / 255.0) ); DDDraw.DrawRect(DDGround.GeneralResource.WhiteBox, x1, y1, x2 - x1, y2 - y1); DDDraw.Reset(); } } } DDSubScreenUtils.ChangeDrawScreen(this.Screen); DX.ClearDrawScreen(); for (int c = 0; c < 2; c++) { DDDraw.DrawBegin(this.GraphScreen.ToPicture(), this.Screen.GetSize().W / 2, this.Screen.GetSize().H / 2); DDDraw.SetBright(0, 0, 0); DDDraw.DrawEnd(); DDDraw.Reset(); DX.GraphFilter(this.Screen.GetHandle(), DX.DX_GRAPH_FILTER_GAUSS, 16, 1000); } DDDraw.DrawCenter(this.GraphScreen.ToPicture(), this.Screen.GetSize().W / 2, this.Screen.GetSize().H / 2); DDSubScreenUtils.RestoreDrawScreen(); }
private IEnumerable <bool> DrawString(int x, int y, string text, int frameMax, I3Color color) { DDSubScreen subScreenTmp = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H, true); DDSubScreen subScreen = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H, true); SubScreens.Add(subScreenTmp); SubScreens.Add(subScreen); using (subScreenTmp.Section()) { DX.ClearDrawScreen(); DDFontUtils.DrawString_XCenter(x, y, text, DDFontUtils.GetFont("03\u711a\u706b-Regular", 30)); ぼかし効果.Perform(0.01); } for (int c = 0; c < 4; c++) { using (subScreen.Section()) { DX.ClearDrawScreen(); for (int d = 0; d < 20; d++) { DDDraw.SetBlendAdd(1.0); DDDraw.DrawSimple(subScreenTmp.ToPicture(), 0, 0); DDDraw.Reset(); } ぼかし効果.Perform(0.01); } SCommon.Swap(ref subScreen, ref subScreenTmp); } using (subScreen.Section()) { DX.ClearDrawScreen(); DDDraw.SetBright(0.0, 0.0, 0.0); DDDraw.DrawSimple(subScreenTmp.ToPicture(), 0, 0); DDDraw.Reset(); DDFontUtils.DrawString_XCenter(x, y, text, DDFontUtils.GetFont("03\u711a\u706b-Regular", 30), false, color); } double a = 0.0; double aTarg = 1.0; foreach (DDScene scene in DDSceneUtils.Create(frameMax)) { if (scene.Numer == scene.Denom - 300) { aTarg = 0.0; } DDUtils.Approach(ref a, aTarg, 0.985); DDDraw.SetAlpha(a); DDDraw.DrawSimple(subScreen.ToPicture(), 0, 0); DDDraw.Reset(); yield return(true); } }
//********************************************* /// <summary> /// ゲーム全体の初期化 /// </summary> public void Init() { //ゲーム全体の処理 DX.ChangeWindowMode(DX.TRUE); //ウィンドウモードに設定(ウィンドウモードならTRUE / フルスクリーンならFALSE) DX.SetGraphMode(this.WIDTH, this.HEIGHT, this.COLORBIT); //ウィンドウの解像度を設定 DX.SetWindowSize(this.WIDTH, this.HEIGHT); //ウィンドウの大きさを設定 DX.SetMainWindowText(this.TITLE); //ウィンドウのタイトルの文字 DX.SetWindowIconHandle(Properties.Resources.game.Handle); //リソースに埋め込んだアイコンファイルのハンドルを取得し設定 DX.SetWindowStyleMode(this.WINDOW_BAR); //タイトルバーの種類はデフォルトにする DX.SetBackgroundColor(0, 0, 0); //デフォルトの背景の色 DX.SetOutApplicationLogValidFlag(DX.TRUE); //Log.txtを出力しない DX.SetWaitVSyncFlag(DX.TRUE); //垂直同期の設定(垂直同期しないと、モニタ最大FPSを利用できる):するTRUE / しない:FALSE) DX.SetAlwaysRunFlag(DX.TRUE); //非アクティブでも実行する //DxLibを初期化。できなかったらアプリケーション強制終了 if (DX.DxLib_Init() == -1) { Application.Exit(); } //Draw系関数は裏画面に描画 DX.SetDrawScreen(DX.DX_SCREEN_BACK); //フォント読み込み Gamefont.GetInstance().Load(); //ゲームパッド初期化 GamePad.GetInstance().PadInit(); //ゲーム全体のデフォルトフォント設定 Gamefont.GetInstance().SetDefalutFont(); //入力見本 /* * //最後にゲームシーン作成 * Scene[(int)GAME_SCENE.TITLE] = new Title(); //タイトルを作成 * Scene[(int)GAME_SCENE.HOWTO] = new HowTo(); //HowToを作成 * Scene[(int)GAME_SCENE.PLAY] = new Play(); //プレイを作成 * Scene[(int)GAME_SCENE.END] = new End(); //エンドを作成 * Scene[(int)GAME_SCENE.CHANGE] = new Change(); //切り替えを作成 */ //最後にゲームシーン作成 Scene[(int)GAME_SCENE.TITLE] = new Title(); //タイトルを作成 Scene[(int)GAME_SCENE.HOWTO] = new HowTo(); //HowToを作成 Scene[(int)GAME_SCENE.PLAY] = new Play(); //プレイを作成 Scene[(int)GAME_SCENE.END] = new End(); //エンドを作成 Scene[(int)GAME_SCENE.CHANGE] = new Change(); //切り替えを作成 //入力見本 /* * //すべて完了したら、ゲーム開始! * Scene[(int)GAME_SCENE.TITLE].Start(); //スタート画面初期化 */ //すべて完了したら、ゲーム開始! Scene[(int)GAME_SCENE.TITLE].Start(); //スタート画面初期化 return; }
/// <summary> /// <para>コンピュータを起動してから経過した時間を返す。</para> /// <para>ミリ秒</para> /// </summary> /// <returns>時間</returns> public static long GetCurrTime() { return(DX.GetNowHiPerformanceCount() / 1000L); }
void InputKey() { DX.GetHitKeyStateAll(out keyInput[0]); for (int i = 0; i < 4; i++) { GetKey(i); } if (waitConnectTime > 0) { waitConnectTime--; } else if (waitConnectTime == 0) { if (inputing[0]) { select--; if (select < 0) { select = sumOfSelect - 1; } } if (inputing[1]) { select++; if (select >= sumOfSelect) { select = 0; } } if (inputing[2]) { switch (select) { case 0: net.ConnectServer(); if (net.successStart) { waitConnectTime = -1; } break; case 1: net.ConnectClient(true); if (net.successStart) { waitConnectTime = 300; } break; case 2: net.ConnectClient(false); if (net.successStart) { waitConnectTime = 300; } break; } } } if (inputing[3]) { net.Close(); waitConnectTime = 0; net.successStart = false; } if (net.successStart) { net.Connected(); } if (net.isConnect) { isConnect = true; waitConnectTime = 0; upper = net.isClient;////////// if (upper) { for (int i = 0; i < stuff.Length; i++) { stuff[i].being = false; } } } }
public static void SetMouseDispMode(bool mode) { DX.SetMouseDispFlag(mode ? 1 : 0); }
static public void GameMain() { ////変数//// //時間関係 int FPS, FPSCounter; long NowTime, LastTime, FPSCheckTime; //現在の時間, 前回の時間, FPS計算用時間 double ElapsedTime1F; //1フレーム経過にかかった時間(秒) //FPS計測関係の初期化 { LastTime = FPSCheckTime = DX.GetNowHiPerformanceCount(); FPS = 0; FPSCounter = 0; } //テクスチャ読み込み Tile_Data.TileData(); // Graphic_Data.Graphic_Data_Load(); //Player_Data読み込み Player_Data_Load.PDL(); //プレイヤーのデータを読み込む(Player_Dataに) Player_Data PD = new Player_Data(); //Player_Dataのインスタンス化 //コントロール GameControlHandle = "GameMain"; /////////////////////////////////////////// //メインループ while (DX.ScreenFlip() == 0 && DX.ProcessMessage() == 0 && DX.ClearDrawScreen() == 0) { //時間関係 NowTime = DX.GetNowHiPerformanceCount(); //現在の時間を取得 ElapsedTime1F = (NowTime - LastTime) / 1000000.0; //1フレーム経過にかかった時間(秒) LastTime = NowTime; //FPS計測 FPSCounter++; if (NowTime - FPSCheckTime > 1000000) { FPS = FPSCounter; FPSCounter = 0; FPSCheckTime = NowTime; } // キーボード押下状態の読み込み Array.Copy(Key_State.KeyState, Key_State.KeyStateOld, 256); DX.GetHitKeyStateAll(Key_State.KeyState); //描画 Game_Draw_Main.GameDrawMain(PD, FPS); //操作 if (GameControlHandle == "GameMain") { CharacterControl.Player_Control(PD, ElapsedTime1F); } else if (GameControlHandle == "GameEscMenu") { C_GameEscMenu.CGameEscMenu(); } } }
public static void EachFrame() { //Ground.EL.ExecuteAllTask(); DDGround.EL.ExecuteAllTask(); DispDebug(); DDMouse.PosChanged_Delay(); DDCurtain.EachFrame(); if (!DDSEUtils.EachFrame()) { DDMusicUtils.EachFrame(); } 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)) { 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); // エンターキー押下がゲームに影響しないように } }
public static void Play(int handle) { DX.PlaySoundMem(handle, DX.DX_PLAYTYPE_BACK); }
void Timer_Main() { if (Play_States == 0) { int Qu = GetPitch; double GetNumber = Math.Round(slider.Value, MidpointRounding.AwayFromZero); double GetPosition = mediaElement.Position.TotalSeconds * 1000; double SetPosition = Math.Round(GetPosition, MidpointRounding.AwayFromZero); int a2 = (int)SetPosition; if (GetNumber == 1) { slider.Value = 1; double GetNumber2 = Math.Round(Qu * 0.4, MidpointRounding.AwayFromZero); int a = (int)GetNumber2; DX.StopSoundMem(SHandle); DX.SetFrequencySoundMem(a, SHandle); DX.SetSoundCurrentTime(a2, SHandle); DX.PlaySoundMem(SHandle, DX.DX_PLAYTYPE_BACK, DX.FALSE); mediaElement.SpeedRatio = 0.4; } else if (GetNumber == 2) { slider.Value = 2; double GetNumber2 = Math.Round(Qu * 0.5, MidpointRounding.AwayFromZero); int a = (int)GetNumber2; DX.StopSoundMem(SHandle); DX.SetFrequencySoundMem(a, SHandle); DX.SetSoundCurrentTime(a2, SHandle); DX.PlaySoundMem(SHandle, DX.DX_PLAYTYPE_BACK, DX.FALSE); mediaElement.SpeedRatio = 0.5; } else if (GetNumber == 3) { slider.Value = 3; double GetNumber2 = Math.Round(Qu * 0.6, MidpointRounding.AwayFromZero); int a = (int)GetNumber2; DX.StopSoundMem(SHandle); DX.SetFrequencySoundMem(a, SHandle); DX.SetSoundCurrentTime(a2, SHandle); DX.PlaySoundMem(SHandle, DX.DX_PLAYTYPE_BACK, DX.FALSE); mediaElement.SpeedRatio = 0.6; } else if (GetNumber == 4) { slider.Value = 4; double GetNumber2 = Math.Round(Qu * 0.7, MidpointRounding.AwayFromZero); int a = (int)GetNumber2; DX.StopSoundMem(SHandle); DX.SetFrequencySoundMem(a, SHandle); DX.SetSoundCurrentTime(a2, SHandle); DX.PlaySoundMem(SHandle, DX.DX_PLAYTYPE_BACK, DX.FALSE); mediaElement.SpeedRatio = 0.7; } else if (GetNumber == 5) { slider.Value = 5; double GetNumber2 = Math.Round(Qu * 0.8, MidpointRounding.AwayFromZero); int a = (int)GetNumber2; DX.StopSoundMem(SHandle); DX.SetFrequencySoundMem(a, SHandle); DX.SetSoundCurrentTime(a2, SHandle); DX.PlaySoundMem(SHandle, DX.DX_PLAYTYPE_BACK, DX.FALSE); mediaElement.SpeedRatio = 0.8; } else if (GetNumber == 6) { slider.Value = 6; double GetNumber2 = Math.Round(Qu * 0.9, MidpointRounding.AwayFromZero); int a = (int)GetNumber2; DX.StopSoundMem(SHandle); DX.SetFrequencySoundMem(a, SHandle); DX.SetSoundCurrentTime(a2, SHandle); DX.PlaySoundMem(SHandle, DX.DX_PLAYTYPE_BACK, DX.FALSE); mediaElement.SpeedRatio = 0.9; } else if (GetNumber == 7) { slider.Value = 7; DX.StopSoundMem(SHandle); DX.SetFrequencySoundMem(Qu, SHandle); DX.SetSoundCurrentTime(a2, SHandle); DX.PlaySoundMem(SHandle, DX.DX_PLAYTYPE_BACK, DX.FALSE); mediaElement.SpeedRatio = 1.0; } else if (GetNumber == 8) { slider.Value = 8; double GetNumber2 = Math.Round(Qu * 1.1, MidpointRounding.AwayFromZero); int a = (int)GetNumber2; DX.StopSoundMem(SHandle); DX.SetFrequencySoundMem(a, SHandle); DX.SetSoundCurrentTime(a2, SHandle); DX.PlaySoundMem(SHandle, DX.DX_PLAYTYPE_BACK, DX.FALSE); mediaElement.SpeedRatio = 1.1; } else if (GetNumber == 9) { slider.Value = 9; double GetNumber2 = Math.Round(Qu * 1.2, MidpointRounding.AwayFromZero); int a = (int)GetNumber2; DX.StopSoundMem(SHandle); DX.SetFrequencySoundMem(a, SHandle); DX.SetSoundCurrentTime(a2, SHandle); DX.PlaySoundMem(SHandle, DX.DX_PLAYTYPE_BACK, DX.FALSE); mediaElement.SpeedRatio = 1.2; } else if (GetNumber == 10) { slider.Value = 10; double GetNumber2 = Math.Round(Qu * 1.3, MidpointRounding.AwayFromZero); int a = (int)GetNumber2; DX.StopSoundMem(SHandle); DX.SetFrequencySoundMem(a, SHandle); DX.SetSoundCurrentTime(a2, SHandle); DX.PlaySoundMem(SHandle, DX.DX_PLAYTYPE_BACK, DX.FALSE); mediaElement.SpeedRatio = 1.3; } } else { slider.Value = Progress_V; } }
//Draw_Map static void Draw_Map(double Player_X, double Player_Y, int Player_Dimension, int[][][][] map_data) { //ローカル関数の宣言 int INT_Player_X, INT_Player_Y; int Tile_Number_X, Tile_Number_Y; int Player_X_Map, Player_Y_Map; int PlayerX_O, PlayerY_O; double PlayerX_O_B, PlayerY_O_B; int Player_X_Map_D, Player_Y_Map_D; // INT_Player_X = (int)Player_X; INT_Player_Y = (int)Player_Y; //描画するTile数 Tile_Number_X = Window_Width / Setting_TileSize + 1; Tile_Number_Y = Window_Heigt / Setting_TileSize + 1; if (Tile_Number_X % 2 == 0) { Tile_Number_X++; } if (Tile_Number_Y % 2 == 0) { Tile_Number_Y++; } //Tile位置 Player_X_Map = INT_Player_X / 1 - (Tile_Number_X / 2); Player_Y_Map = INT_Player_Y / 1 - (Tile_Number_Y / 2); if (Player_X - INT_Player_X > 0 && Player_X - INT_Player_X >= 1 / Setting_TileSize) { PlayerX_O_B = (Player_X - INT_Player_X) / (1.0 / Setting_TileSize); } else { PlayerX_O_B = 0.0; } if (Player_Y - INT_Player_Y > 0) { PlayerY_O_B = (Player_Y - INT_Player_Y) / (1.0 / Setting_TileSize); } else { PlayerY_O_B = 0.0; } PlayerX_O = (int)PlayerX_O_B; PlayerY_O = (int)PlayerY_O_B; //Map_0 レイヤー0 Player_X_Map_D = Player_X_Map; Player_Y_Map_D = Player_Y_Map; for (int y = 0; y <= Tile_Number_Y; y++) { if (Player_Y_Map_D >= 0 && Player_Y_Map_D < map_data[Player_Dimension][0].GetLength(0)) { Player_X_Map_D = Player_X_Map; int DrawY = ((Window_Heigt / 2 - (Setting_TileSize / 2)) - (Setting_TileSize * (Tile_Number_Y / 2))) + (Setting_TileSize * y - PlayerY_O); for (int x = 0; x <= Tile_Number_X; x++) { int DrawX = ((Window_Width / 2 - (Setting_TileSize / 2)) - (Setting_TileSize * (Tile_Number_X / 2))) + (Setting_TileSize * x - PlayerX_O); if (Player_X_Map_D >= 0 && Player_X_Map_D < map_data[Player_Dimension][0][0].GetLength(0)) { DX.DrawExtendGraph(DrawX, DrawY, DrawX + Setting_TileSize, DrawY + Setting_TileSize, Tile_Data.TileGraphicData[map_data[Player_Dimension][0][Player_Y_Map_D][Player_X_Map_D]], DX.FALSE); } Player_X_Map_D += 1; } } Player_Y_Map_D += 1; } //Map_1 レイヤー1 Player_X_Map_D = Player_X_Map; Player_Y_Map_D = Player_Y_Map; for (int y = 0; y <= Tile_Number_Y; y++) { if (Player_Y_Map_D >= 0 && Player_Y_Map_D < map_data[Player_Dimension][1].GetLength(0)) { Player_X_Map_D = Player_X_Map; int DrawY = ((Window_Heigt / 2 - (Setting_TileSize / 2)) - (Setting_TileSize * (Tile_Number_Y / 2))) + (Setting_TileSize * y - PlayerY_O); for (int x = 0; x <= Tile_Number_X; x++) { int DrawX = ((Window_Width / 2 - (Setting_TileSize / 2)) - (Setting_TileSize * (Tile_Number_X / 2))) + (Setting_TileSize * x - PlayerX_O); if (Player_X_Map_D >= 0 && Player_X_Map_D < map_data[Player_Dimension][1][0].GetLength(0)) { DX.DrawExtendGraph(DrawX, DrawY, DrawX + Setting_TileSize, DrawY + Setting_TileSize, Tile_Data.TileGraphicData[map_data[Player_Dimension][1][Player_Y_Map_D][Player_X_Map_D]], DX.TRUE); } Player_X_Map_D += 1; } } Player_Y_Map_D += 1; } }
private void Window_Closed(object sender, EventArgs e) { DX.DxLib_End(); }
public override void Draw() { DX.DrawRotaGraphF(x, y, 1, 0, Image.zako0); }
void GoogleLikeCombo_RequestItemHighlight(object sender, DX.RequestItemHighlightEventArgs args) { if (DataProvider != null && !string.IsNullOrEmpty(FindSuitableExpression) && args.text != FindSuitableExpression) { GoogleLikeComboData item = this.DataItems.FirstOrDefault(p => p.DropDownText == args.text); if (item != null && item.IsMarked) { args.TextSelection = new DX.TextSelectionData(this.Options.SelectedTextColorListControl); args.TextSelection.Markers = item.Markers.Select(p => new TextSelectionData.Marker() { Start = p.Start, End = p.End }).ToArray(); } } }
public static void EachFrame(DDSubScreen targetScreen) { if (!Enabled) { return; } for (int x = 0; x < PIECES_W; x++) { for (int y = 0; y < PIECES_H; y++) { PieceTable[x, y].ChangeDrawScreen(); DX.DrawRectGraph( 0, 0, x * PIECE_XY_STEP, y * PIECE_XY_STEP, x * PIECE_XY_STEP + PIECE_WH, y * PIECE_XY_STEP + PIECE_WH, targetScreen.GetHandle(), 0 ); } } Screen.ChangeDrawScreen(); // Fill_Red DDDraw.SetBright(1.0, 0.0, 0.0); DDDraw.DrawRect(Ground.I.Picture.WhiteBox, new D4Rect(0, 0, GameConsts.FIELD_W, GameConsts.FIELD_H)); DDDraw.Reset(); for (int x = 0; x < PIECES_W; x++) { for (int y = 0; y < PIECES_H; y++) { D2Point centerPt = new D2Point( x * PIECE_XY_STEP + PIECE_WH / 2, y * PIECE_XY_STEP + PIECE_WH / 2 ); double rot = 0.0; DDPicture picture = PieceTable[x, y].ToPicture(); if ( x == 0 && y == 0 || x == 1 && y == 0 ) { centerPt.X += PIECE_XY_STEP; } if ( x == 2 && y == 0 || x == 2 && y == 1 ) { centerPt.Y += PIECE_XY_STEP; } if ( x == 1 && y == 2 || x == 2 && y == 2 ) { centerPt.X -= PIECE_XY_STEP; } if ( x == 0 && y == 1 || x == 0 && y == 2 ) { centerPt.Y -= PIECE_XY_STEP; } // 右上 (元:中央上) のみ 90° 回転 if ( x == 1 && y == 0 ) { rot = Math.PI / 2; } DDDraw.DrawBegin(picture, centerPt.X, centerPt.Y); DDDraw.DrawRotate(rot); DDDraw.DrawEnd(); } } targetScreen.ChangeDrawScreen(); DDDraw.DrawSimple(Screen.ToPicture(), 0, 0); }
void GoogleLikeCombo_RequestItemHighlight(object sender, DX.RequestItemHighlightEventArgs args) { if (!string.IsNullOrEmpty(this.Text) && args.text != this.Text) { int i = args.text.IndexOf(this.Text); if (i != -1) args.TextSelection = new DX.TextSelectionData(i, this.Text.Length, System.Drawing.Color.FromArgb(80, System.Drawing.Color.Blue)); } }
/// <inheritdoc /> public bool Equals([AllowNull] Contour other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Type == other.Type || Type != null && Type.Equals(other.Type) ) && ( Visible == other.Visible || Visible != null && Visible.Equals(other.Visible) ) && ( ShowLegend == other.ShowLegend || ShowLegend != null && ShowLegend.Equals(other.ShowLegend) ) && ( LegendGroup == other.LegendGroup || LegendGroup != null && LegendGroup.Equals(other.LegendGroup) ) && ( Opacity == other.Opacity || Opacity != null && Opacity.Equals(other.Opacity) ) && ( Name == other.Name || Name != null && Name.Equals(other.Name) ) && ( UId == other.UId || UId != null && UId.Equals(other.UId) ) && ( Equals(Ids, other.Ids) || Ids != null && other.Ids != null && Ids.SequenceEqual(other.Ids) ) && ( Equals(CustomData, other.CustomData) || CustomData != null && other.CustomData != null && CustomData.SequenceEqual(other.CustomData) ) && ( Meta == other.Meta || Meta != null && Meta.Equals(other.Meta) ) && ( Equals(MetaArray, other.MetaArray) || MetaArray != null && other.MetaArray != null && MetaArray.SequenceEqual(other.MetaArray) ) && ( HoverInfo == other.HoverInfo || HoverInfo != null && HoverInfo.Equals(other.HoverInfo) ) && ( Equals(HoverInfoArray, other.HoverInfoArray) || HoverInfoArray != null && other.HoverInfoArray != null && HoverInfoArray.SequenceEqual(other.HoverInfoArray) ) && ( HoverLabel == other.HoverLabel || HoverLabel != null && HoverLabel.Equals(other.HoverLabel) ) && ( Stream == other.Stream || Stream != null && Stream.Equals(other.Stream) ) && ( Equals(Transforms, other.Transforms) || Transforms != null && other.Transforms != null && Transforms.SequenceEqual(other.Transforms) ) && ( UiRevision == other.UiRevision || UiRevision != null && UiRevision.Equals(other.UiRevision) ) && ( Equals(Z, other.Z) || Z != null && other.Z != null && Z.SequenceEqual(other.Z) ) && ( Equals(X, other.X) || X != null && other.X != null && X.SequenceEqual(other.X) ) && ( X0 == other.X0 || X0 != null && X0.Equals(other.X0) ) && ( DX == other.DX || DX != null && DX.Equals(other.DX) ) && ( Equals(Y, other.Y) || Y != null && other.Y != null && Y.SequenceEqual(other.Y) ) && ( Y0 == other.Y0 || Y0 != null && Y0.Equals(other.Y0) ) && ( Dy == other.Dy || Dy != null && Dy.Equals(other.Dy) ) && ( Equals(Text, other.Text) || Text != null && other.Text != null && Text.SequenceEqual(other.Text) ) && ( Equals(HoverText, other.HoverText) || HoverText != null && other.HoverText != null && HoverText.SequenceEqual(other.HoverText) ) && ( Transpose == other.Transpose || Transpose != null && Transpose.Equals(other.Transpose) ) && ( XType == other.XType || XType != null && XType.Equals(other.XType) ) && ( YType == other.YType || YType != null && YType.Equals(other.YType) ) && ( ZHoverFormat == other.ZHoverFormat || ZHoverFormat != null && ZHoverFormat.Equals(other.ZHoverFormat) ) && ( HoverTemplate == other.HoverTemplate || HoverTemplate != null && HoverTemplate.Equals(other.HoverTemplate) ) && ( Equals(HoverTemplateArray, other.HoverTemplateArray) || HoverTemplateArray != null && other.HoverTemplateArray != null && HoverTemplateArray.SequenceEqual(other.HoverTemplateArray) ) && ( HoverOnGaps == other.HoverOnGaps || HoverOnGaps != null && HoverOnGaps.Equals(other.HoverOnGaps) ) && ( ConnectGaps == other.ConnectGaps || ConnectGaps != null && ConnectGaps.Equals(other.ConnectGaps) ) && ( FillColor == other.FillColor || FillColor != null && FillColor.Equals(other.FillColor) ) && ( AutoContour == other.AutoContour || AutoContour != null && AutoContour.Equals(other.AutoContour) ) && ( NContours == other.NContours || NContours != null && NContours.Equals(other.NContours) ) && ( Contours == other.Contours || Contours != null && Contours.Equals(other.Contours) ) && ( Line == other.Line || Line != null && Line.Equals(other.Line) ) && ( ZAuto == other.ZAuto || ZAuto != null && ZAuto.Equals(other.ZAuto) ) && ( ZMin == other.ZMin || ZMin != null && ZMin.Equals(other.ZMin) ) && ( ZMax == other.ZMax || ZMax != null && ZMax.Equals(other.ZMax) ) && ( ZMid == other.ZMid || ZMid != null && ZMid.Equals(other.ZMid) ) && ( ColorScale == other.ColorScale || ColorScale != null && ColorScale.Equals(other.ColorScale) ) && ( AutoColorScale == other.AutoColorScale || AutoColorScale != null && AutoColorScale.Equals(other.AutoColorScale) ) && ( ReverseScale == other.ReverseScale || ReverseScale != null && ReverseScale.Equals(other.ReverseScale) ) && ( ShowScale == other.ShowScale || ShowScale != null && ShowScale.Equals(other.ShowScale) ) && ( ColorBar == other.ColorBar || ColorBar != null && ColorBar.Equals(other.ColorBar) ) && ( ColorAxis == other.ColorAxis || ColorAxis != null && ColorAxis.Equals(other.ColorAxis) ) && ( XCalendar == other.XCalendar || XCalendar != null && XCalendar.Equals(other.XCalendar) ) && ( YCalendar == other.YCalendar || YCalendar != null && YCalendar.Equals(other.YCalendar) ) && ( XAxis == other.XAxis || XAxis != null && XAxis.Equals(other.XAxis) ) && ( YAxis == other.YAxis || YAxis != null && YAxis.Equals(other.YAxis) ) && ( IdsSrc == other.IdsSrc || IdsSrc != null && IdsSrc.Equals(other.IdsSrc) ) && ( CustomDataSrc == other.CustomDataSrc || CustomDataSrc != null && CustomDataSrc.Equals(other.CustomDataSrc) ) && ( MetaSrc == other.MetaSrc || MetaSrc != null && MetaSrc.Equals(other.MetaSrc) ) && ( HoverInfoSrc == other.HoverInfoSrc || HoverInfoSrc != null && HoverInfoSrc.Equals(other.HoverInfoSrc) ) && ( ZSrc == other.ZSrc || ZSrc != null && ZSrc.Equals(other.ZSrc) ) && ( XSrc == other.XSrc || XSrc != null && XSrc.Equals(other.XSrc) ) && ( YSrc == other.YSrc || YSrc != null && YSrc.Equals(other.YSrc) ) && ( TextSrc == other.TextSrc || TextSrc != null && TextSrc.Equals(other.TextSrc) ) && ( HoverTextSrc == other.HoverTextSrc || HoverTextSrc != null && HoverTextSrc.Equals(other.HoverTextSrc) ) && ( HoverTemplateSrc == other.HoverTemplateSrc || HoverTemplateSrc != null && HoverTemplateSrc.Equals(other.HoverTemplateSrc) )); }