Hello Dudes,
Been trying to fix this issue the last few days, been looking on the internet for code examples. Changed the code a heap of times, even posted here.
This is my new code everything with in the proper events it’s all working fine except one problem.
Touch2 Can’t seem the register the 1 / 3 of left hand side of screen.
Touch1 does the entire screen fine. Touch 1 and Touch 2 work fine as long as Touch2 is using 2 / 3 of screen on right side.
Code:
void Input::Core( bool &bGameRunning, int &iCurrentPlayer)
{
while ( SDL_PollEvent(&event) )
{
if (event.type == SDL_QUIT)
{
}
if (event.type == SDL_KEYDOWN)
{
if (event.key.keysym.sym == SDLK_AC_BACK )
{
bGameRunning = false;
}
}
if (event.type == SDL_FINGERDOWN)
{
bFingerDown = true;
device = SDL_GetTouchDevice(0);
for (int i = 0; i < SDL_GetNumTouchFingers(device); i++)
{
//SDL *FINGER
arnold[i] = SDL_GetTouchFinger(device, i);
if (arnold[i] != NULL)
{
if (i == 0)
{
bf1 = true;
iMouseX = Display0->GetScreenWidth() * arnold[i]->x;
iMouseY = Display0->GetScreenHeight() * arnold[i]->y;
}
if (i == 1)
{
bf2 = true;
iMouseX2 = Display0->GetScreenWidth() * arnold[i]->x;
iMouseY2 = Display0->GetScreenHeight() * arnold[i]->y;
}
}
}
}
if (event.type == SDL_FINGERMOTION)
{
device = SDL_GetTouchDevice(0);
for (int i = 0; i < SDL_GetNumTouchFingers(device); i++)
{
//SDL *FINGER
arnold[i] = SDL_GetTouchFinger(device, i);
if (arnold[i] != NULL)
{
if (i == 0)
{
bf1 = true;
iMouseX = Display0->GetScreenWidth() * arnold[i]->x;
iMouseY = Display0->GetScreenHeight() * arnold[i]->y;
}
if (i == 1)
{
bf2 = true;
iMouseX2 = Display0->GetScreenWidth() * arnold[i]->x;
iMouseY2 = Display0->GetScreenHeight() * arnold[i]->y;
}
}
}
}
if (event.type == SDL_FINGERUP)
{
if (event.tfinger.fingerId == -1 )
{
bf1 = false;
bf2 = false;
break;
}
if (event.tfinger.fingerId == 0 )
{
bf1 = false; // ture
//iMouseX = -1;
//iMouseY = -1;
bFingerDown = false;
}
if (event.tfinger.fingerId == 1)
{
//bf1 = true;
bf2 = false; // false
//iMouseX2 = -1;
//iMouseY2 = -1;
}
//RESET MOUSEOLDS
iMouseXold = -1;
iMouseYold = -1;
}
}
}