@@ -55,7 +55,8 @@ public class DropRenderer {
55
55
private static final float BLACK_KEY_HEIGHT_RATIO = 0.6F ;
56
56
private static final float PIANO_HEIGHT_DIVIDER = 7F ;
57
57
private static final int KEY_LINE_HEIGHT = 2 ;
58
- private static final float KEY_LINE_OFFSET_RATIO = 11.6F ;
58
+ private static final float WHITE_KEY_LINE_OFFSET_RATIO = 18F ;
59
+ private static final float BLACK_KEY_LINE_OFFSET_RATIO = 12F ;
59
60
private static final float KEY_PRESS_DEPTH_RATIO = 14.5F ;
60
61
private static final int PRESSED_KEY_COLOR_ALPHA = 175 ;
61
62
private static final long KEY_ANIMATION_DURATION = 250_000_000L ;
@@ -232,7 +233,8 @@ private void drawPiano(final Matrix4fStack positionMatrix) {
232
233
233
234
Renderer2D .INSTANCE .beginGlobalBuffering ();
234
235
235
- final float keyLineOffset = height / KEY_LINE_OFFSET_RATIO ;
236
+ final float whiteKeyLineOffset = height / WHITE_KEY_LINE_OFFSET_RATIO ;
237
+ final float blackKeyLineOffset = height / BLACK_KEY_LINE_OFFSET_RATIO ;
236
238
for (int nbsKey = 0 ; nbsKey < this .pianoKeyPositions .length ; nbsKey ++) {
237
239
final float x = this .pianoKeyPositions [nbsKey ];
238
240
final float progress = this .pianoKeyLastColors [nbsKey ] != null ? MathUtils .clamp ((System .nanoTime () - this .pianoKeyLastPlayed [nbsKey ]) / (float ) KEY_ANIMATION_DURATION , 0F , 1F ) : 1F ;
@@ -246,11 +248,11 @@ private void drawPiano(final Matrix4fStack positionMatrix) {
246
248
if (this .pianoKeyLastColors [nbsKey ] != null ) {
247
249
Renderer2D .INSTANCE .filledRect (positionMatrix , x + 1 , pressOffset , x + whiteKeyWidth - 1 , height , this .pianoKeyLastColors [nbsKey ].withAlpha (Math .round (PRESSED_KEY_COLOR_ALPHA * (1 - colorProgress ))));
248
250
}
249
- Renderer2D .INSTANCE .filledRect (positionMatrix , x , height - keyLineOffset + pressOffset , x + whiteKeyWidth , height - keyLineOffset - KEY_LINE_HEIGHT + pressOffset , Color .GRAY );
251
+ Renderer2D .INSTANCE .filledRect (positionMatrix , x , height - whiteKeyLineOffset + pressOffset , x + whiteKeyWidth , height - whiteKeyLineOffset - KEY_LINE_HEIGHT + pressOffset , Color .GRAY );
250
252
251
253
this .textRenderer .setGlobalScale (ThinGL .getWindowFramebufferWidth () / 2745F ); // 0,7
252
254
final float nameWidth = this .textRenderer .calculateWidth (noteName );
253
- this .textRenderer .renderString (positionMatrix , GlobalObjects .GLOBAL_BATCH , this .getNoteName (nbsKey ), x + whiteKeyWidth / 2 - nameWidth / 2 , height - keyLineOffset - KEY_LINE_HEIGHT + pressOffset - this .textRenderer .getPaddedHeight (), 0 , Color .BLACK );
255
+ this .textRenderer .renderString (positionMatrix , GlobalObjects .GLOBAL_BATCH , this .getNoteName (nbsKey ), x + whiteKeyWidth / 2 - nameWidth / 2 , height - whiteKeyLineOffset - KEY_LINE_HEIGHT + pressOffset - this .textRenderer .getPaddedHeight (), 0 , Color .BLACK );
254
256
this .textRenderer .setGlobalScale (1F );
255
257
} else {
256
258
positionMatrix .pushMatrix ();
@@ -260,11 +262,11 @@ private void drawPiano(final Matrix4fStack positionMatrix) {
260
262
if (this .pianoKeyLastColors [nbsKey ] != null ) {
261
263
Renderer2D .INSTANCE .filledRect (positionMatrix , x , pressOffset - height / KEY_PRESS_DEPTH_RATIO / 2 , x + blackKeyWidth , height * BLACK_KEY_HEIGHT_RATIO , this .pianoKeyLastColors [nbsKey ].withAlpha (Math .round (PRESSED_KEY_COLOR_ALPHA * (1 - colorProgress ))));
262
264
}
263
- Renderer2D .INSTANCE .filledRect (positionMatrix , x , height * BLACK_KEY_HEIGHT_RATIO - keyLineOffset + pressOffset , x + blackKeyWidth , height * BLACK_KEY_HEIGHT_RATIO - keyLineOffset - KEY_LINE_HEIGHT + pressOffset , Color .GRAY );
265
+ Renderer2D .INSTANCE .filledRect (positionMatrix , x , height * BLACK_KEY_HEIGHT_RATIO - blackKeyLineOffset + pressOffset , x + blackKeyWidth , height * BLACK_KEY_HEIGHT_RATIO - blackKeyLineOffset - KEY_LINE_HEIGHT + pressOffset , Color .GRAY );
264
266
265
267
this .textRenderer .setGlobalScale (ThinGL .getWindowFramebufferWidth () / 4000F ); // 0,48
266
268
final float nameWidth = this .textRenderer .calculateWidth (noteName );
267
- this .textRenderer .renderString (positionMatrix , GlobalObjects .GLOBAL_BATCH , this .getNoteName (nbsKey ), x + blackKeyWidth / 2 - nameWidth / 2 , height * BLACK_KEY_HEIGHT_RATIO - keyLineOffset - KEY_LINE_HEIGHT + pressOffset - this .textRenderer .getPaddedHeight (), 0 , Color .WHITE );
269
+ this .textRenderer .renderString (positionMatrix , GlobalObjects .GLOBAL_BATCH , this .getNoteName (nbsKey ), x + blackKeyWidth / 2 - nameWidth / 2 , height * BLACK_KEY_HEIGHT_RATIO - blackKeyLineOffset - KEY_LINE_HEIGHT + pressOffset - this .textRenderer .getPaddedHeight (), 0 , Color .WHITE );
268
270
this .textRenderer .setGlobalScale (1F );
269
271
270
272
positionMatrix .popMatrix ();
0 commit comments