void EngineStage::activateReleased(float x, float y, float dx, float dy) { if (stageState == STAGE_STATE_PAUSE && !player->hasTriggeredStartup()) { HudSlider* speedSlider = NULL; if (hud) speedSlider = hud->getSpeedSlider(); if (speedSlider && speedSlider->selected) { speedSlider->selected = false; Vector2 np; #if !defined(OGRE_IS_IOS) if (speedSlider->orientation) np = speedSlider->p2 + globals.convertToPercentScreen(Vector2(0.0, dy)); else np = speedSlider->p2 + globals.convertToPercentScreen(Vector2(dx, 0.0)); #else if (speedSlider->orientation) np = speedSlider->p2cache + globals.convertToPercentScreen(Vector2(0.0, dy)); else np = speedSlider->p2cache + globals.convertToPercentScreen(Vector2(dx, 0.0)); #endif speedSlider->setBallPosition(np); //std::cout << "release\n"; } } }
std::string TutorialManager::queryButtons(Vector2 target) const { Vector2 comp = globals.convertToPercentScreen(target); for (int i = 0; i < buttons.size(); ++i) { if ((buttons[i].overlay && buttons[i].overlay->isVisible()) && buttons[i].isInside(comp) && buttons[i].active) { return buttons[i].name; } } return ""; }
void EngineStage::activatePressed(float x, float y) { if (stageState == STAGE_STATE_PAUSE && !player->hasTriggeredStartup()) { HudSlider* speedSlider = NULL; if (hud) speedSlider = hud->getSpeedSlider(); if (speedSlider) { Vector2 pos = globals.convertToPercentScreen(Vector2(x, y)); // Case for tapping into the slider which makes ball jump to position if (speedSlider->isInsideRange(pos)) { // Project position to range if (speedSlider->orientation) { float ny = pos.y - speedSlider->p1.y - speedSlider->dim2.y / 2; speedSlider->setBallPosition(Vector2(speedSlider->p2.x, ny)); } else { float nx = pos.x - speedSlider->p1.x - speedSlider->dim2.x / 2; speedSlider->setBallPosition(Vector2(nx, speedSlider->p2.y)); } } // Initialize p2cache first time we touch ball // p2cache is better since iOS tracking uses total dx which is more accurate // then passing in a dx everytime if (speedSlider->isInsideBall(pos)) { speedSlider->selected = true; speedSlider->p2cache = speedSlider->p2; } //std::cout << "press\n"; } } }
// The following deal with injecting coordinates to simulate a slider // void EngineTabSettings::activateMoved(float x, float y, float dx, float dy) { Ogre::Vector2 temp = globals.convertToPercentScreen(Vector2(0.0,dy)); std::cout << "Temp: "<<"(" << temp.x <<", " << temp.y << ")" << std::endl; //Testing Dragging! /* if(touchedBox) { Ogre::Vector2 temp2 = globals.convertToPercentScreen(Vector2(x,y)); //Move everything depending on the dy! Ogre::Vector2 temp = globals.convertToPercentScreen(Vector2(0.0,dy)); //float newy = initTextPosition float constant = 1; temp.y /= constant; hud->enableUnlimitedFuelBackground->setPosition(.32, hud->initTextPosition.y+temp.y); } */ }