ft2-clone

Fasttracker 2 clone
Log | Files | Refs | README | LICENSE

commit 84e02b8c87fcbf93e0404a691365d567c1e7808c
parent e021404c8ff51fc3d2b455b1983f2a06d0214bf1
Author: Olav Sørensen <olav.sorensen@live.no>
Date:   Mon, 13 Dec 2021 15:06:55 +0100

Kludge for marking last sample point in fullscreen mode

Diffstat:
Msrc/ft2_sample_ed.c | 17++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/ft2_sample_ed.c b/src/ft2_sample_ed.c @@ -3321,8 +3321,8 @@ void handleSampleDataMouseDown(bool mouseButtonHeld) if (editor.curInstr == 0) return; - const int32_t mx = CLAMP(mouse.x, 0, SCREEN_W+8); // allow some pixels outside of the screen - const int32_t my = CLAMP(mouse.y, 0, SCREEN_H-1); + int32_t mx = CLAMP(mouse.x, 0, SCREEN_W+8); // allow some pixels outside of the screen + int32_t my = CLAMP(mouse.y, 0, SCREEN_H-1); if (!mouseButtonHeld) { @@ -3411,13 +3411,20 @@ void handleSampleDataMouseDown(bool mouseButtonHeld) else if (ui.sampleDataOrLoopDrag >= 0) { // mark data + lastMouseX = mx; - if (lastMouseX > ui.sampleDataOrLoopDrag) + /* Edge-case hack for fullscreen sample marking where the width + ** of the image fills the whole screen (or close). + */ + if (video.fullscreen && video.renderW >= video.displayW-5 && mx == SCREEN_W-1) + mx = SCREEN_W; + + if (mx > ui.sampleDataOrLoopDrag) setSampleRange(ui.sampleDataOrLoopDrag, mx); - else if (lastMouseX == ui.sampleDataOrLoopDrag) + else if (mx == ui.sampleDataOrLoopDrag) setSampleRange(ui.sampleDataOrLoopDrag, ui.sampleDataOrLoopDrag); - else if (lastMouseX < ui.sampleDataOrLoopDrag) + else if (mx < ui.sampleDataOrLoopDrag) setSampleRange(mx, ui.sampleDataOrLoopDrag); } }