make holdnote longs as wide as end-capped notes

This commit is contained in:
msk
2023-10-09 21:52:23 -07:00
parent cdcef063bf
commit d00f42753d
6 changed files with 52 additions and 64 deletions
+32 -1
View File
@@ -56,7 +56,7 @@ namespace WacK
}
// Return an equivalent minute that's closest to the origin.
public static float NearestMinute(int origin, int destination)
public static int NearestMinute(int origin, int destination)
{
int result = destination % 60;
@@ -73,6 +73,37 @@ namespace WacK
return result;
}
public static (float, float) PixelizeNote(int pos, int size, int endCapPx = 12)
{
float pxPerMinute = Constants.BASE_2D_RESOLUTION / 60;
float posPx = 0;
float sizePx = 0;
if (size <= 59)
{
if (size >= 3)
{
posPx = (pos + 1) * pxPerMinute;
sizePx = (size - 2) * pxPerMinute;
}
else // 2 or smaller
{
posPx = pos * pxPerMinute;
sizePx = size * pxPerMinute;
}
// end-caps
posPx -= endCapPx;
sizePx += 2*endCapPx;
}
else // size is 60 or greater
{
size = 60;
sizePx = Constants.BASE_2D_RESOLUTION;
}
return (posPx, sizePx);
}
public static float ScreenPixelToRad(Vector2 pos)
{
var resolution = DisplayServer.WindowGetSize();