From c31796c9577b0fd77a41e1fd8cca3d993b741f4a Mon Sep 17 00:00:00 2001 From: Lunar Dust Date: Mon, 17 Oct 2016 17:08:06 -0500 Subject: [PATCH] Move and tweak avatar class --- osu.Game/Graphics/Avatar.cs | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 osu.Game/Graphics/Avatar.cs diff --git a/osu.Game/Graphics/Avatar.cs b/osu.Game/Graphics/Avatar.cs new file mode 100644 index 0000000000..9349a048e7 --- /dev/null +++ b/osu.Game/Graphics/Avatar.cs @@ -0,0 +1,41 @@ +//Copyright (c) 2007-2016 ppy Pty Ltd . +//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Framework.IO.Stores; +using OpenTK; + +namespace osu.Game.Graphics +{ + public class Avatar : Sprite + { + private int userId; + private int rounding; + private int avatarSize = 50; + + + public Avatar(int userid, int avatarsize, int round) + { + this.userId = uId; + this.avatarSize = aSize; + this.rounding = round; + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + } + + public override async void Load(BaseGame game) + { + base.Load(game); + + Texture = await game.Textures.GetAsync($@"https://a.ppy.sh/{userId}"); + Size = new Vector2(avatarSize); + CornerRadius = rounding; + } + } +}