-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add maximum dimensions limit to skinnable gameplay elements #24706
Merged
peppy
merged 23 commits into
ppy:master
from
frenzibyte:limit-gameplay-sprite-dimensions
Sep 26, 2023
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
2c81fe5
Make gameplay skin elements in `special-skin` awfully large
frenzibyte 6674c70
Add support for limiting skin texture/animation dimensions
frenzibyte 351081e
Add limit to osu! hit circle elements
frenzibyte d286816
Add limit to taiko hit elements
frenzibyte f182f57
Add limit to catch palpable object elements
frenzibyte 96f12cf
Update `GetTexture` signature rather than creating new overload
peppy 9d17539
Add size limitations for taiko drum rolls
peppy 57dc76b
Revert "Update `GetTexture` signature rather than creating new overload"
frenzibyte 291a91b
Change extension from retrieval to post-processing instead
frenzibyte a373d71
Add basic test scene upscaling all skin elements
frenzibyte fc1a39e
Add size limitations for slider balls
frenzibyte f963a92
Add size limitation for slider follow circle
frenzibyte b823507
Add size limitation for approach circles
frenzibyte ab52268
Add size limitation for slider reverse arrow piece
frenzibyte 922f6f3
Add size limitation for hit object numbers
frenzibyte 8f5d1b5
Revert "Make gameplay skin elements in `special-skin` awfully large"
frenzibyte 8e16b1d
Simplify some maximum size specs
peppy bd66285
Rename parameter on `LegacySpriteText` to better imply the maximum si…
peppy 1316403
Fix inspection in new test scene
peppy c4fc419
Use correct maximum size for droplets
frenzibyte ad86bf2
Revert redundant size limitations
frenzibyte b1561b6
Rename test scene, add xmldoc and increase scale factor to something …
peppy 990c545
Merge branch 'master' into limit-gameplay-sprite-dimensions
peppy File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
73 changes: 73 additions & 0 deletions
73
osu.Game.Tests/Visual/Gameplay/TestSceneGameplayElementDimensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Graphics.Textures; | ||
using osu.Framework.Testing; | ||
using osu.Game.IO; | ||
using osu.Game.Rulesets; | ||
using osu.Game.Screens.Play; | ||
using osu.Game.Skinning; | ||
|
||
namespace osu.Game.Tests.Visual.Gameplay | ||
{ | ||
public partial class TestSceneGameplayElementDimensions : TestSceneAllRulesetPlayers | ||
{ | ||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) | ||
{ | ||
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); | ||
|
||
// for now this only applies to legacy skins, as modern skins don't have texture-based gameplay elements yet. | ||
dependencies.CacheAs<ISkinSource>(new UpscaledLegacySkin(dependencies.Get<SkinManager>())); | ||
|
||
return dependencies; | ||
} | ||
|
||
protected override void AddCheckSteps() | ||
{ | ||
} | ||
|
||
protected override Player CreatePlayer(Ruleset ruleset) | ||
{ | ||
var player = base.CreatePlayer(ruleset); | ||
player.OnLoadComplete += _ => | ||
{ | ||
// this test scene focuses on gameplay elements, so let's hide the hud. | ||
var hudOverlay = player.ChildrenOfType<HUDOverlay>().Single(); | ||
hudOverlay.ShowHud.Value = false; | ||
hudOverlay.ShowHud.Disabled = true; | ||
}; | ||
return player; | ||
} | ||
|
||
private class UpscaledLegacySkin : DefaultLegacySkin, ISkinSource | ||
{ | ||
public UpscaledLegacySkin(IStorageResourceProvider resources) | ||
: base(resources) | ||
{ | ||
} | ||
|
||
public event Action? SourceChanged | ||
{ | ||
add { } | ||
remove { } | ||
} | ||
|
||
public override Texture? GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) | ||
{ | ||
var texture = base.GetTexture(componentName, wrapModeS, wrapModeT); | ||
|
||
if (texture != null) | ||
texture.ScaleAdjust /= 5f; | ||
|
||
return texture; | ||
} | ||
|
||
public ISkin? FindProvider(Func<ISkin, bool> lookupFunction) => this; | ||
public IEnumerable<ISkin> AllSources => new[] { this }; | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What on earth is this naming..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I...don't know?