コード例 #1
0
ファイル: XNAWindowBase.cs プロジェクト: sgrzeda/rose
 public XNAWindowBase()
 {
     graphicsDeviceService = XNAGraphicsDeviceService.AddRef(Handle, ClientSize.Width, ClientSize.Height);
     graphicsDevice = graphicsDeviceService.GraphicsDevice;
     Application.Idle += delegate { Invalidate(); };
     InitializeComponent();
 }
コード例 #2
0
ファイル: XNAWindowBase.cs プロジェクト: sgrzeda/rose
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (graphicsDeviceService != null)
            {
                graphicsDeviceService.Release(disposing);
                graphicsDeviceService = null;
            }

            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
コード例 #3
0
        public static XNAGraphicsDeviceService AddRef(IntPtr windowHandle,
            int width, int height)
        {
            Interlocked.Increment(ref referenceCount);
            if (singletonInstance == null)
            {
                singletonInstance = new XNAGraphicsDeviceService(windowHandle,
                                                              width, height);
            }

            return singletonInstance;
        }