Skip to content

Commit

Permalink
Merge pull request #146 from andy840119/salve/icon
Browse files Browse the repository at this point in the history
Add icon
  • Loading branch information
andy840119 authored Jul 19, 2020
2 parents b6ed2ed + ac3b214 commit 1cd3fce
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 1 deletion.
35 changes: 35 additions & 0 deletions osu.Game.Rulesets.Karaoke.Tests/UI/TestCaseRulesetIcon.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence.
// See the LICENCE file in the repository root for full licence text.

using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Effects;
using osu.Game.Graphics.Containers;
using osu.Game.Tests.Visual;
using osuTK;
using osuTK.Graphics;

namespace osu.Game.Rulesets.Karaoke.Tests.UI
{
[TestFixture]
public class TestCaseRulesetIcon : OsuTestScene
{
public TestCaseRulesetIcon()
{
Child = new ConstrainedIconContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Icon = new KaraokeRuleset().CreateIcon(),
EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Glow,
Colour = new Color4(255, 194, 224, 100),
Radius = 15,
Roundness = 15,
},
Size = new Vector2(40)
};
}
}
}
25 changes: 24 additions & 1 deletion osu.Game.Rulesets.Karaoke/KaraokeRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Input.Bindings;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
Expand Down Expand Up @@ -33,6 +35,7 @@
using osu.Game.Scoring;
using osu.Game.Screens.Ranking.Statistics;
using osu.Game.Skinning;
using osuTK;

namespace osu.Game.Rulesets.Karaoke
{
Expand Down Expand Up @@ -123,7 +126,27 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
}
}

public override Drawable CreateIcon() => new SpriteIcon { Icon = KaraokeIcon.RulesetKaraoke };
public override Drawable CreateIcon() => new Container
{
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
new Sprite
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(0.9f),
Texture = new TextureStore(new TextureLoaderStore(CreateResourceStore()), false).Get("Textures/logo"),
},
new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(45f),
Icon = FontAwesome.Regular.Circle,
},
}
};

public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new KaraokeDifficultyCalculator(this, beatmap);

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1cd3fce

Please sign in to comment.