/// <summary> /// Draws a custom texture from a file on a 1080-pixels height base. /// </summary> /// <param name="texture">Your custom texture object.</param> /// <param name="position"></param> /// <param name="size"></param> /// <param name="graphics"></param> public static void DrawTexture(Texture texture, Point position, Size size, Rage.Graphics graphics) { var origRes = Game.Resolution; float aspectRaidou = origRes.Width / (float)origRes.Height; PointF pos = new PointF(position.X / (1080 * aspectRaidou), position.Y / 1080f); SizeF siz = new SizeF(size.Width / (1080 * aspectRaidou), size.Height / 1080f); graphics.DrawTexture(texture, pos.X * Game.Resolution.Width, pos.Y * Game.Resolution.Height, siz.Width * Game.Resolution.Width, siz.Height * Game.Resolution.Height); }
/// <summary> /// Draw your custom banner. /// <para> /// To prevent flickering call it inside a <see cref="Game.RawFrameRender"/> event handler. /// </para> /// </summary> /// <param name="g">The <see cref="Rage.Graphics"/> to draw on.</param> public void DrawBanner(Rage.Graphics g) { if (!Visible || _customBanner == null) return; var origRes = Game.Resolution; float aspectRaidou = origRes.Width / (float)origRes.Height; Point bannerPos = new Point(_offset.X + safezoneBounds.X, _offset.Y + safezoneBounds.Y); Size bannerSize = new Size(431 + WidthOffset, 107); PointF pos = new PointF(bannerPos.X / (1080 * aspectRaidou), bannerPos.Y / 1080f); SizeF siz = new SizeF(bannerSize.Width / (1080 * aspectRaidou), bannerSize.Height / 1080f); //Bug: funky positionment on windowed games + max resolution. g.DrawTexture(_customBanner, pos.X * Game.Resolution.Width, pos.Y * Game.Resolution.Height, siz.Width * Game.Resolution.Width, siz.Height * Game.Resolution.Height); }