Beispiel #1
0
        public void Load()
        {
            if (Loaded)
            {
                return;
            }

            if (IsSystemCursor)
            {
                CursorHandle = SDL.CreateSystemCursor((SDL.SystemCursor)SystemCursor);
            }
            else
            {
                CursorHandle = SDL.CreateColorCursor(IMG.Load_RW(Resources.CreateRWFromFile(Filename, FileAssembly), 1), (int)Origin.X, (int)Origin.Y);
            }

            if (CursorHandle != IntPtr.Zero)
            {
                Loaded = true;
            }
            else
            {
                throw new FileLoadException();
            }
        }
Beispiel #2
0
        public OpenGLCursor(UltravioletContext uv, Surface2D surface, Int32 hx, Int32 hy)
            : base(uv)
        {
            Contract.Require(surface, nameof(surface));

            uv.ValidateResource(surface);

            if (AreCursorsSupported(uv))
            {
                this.cursor   = SDL.CreateColorCursor(((OpenGLSurface2D)surface).Native, hx, hy);
                this.Width    = surface.Width;
                this.Height   = surface.Height;
                this.HotspotX = hx;
                this.HotspotY = hy;

                if (this.cursor == null)
                {
                    this.Width    = 0;
                    this.Height   = 0;
                    this.HotspotX = 0;
                    this.HotspotY = 0;
                }
            }
            else
            {
                this.cursor = null;
                this.Width  = 0;
                this.Height = 0;
            }
        }