public static S3DLine GetMouseLay() { var game_base = GameBase.GetInstance(); int mx, my; DX.VECTOR vp1, vp2; mx = game_base.input.mouse_sutatus.position.X; my = game_base.input.mouse_sutatus.position.Y; // マウスポインタがある画面上の座標に該当する3D空間上の Near 面の座標を取得 vp1 = DX.ConvScreenPosToWorldPos(DX.VGet(mx, my, 0.0f)); // マウスポインタがある画面上の座標に該当する3D空間上の Far 面の座標を取得 vp2 = DX.ConvScreenPosToWorldPos(DX.VGet(mx, my, 1.0f)); return(new S3DLine(new S3DPoint(vp1.x, vp1.y, vp1.z), new S3DPoint(vp2.x, vp2.y, vp2.z))); }
public GameBase(Form form, int window_size_w, int window_size_h, DlgMainLoopOneFrame dlg_main_loop_one_frame = null, bool is_fps_show = false) { game_base = this; this.form = form; this.window_size_w = window_size_w; this.window_size_h = window_size_h; this.is_fps_show = is_fps_show; this.dlg_main_loop_one_frame = dlg_main_loop_one_frame; form.ClientSize = new Size(window_size_w, window_size_h); int sh = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height; int sw = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width; form.Location = new Point((sw - form.Size.Width) / 2, (sh - form.Size.Height) / 2); WaitTimer.InitClass(); input = new Input(form); DX.SetUserWindow(form.Handle); //DxLibの親ウインドウをこのフォームウインドウにセット DX.DxLib_Init(); DX.SetDrawMode(DX.DX_DRAWMODE_BILINEAR); }
private void Form1_Load(object sender, EventArgs e) { game_base = new GameBase(this, 1024, 720, null, true); game_main = new GameMain(game_base); // DxLib初期化後にこちらを処理したいので game_base.dlg_main_loop_one_frame = game_main.MainLoop; // 上記の理由につきやや強引(引数でやりたいところ) }