AddRef() public static method

Gets a reference to the singleton instance.
public static AddRef ( IntPtr windowHandle, int width, int height ) : GraphicsDeviceService
windowHandle System.IntPtr
width int
height int
return GraphicsDeviceService
Esempio n. 1
0
 void XnaWindowHost_Loaded(object sender, RoutedEventArgs e)
 {
     // If we don't yet have a GraphicsDeviceService reference, we must add one for this control
     if (graphicsService == null)
     {
         graphicsService = GraphicsDeviceService.AddRef(hWnd, (int)ActualWidth, (int)ActualHeight);
         // Invoke the LoadContent event
         if (LoadContent != null)
         {
             LoadContent(this, new GraphicsDeviceEventArgs(graphicsService.GraphicsDevice));
         }
     }
 }
Esempio n. 2
0
        bool InitGraphicsDevice()
        {
            // If we don't yet have a GraphicsDeviceService reference, we must add one for this control
            if (graphicsService == null || graphicsService.GraphicsDevice == null || graphicsService.GraphicsDevice.IsDisposed)
            {
                graphicsService = GraphicsDeviceService.AddRef(hWnd, (int)ActualWidth, (int)ActualHeight);
                // Invoke the LoadContent event
                if (LoadContent != null)
                {
                    LoadContent(this, new GraphicsDeviceEventArgs(graphicsService.GraphicsDevice));
                }

                return(true);
            }

            return(false);
        }