コード例 #1
0
ファイル: SLGDControl.cs プロジェクト: thakgit/StiLib
        /// <summary>
        /// Disposes the control.
        /// </summary>
        /// <param name="disposing"></param>
        protected override void Dispose(bool disposing)
        {
            if (gdservice != null)
            {
                gdservice.Release(disposing);
                gdservice = null;
            }

            base.Dispose(disposing);
        }
コード例 #2
0
ファイル: SLGDControl.cs プロジェクト: babaq/StiLib
        /// <summary>
        /// Disposes the control.
        /// </summary>
        /// <param name="disposing"></param>
        protected override void Dispose(bool disposing)
        {
            if (gdservice != null)
            {
                gdservice.Release(disposing);
                gdservice = null;
            }

            base.Dispose(disposing);
        }
コード例 #3
0
ファイル: SLGDService.cs プロジェクト: thakgit/StiLib
        /// <summary>
        /// Gets a reference to the singleton instance.
        /// </summary>
        /// <param name="windowHandle"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <returns></returns>
        public static SLGDService AddRef(IntPtr windowHandle, int width, int height)
        {
            // Increment the "how many client sharing the device" reference count.
            if (Interlocked.Increment(ref referenceCount) == 1)
            {
                // If this is the first client to start using the device, we must create the singleton instance.
                singletonInstance = new SLGDService(windowHandle, width, height);
            }

            return(singletonInstance);
        }
コード例 #4
0
ファイル: SLGDControl.cs プロジェクト: thakgit/StiLib
        /// <summary>
        /// Initializes the control.
        /// </summary>
        protected override void OnCreateControl()
        {
            // Don't initialize the graphics device if we are running in the designer.
            if (!DesignMode)
            {
                gdservice = SLGDService.AddRef(Handle, ClientSize.Width, ClientSize.Height);
                // Register the service, so components like ContentManager can find it.
                services.AddService <IGraphicsDeviceService>(gdservice);
                // Give derived classes a chance to initialize themselves.
                Initialize();
            }

            base.OnCreateControl();
        }
コード例 #5
0
ファイル: SLGDService.cs プロジェクト: babaq/StiLib
        /// <summary>
        /// Gets a reference to the singleton instance.
        /// </summary>
        /// <param name="windowHandle"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <returns></returns>
        public static SLGDService AddRef(IntPtr windowHandle, int width, int height)
        {
            // Increment the "how many client sharing the device" reference count.
            if (Interlocked.Increment(ref referenceCount) == 1)
            {
                // If this is the first client to start using the device, we must create the singleton instance.
                singletonInstance = new SLGDService(windowHandle, width, height);
            }

            return singletonInstance;
        }
コード例 #6
0
ファイル: SLGDControl.cs プロジェクト: babaq/StiLib
        /// <summary>
        /// Initializes the control.
        /// </summary>
        protected override void OnCreateControl()
        {
            // Don't initialize the graphics device if we are running in the designer.
            if (!DesignMode)
            {
                gdservice = SLGDService.AddRef(Handle, ClientSize.Width, ClientSize.Height);
                // Register the service, so components like ContentManager can find it.
                services.AddService<IGraphicsDeviceService>(gdservice);
                // Give derived classes a chance to initialize themselves.
                Initialize();
            }

            base.OnCreateControl();
        }