/// <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); }
internal static void Draw(this Sprite sprite, Rage.Graphics graphics) { Texture texture = sprite.Texture; var origRes = Game.Resolution; float aspectRaidou = origRes.Width / (float)origRes.Height; PointF pos = new PointF(sprite.Position.X / (1080 * aspectRaidou), sprite.Position.Y / 1080f); SizeF siz = new SizeF(sprite.Size.Width / (1080 * aspectRaidou), sprite.Size.Height / 1080f); if (texture != null) { graphics.DrawTexture(texture, pos.X * Game.Resolution.Width, pos.Y * Game.Resolution.Height, siz.Width * Game.Resolution.Width, siz.Height * Game.Resolution.Height); } }
public void OnDraw(Graphics g) { if (Image != null) { float marginTotalWidth = (2 * 2.5f); g.DrawRectangle(new RectangleF(location.X - marginTotalWidth, location.Y, ImageWidth + marginTotalWidth, NotificationHeight), Color.FromArgb(190, 3, 3, 3)); g.DrawTexture(Image, new RectangleF(location.X + 2.5f - marginTotalWidth, location.Y + ImageY, ImageWidth, ImageWidth)); } float x_ = location.X + (Image != null ? ImageWidth : 0.0f); g.DrawRectangle(new RectangleF(x_, location.Y, Width + 5.0f, NotificationHeight), Color.FromArgb(190, 3, 3, 3)); g.DrawText(TitleWrapped, Font, TitleFontSize, new PointF(x_ + 5, location.Y + 2.0f), TitleColor); g.DrawText(SubtitleWrapped, Font, SubtitleFontSize, new PointF(x_ + 5, location.Y + SubtitleYCoordinate + 20.0f), SubtitleColor); }