-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1504 from andy840119/update-package
Update package to the latest.
- Loading branch information
Showing
11 changed files
with
98 additions
and
54 deletions.
There are no files selected for viewing
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
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
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 |
---|---|---|
@@ -1,15 +1,12 @@ | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using System; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.OpenGL; | ||
using osu.Framework.Graphics.OpenGL.Vertices; | ||
using osu.Framework.Graphics.Primitives; | ||
using osu.Framework.Graphics.Rendering; | ||
using osu.Framework.Graphics.Sprites; | ||
using osu.Framework.Graphics.Textures; | ||
using osuTK; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Graphics.Shapes | ||
|
@@ -21,7 +18,15 @@ public class RightTriangle : Sprite | |
/// </summary> | ||
public RightTriangle() | ||
{ | ||
Texture = Texture.WhitePixel; | ||
// Setting the texture would normally set a size of (1, 1), but since the texture is set from BDL it needs to be set here instead. | ||
// RelativeSizeAxes may not behave as expected if this is not done. | ||
Size = Vector2.One; | ||
} | ||
|
||
[BackgroundDependencyLoader] | ||
private void load(IRenderer renderer) | ||
{ | ||
Texture ??= renderer.WhitePixel; | ||
} | ||
|
||
public override RectangleF BoundingBox => toTriangle(ToParentSpace(LayoutRectangle), RightAngleDirection).AABBFloat; | ||
|
@@ -70,20 +75,26 @@ public override void ApplyState() | |
rightAngleDirection = Source.RightAngleDirection; | ||
} | ||
|
||
protected override void Blit(Action<TexturedVertex2D> vertexAction) | ||
protected override void Blit(IRenderer renderer) | ||
{ | ||
DrawTriangle(Texture, toTriangle(ScreenSpaceDrawQuad, rightAngleDirection), DrawColourInfo.Colour, null, null, | ||
if (DrawRectangle.Width == 0 || DrawRectangle.Height == 0) | ||
return; | ||
|
||
renderer.DrawTriangle(Texture, toTriangle(ScreenSpaceDrawQuad, rightAngleDirection), DrawColourInfo.Colour, null, null, | ||
new Vector2(InflationAmount.X / DrawRectangle.Width, InflationAmount.Y / DrawRectangle.Height), TextureCoords); | ||
} | ||
|
||
protected override void BlitOpaqueInterior(Action<TexturedVertex2D> vertexAction) | ||
protected override void BlitOpaqueInterior(IRenderer renderer) | ||
{ | ||
if (DrawRectangle.Width == 0 || DrawRectangle.Height == 0) | ||
return; | ||
|
||
var triangle = toTriangle(ConservativeScreenSpaceDrawQuad, rightAngleDirection); | ||
|
||
if (GLWrapper.IsMaskingActive) | ||
DrawClipped(ref triangle, Texture, DrawColourInfo.Colour, vertexAction: vertexAction); | ||
if (renderer.IsMaskingActive) | ||
renderer.DrawClipped(ref triangle, Texture, DrawColourInfo.Colour); | ||
else | ||
DrawTriangle(Texture, triangle, DrawColourInfo.Colour, vertexAction: vertexAction); | ||
renderer.DrawTriangle(Texture, triangle, DrawColourInfo.Colour); | ||
} | ||
} | ||
} | ||
|
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
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
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
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
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
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
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
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