- status: open --> closed
- assigned_to: Oliver Gantert
- Group: -->
Here are some changes so that the menu control works with the mouse (not perfect yet)
File : inphdl.c
(compiler VC++)
void inpGetMouseXY(struct RastPort p_RP, uword p_X, uword p_Y)
{
if (bScale2x)
{
p_X = (IHandler.us_MouseX / 2) - p_RP->us_LeftEdge;
p_Y = (IHandler.us_MouseY / 2) - p_RP->us_TopEdge;
}
else
{
p_X = IHandler.us_MouseX - p_RP->us_LeftEdge;;
*p_Y = IHandler.us_MouseY - p_RP->us_TopEdge;;
}
}
uword inpGetMouseY(struct RastPort *p_RP)
{
if (bScale2x)
{
return(IHandler.us_MouseY / 2) - p_RP->us_TopEdge;;
}
else
{
return(IHandler.us_MouseY) - p_RP->us_TopEdge;;
}
}
long inpWaitFor(long l_Mask)
{
...
...
...
/ mouse input handling /
case SDL_MOUSEMOTION:
if ((l_Mask & INP_LEFT) && (event.motion.x < IHandler.us_MouseX)) action |= INP_MOUSE|INP_LEFT;
else if ((l_Mask & INP_RIGHT) && (event.motion.x > IHandler.us_MouseX)) action |= INP_MOUSE|INP_RIGHT;
if ((l_Mask & INP_UP) && (event.motion.y < IHandler.us_MouseY)) action |= INP_MOUSE|INP_UP;
else if ((l_Mask & INP_DOWN) && (event.motion.y > IHandler.us_MouseY)) action |= INP_MOUSE|INP_DOWN;
IHandler.us_MouseX = event.motion.x;
IHandler.us_MouseY = event.motion.y;
break;
case SDL_MOUSEBUTTONDOWN:
if ((l_Mask & INP_LBUTTONP) && (event.button.button == SDL_BUTTON_LEFT)) action |= INP_MOUSE|INP_LBUTTONP;
if ((l_Mask & INP_RBUTTONP) && (event.button.button == SDL_BUTTON_RIGHT)) action |= INP_MOUSE|INP_RBUTTONP;
IHandler.us_MouseX = event.button.x;
IHandler.us_MouseY = event.button.y;
break;
case SDL_MOUSEBUTTONUP:
if ((l_Mask & INP_LBUTTONR) && (event.button.button == SDL_BUTTON_LEFT)) action |= INP_MOUSE|INP_LBUTTONR;
if ((l_Mask & INP_RBUTTONR) && (event.button.button == SDL_BUTTON_RIGHT)) action |= INP_MOUSE|INP_RBUTTONR;
IHandler.us_MouseX = event.button.x;
IHandler.us_MouseY = event.button.y;
break;
...
...
...
return(action);
}