From b898de53113f6906a32730f30f0ede76aba97de7 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sat, 25 Apr 2020 14:05:27 +0100 Subject: [PATCH] VRadioRec CWFs --- vradiorec.cc | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/vradiorec.cc b/vradiorec.cc index 673ea77..df787f4 100644 --- a/vradiorec.cc +++ b/vradiorec.cc @@ -274,24 +274,26 @@ void VRadioRec::processMessage(Message* m) { if (m->message == Message::MOUSE_LBDOWN) { - int x = m->parameter - getScreenX(); - int y = m->tag - getScreenY(); + UINT x = m->parameter - getScreenX(); + UINT y = m->tag - getScreenY(); if (!barShowing) { boxstack->handleCommand(Input::OK); //simulate rok press } - else if ((int)barRegion.x<=x && (int)barRegion.y<=y && ((int)barRegion.x+(int)barRegion.w)>=x - && ((int)barRegion.y+(int)barRegion.h)>=y) + else if ( (barRegion.x <= x) // If the click happened within the bar region... + && (barRegion.y <= y) + && ((barRegion.x + barRegion.w) >= x) + && ((barRegion.y + barRegion.h) >= y)) { - int progBarXbase = barRegion.x + 300; - if (x>=(int)barRegion.x + progBarXbase + 24 - && x<=(int)barRegion.x + progBarXbase + 4 + 302 - && y>=(int)barRegion.y + 12 - 2 - && y<=(int)barRegion.y + 12 - 2+28) + UINT progBarXbase = barRegion.x + 300; + if ( x >= barRegion.x + progBarXbase + 24 + && x <= barRegion.x + progBarXbase + 4 + 302 + && y >= barRegion.y + 12 - 2 + && y <= barRegion.y + 12 - 2+28) { - int cx=x-(barRegion.x + progBarXbase + 4); - double percent=((double)cx)/302.*100.; - player->jumpToPercent(percent); + int cx = x - (barRegion.x + progBarXbase + 4); + double percent = 100 * cx / 302.; + player->jumpToPercent(percent); // FIXME check this still works doBar(3); return; // int progressWidth = 302 * currentFrameNum / lengthFrames; -- 2.39.2