class Input { int objectSelectedLeft; //possible selected objects //-1 = NONE //1 = HAND float dragOffsetX; float dragOffsetY; void Initialize() { dragOffsetX = 0.0; dragOffsetY = 0.0; objectSelectedLeft = -1; } } void mousePressed() { if( mouseButton == LEFT ) { if( MENUS.m_MenuIndex == 0 ) { //was the mouse was clicked on the player's hand? if( mouseX > PLAYER.m_Hand.m_X && mouseX < (PLAYER.m_Hand.m_X + PLAYER.m_Hand.m_HandWidth) && mouseY > PLAYER.m_Hand.m_Y && mouseY < (PLAYER.m_Hand.m_Y + PLAYER.m_Hand.m_HandHeight) && PLAYER.m_Hand.m_HandState == 0 ) { INPUT.dragOffsetX = mouseX - PLAYER.m_Hand.m_X; INPUT.dragOffsetY = mouseY - PLAYER.m_Hand.m_Y; INPUT.objectSelectedLeft = 1; } } else { MENUS.HandleInput(); } } if( mouseButton == RIGHT ) { /* if( BALL.m_BallState == 2 ) { if( BALL.m_CupIndex != -1 ) { GAME_TABLE.m_Cups[BALL.m_CupIndex].m_Eliminated = true; PLAYER.IncreaseDrunkLevel(); } BALL.m_BallState = 0; } else { BALL.ReleaseBall( 1.0 ); } BALL.Reset(); BALL.SetBall(); */ } } void mouseReleased() { if( INPUT.objectSelectedLeft == 1 ) { PLAYER.m_Hand.ThrowBall(); } INPUT.objectSelectedLeft = -1; } void mouseDragged() { switch( INPUT.objectSelectedLeft ) { case -1: break; case 1: PLAYER.m_Hand.UpdatePositionWithMouse(); break; } } void keyReleased() { /* if( key == 'i' ) { PLAYER.IncreaseDrunkLevel( 0.1 ); } if( key == 'd' ) { PLAYER.DecreaseDrunkLevel( 0.1 ); } */ if( key == 'r' ) { GAME_TABLE.Reset(); PLAYER.Reset(); MENUS.Reset(); } }