signed window coordinates for cocoa

This commit is contained in:
Jack Andersen 2015-12-03 16:26:10 -10:00
parent 36c05662b8
commit 32d4797ac6
1 changed files with 24 additions and 24 deletions

View File

@ -461,9 +461,9 @@ static inline boo::EMouseButton getButton(NSEvent* event)
NSRect frame = [parentView frame]; NSRect frame = [parentView frame];
boo::SWindowCoord coord = boo::SWindowCoord coord =
{ {
{(unsigned)(liw.x * pixelFactor), (unsigned)(liw.y * pixelFactor)}, {int(liw.x * pixelFactor), int(liw.y * pixelFactor)},
{(unsigned)liw.x, (unsigned)liw.y}, {int(liw.x), int(liw.y)},
{(float)(liw.x / frame.size.width), (float)(liw.y / frame.size.height)} {float(liw.x / frame.size.width), float(liw.y / frame.size.height)}
}; };
booContext->m_callback->mouseDown(coord, boo::EMouseButton::Primary, booContext->m_callback->mouseDown(coord, boo::EMouseButton::Primary,
getMod([theEvent modifierFlags])); getMod([theEvent modifierFlags]));
@ -478,9 +478,9 @@ static inline boo::EMouseButton getButton(NSEvent* event)
NSRect frame = [parentView frame]; NSRect frame = [parentView frame];
boo::SWindowCoord coord = boo::SWindowCoord coord =
{ {
{(unsigned)(liw.x * pixelFactor), (unsigned)(liw.y * pixelFactor)}, {int(liw.x * pixelFactor), int(liw.y * pixelFactor)},
{(unsigned)liw.x, (unsigned)liw.y}, {int(liw.x), int(liw.y)},
{(float)(liw.x / frame.size.width), (float)(liw.y / frame.size.height)} {float(liw.x / frame.size.width), float(liw.y / frame.size.height)}
}; };
booContext->m_callback->mouseUp(coord, boo::EMouseButton::Primary, booContext->m_callback->mouseUp(coord, boo::EMouseButton::Primary,
getMod([theEvent modifierFlags])); getMod([theEvent modifierFlags]));
@ -495,9 +495,9 @@ static inline boo::EMouseButton getButton(NSEvent* event)
NSRect frame = [parentView frame]; NSRect frame = [parentView frame];
boo::SWindowCoord coord = boo::SWindowCoord coord =
{ {
{(unsigned)(liw.x * pixelFactor), (unsigned)(liw.y * pixelFactor)}, {int(liw.x * pixelFactor), int(liw.y * pixelFactor)},
{(unsigned)liw.x, (unsigned)liw.y}, {int(liw.x), int(liw.y)},
{(float)(liw.x / frame.size.width), (float)(liw.y / frame.size.height)} {float(liw.x / frame.size.width), float(liw.y / frame.size.height)}
}; };
booContext->m_callback->mouseDown(coord, boo::EMouseButton::Secondary, booContext->m_callback->mouseDown(coord, boo::EMouseButton::Secondary,
getMod([theEvent modifierFlags])); getMod([theEvent modifierFlags]));
@ -512,9 +512,9 @@ static inline boo::EMouseButton getButton(NSEvent* event)
NSRect frame = [parentView frame]; NSRect frame = [parentView frame];
boo::SWindowCoord coord = boo::SWindowCoord coord =
{ {
{(unsigned)(liw.x * pixelFactor), (unsigned)(liw.y * pixelFactor)}, {int(liw.x * pixelFactor), int(liw.y * pixelFactor)},
{(unsigned)liw.x, (unsigned)liw.y}, {int(liw.x), int(liw.y)},
{(float)(liw.x / frame.size.width), (float)(liw.y / frame.size.height)} {float(liw.x / frame.size.width), float(liw.y / frame.size.height)}
}; };
booContext->m_callback->mouseUp(coord, boo::EMouseButton::Secondary, booContext->m_callback->mouseUp(coord, boo::EMouseButton::Secondary,
getMod([theEvent modifierFlags])); getMod([theEvent modifierFlags]));
@ -532,9 +532,9 @@ static inline boo::EMouseButton getButton(NSEvent* event)
NSRect frame = [parentView frame]; NSRect frame = [parentView frame];
boo::SWindowCoord coord = boo::SWindowCoord coord =
{ {
{(unsigned)(liw.x * pixelFactor), (unsigned)(liw.y * pixelFactor)}, {int(liw.x * pixelFactor), int(liw.y * pixelFactor)},
{(unsigned)liw.x, (unsigned)liw.y}, {int(liw.x), int(liw.y)},
{(float)(liw.x / frame.size.width), (float)(liw.y / frame.size.height)} {float(liw.x / frame.size.width), float(liw.y / frame.size.height)}
}; };
booContext->m_callback->mouseDown(coord, button, getMod([theEvent modifierFlags])); booContext->m_callback->mouseDown(coord, button, getMod([theEvent modifierFlags]));
} }
@ -551,9 +551,9 @@ static inline boo::EMouseButton getButton(NSEvent* event)
NSRect frame = [parentView frame]; NSRect frame = [parentView frame];
boo::SWindowCoord coord = boo::SWindowCoord coord =
{ {
{(unsigned)(liw.x * pixelFactor), (unsigned)(liw.y * pixelFactor)}, {int(liw.x * pixelFactor), int(liw.y * pixelFactor)},
{(unsigned)liw.x, (unsigned)liw.y}, {int(liw.x), int(liw.y)},
{(float)(liw.x / frame.size.width), (float)(liw.y / frame.size.height)} {float(liw.x / frame.size.width), float(liw.y / frame.size.height)}
}; };
booContext->m_callback->mouseUp(coord, button, getMod([theEvent modifierFlags])); booContext->m_callback->mouseUp(coord, button, getMod([theEvent modifierFlags]));
} }
@ -569,9 +569,9 @@ static inline boo::EMouseButton getButton(NSEvent* event)
NSRect frame = [parentView frame]; NSRect frame = [parentView frame];
boo::SWindowCoord coord = boo::SWindowCoord coord =
{ {
{(unsigned)(liw.x * pixelFactor), (unsigned)(liw.y * pixelFactor)}, {int(liw.x * pixelFactor), int(liw.y * pixelFactor)},
{(unsigned)liw.x, (unsigned)liw.y}, {int(liw.x), int(liw.y)},
{(float)(liw.x / frame.size.width), (float)(liw.y / frame.size.height)} {float(liw.x / frame.size.width), float(liw.y / frame.size.height)}
}; };
booContext->m_callback->mouseMove(coord); booContext->m_callback->mouseMove(coord);
} }
@ -601,9 +601,9 @@ static inline boo::EMouseButton getButton(NSEvent* event)
NSRect frame = [parentView frame]; NSRect frame = [parentView frame];
boo::SWindowCoord coord = boo::SWindowCoord coord =
{ {
{(unsigned)(liw.x * pixelFactor), (unsigned)(liw.y * pixelFactor)}, {int(liw.x * pixelFactor), int(liw.y * pixelFactor)},
{(unsigned)liw.x, (unsigned)liw.y}, {int(liw.x), int(liw.y)},
{(float)(liw.x / frame.size.width), (float)(liw.y / frame.size.height)} {float(liw.x / frame.size.width), float(liw.y / frame.size.height)}
}; };
boo::SScrollDelta scroll = boo::SScrollDelta scroll =
{ {