//* -----------------------------------------------------------------------* /// <summary> /// 指定のグラフィック デバイス マネージャを使用して、Nineballを起動します。 /// </summary> /// /// <param name="game">Nineballを実行するゲームクラス。</param> /// <param name="graphicsDeviceManager">グラフィック デバイスの構成・管理クラス。</param> public static void startNineball( this Game game, GraphicsDeviceManager graphicsDeviceManager ) { mainLoop = new CDrawableGameComponent(game, new CMainLoop(game, graphicsDeviceManager), true); }
//* -----------------------------------------------------------------------* /// <summary> /// オブジェクトを描画に対応したゲーム コンポーネントとして一覧に登録します。 /// </summary> /// <remarks> /// オブジェクトは、自動的に描画に対応したゲーム コンポーネントでラッピングされます。 /// </remarks> /// /// <param name="entity">状態を持つオブジェクト。</param> /// <returns>ゲーム コンポーネントでラッピングされたオブジェクト。</returns> public CDrawableGameComponent addDrawableEntity(IEntity entity) { CDrawableGameComponent result = new CDrawableGameComponent(game, entity, false); Add(result); return(result); }
//* -----------------------------------------------------------------------* /// <summary>Nineballを終了します。</summary> /// /// <param name="game">Nineballを実行するゲームクラス。</param> /// <returns>正しく終了できた場合、<c>true</c>。</returns> public static bool endNineball(this Game game) { bool bResult = false; if (mainLoop != null) { bResult = game.Components.Remove(mainLoop); mainLoop.Dispose(); mainLoop = null; } return(bResult); }
//* ────────────-_______________________* //* constructor & destructor ───────────────────────* //* -----------------------------------------------------------------------* /// <summary>コンストラクタ。</summary> private CGame() { if (instance != null) { throw new InvalidOperationException( string.Format(nineball.Properties.Resources.CLASS_ERR_SINGLETON, this.GetType().FullName)); } instance = this; graphicDeviceManager = new GraphicsDeviceManager(this); Rectangle rect = EResolution.VGA.toRect(); graphicDeviceManager.PreferredBackBufferWidth = rect.Width; graphicDeviceManager.PreferredBackBufferHeight = rect.Height; new CGuideWrapper(this); scene = new CEntity(CSceneInitialize.instance, this); CDrawableGameComponent gcScene = new CDrawableGameComponent(this, scene, true); gcScene.DrawOrder = int.MaxValue; gcScene.UpdateOrder = int.MaxValue; }