//Standard lib //Third party #include "raylib.h" //Our own files #include "constants.h" #include "programstate.h" #include "drawhelper.h" #include "draw_xports_ypitches.h" /* Each port is a column, ordered from left to right * Each pitch is a rectangle in that column. midi note 0 on the bottom to 127 on top * The screen does not move or scroll. Notes fade out and make room for the next note-on. */ extern ProgramState programState; static Rectangle backgroundRects[VIS_PORTS]; // 4 floats: x, y, w, h static void reposition(Note *allGUINotes) { //This is both init and update. We only call it internally, the name of the function doesn't matter. //Once guaranteed called on program start and then each window resize int screenWidth = GetScreenWidth(); int screenHeight = GetScreenHeight(); int xOffset = (int)(screenWidth/2) - (int)((VIS_PORTS*NOTE_LONG_SIDE)/2); //int yOffset = -1 * ((int)(screenWidth/2) - ((programState.pitchMax - programState.pitchMin +1 ) * NOTE_SMALL_SIDE))/2; int yOffset = -1 * ((int)(screenHeight/2) - (60 * NOTE_SMALL_SIDE)/2); //we want all tracks around the center. programState.modeDescription = "Each port is a vertical column.\n\ Each pitch is one square, going from top highest\nto bottomw lowest.\n\ \n\ The higher the velocity of a note the more\nvibrant its color.\n\ \n\ Notes are only lit up when they are played.\n\ There is no time-dimension."; for (int port=0; portx, nt->y+20, 18, RAYWHITE, true); //text, x, y, int fontsize, color, vertical } } if (programState.showPitchMarker) { for (int port=0; portx, nt->y, NOTE_LONG_SIDE-NOTE_BORDER, NOTE_SMALL_SIDE-NOTE_BORDER}; DrawRectangleRounded(rec, 0.5, 8, programState.colors[backgroundLighter]); } } } for (int port=0; portactive) { reduceCountdown(nt, ft); //handles 0.0 and 1.0 as special cases drawNoteRect(nt, 1, 0); //note, rotated, square. Will not draw if countdown == 0 } } } }