/// <summary> /// Initializes a new instance of the <see cref="SDL2Cursor"/> class. /// </summary> /// <param name="uv">The Ultraviolet context.</param> /// <param name="surface">The surface that contains the cursor image.</param> /// <param name="hx">The x-coordinate of the cursor's hotspot.</param> /// <param name="hy">The y-coordinate of the cursor's hotspot.</param> public SDL2Cursor(UltravioletContext uv, Surface2D surface, Int32 hx, Int32 hy) : base(uv) { Contract.Require(surface, nameof(surface)); uv.ValidateResource(surface); if (uv.Platform != UltravioletPlatform.Android && uv.Platform != UltravioletPlatform.iOS) { this.cursor = SDL_CreateColorCursor(((SDL2Surface2D)surface).NativePtr, 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; } }
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; } }
/// <summary> /// Initializes a new instance of the <see cref="SpriteFont"/> class. /// </summary> /// <param name="uv">The Ultraviolet context.</param> /// <param name="faceRegular">The <see cref="SpriteFontFace"/> that represents the font's regular style.</param> /// <param name="faceBold">The <see cref="SpriteFontFace"/> that represents the font's bold style.</param> /// <param name="faceItalic">The <see cref="SpriteFontFace"/> that represents the font's italic style.</param> /// <param name="faceBoldItalic">The <see cref="SpriteFontFace"/> that represents the font's bold/italic style.</param> public SpriteFont(UltravioletContext uv, SpriteFontFace faceRegular, SpriteFontFace faceBold, SpriteFontFace faceItalic, SpriteFontFace faceBoldItalic) : base(uv) { uv.ValidateResource(faceRegular); uv.ValidateResource(faceBold); uv.ValidateResource(faceItalic); uv.ValidateResource(faceBoldItalic); if (faceRegular == null && faceBold == null && faceItalic == null && faceBoldItalic == null) throw new ArgumentException(UltravioletStrings.InvalidFontFaces); this.faceRegular = faceRegular; this.faceBold = faceBold; this.faceItalic = faceItalic; this.faceBoldItalic = faceBoldItalic; }
/// <summary> /// Initializes a new instance of the OpenGLCursor class. /// </summary> /// <param name="uv">The UltravioletContext class.</param> /// <param name="surface">The surface that contains the cursor image.</param> /// <param name="hx">The x-coordinate of the cursor's hotspot.</param> /// <param name="hy">The y-coordinate of the cursor's hotspot.</param> public OpenGLCursor(UltravioletContext uv, Surface2D surface, Int32 hx, Int32 hy) : base(uv) { Contract.Require(surface, "surface"); uv.ValidateResource(surface); if (AreCursorsSupported(uv)) { this.cursor = SDL.CreateColorCursor(((OpenGLSurface2D)surface).Native, hx, hy); this.width = surface.Width; this.height = surface.Height; if (this.cursor == null) { this.width = 0; this.height = 0; } } else { this.cursor = null; this.width = 0; this.height = 0; } }
/// <summary> /// Initializes a new instance of the <see cref="SpriteFont"/> class. /// </summary> /// <param name="uv">The Ultraviolet context.</param> /// <param name="faceRegular">The <see cref="SpriteFontFace"/> that represents the font's regular style.</param> /// <param name="faceBold">The <see cref="SpriteFontFace"/> that represents the font's bold style.</param> /// <param name="faceItalic">The <see cref="SpriteFontFace"/> that represents the font's italic style.</param> /// <param name="faceBoldItalic">The <see cref="SpriteFontFace"/> that represents the font's bold/italic style.</param> public SpriteFont(UltravioletContext uv, SpriteFontFace faceRegular, SpriteFontFace faceBold, SpriteFontFace faceItalic, SpriteFontFace faceBoldItalic) : base(uv) { uv.ValidateResource(faceRegular); uv.ValidateResource(faceBold); uv.ValidateResource(faceItalic); uv.ValidateResource(faceBoldItalic); if (faceRegular == null && faceBold == null && faceItalic == null && faceBoldItalic == null) { throw new ArgumentException(UltravioletStrings.InvalidFontFaces); } this.faceRegular = faceRegular; this.faceBold = faceBold; this.faceItalic = faceItalic; this.faceBoldItalic = faceBoldItalic; }
/// <summary> /// Initializes a new instance of the <see cref="UltravioletFont{TFontFace}"/> class. /// </summary> /// <param name="uv">The Ultraviolet context.</param> /// <param name="regular">The font's regular font face.</param> /// <param name="bold">The font's bold font face.</param> /// <param name="italic">The font's italic font face.</param> /// <param name="boldItalic">The font's bold italic font face.</param> protected UltravioletFont(UltravioletContext uv, UltravioletFontFace regular, UltravioletFontFace bold, UltravioletFontFace italic, UltravioletFontFace boldItalic) : base(uv) { uv.ValidateResource(regular); uv.ValidateResource(bold); uv.ValidateResource(italic); uv.ValidateResource(boldItalic); if (regular == null && bold == null && italic == null && boldItalic == null) { throw new ArgumentException(UltravioletStrings.InvalidFontFaces); } this.Regular = regular; this.Bold = bold; this.Italic = italic; this.BoldItalic = boldItalic; }