void ofxImgButton::setup(string imageName, float width, float height) { buttonImg.load(imageName); button.x = 0; button.y = 0; button.width = (width > 0) ? width : buttonImg.getWidth(); button.height = (height > 0) ? height : buttonImg.getHeight(); togglable = false; toggle = false; #if defined (TARGET_OSX) || (TARGET_WIN32) ofRegisterMouseEvents(this, OF_EVENT_ORDER_BEFORE_APP); #endif #if defined (TARGET_OF_IOS) ofRegisterTouchEvents(this,OF_EVENT_ORDER_BEFORE_APP); #endif }
//-------------------------------------------------------------- void testApp::setup(){ // register touch events ofRegisterTouchEvents(this); // initialize the accelerometer ofxAccelerometer.setup(); //iPhoneAlerts will be sent to this. ofxiPhoneAlerts.addListener(this); ofBackground(50,50,50); enabled=false; // add the newFloat method to listen for eventsAddon newFloatEvent ofAddListener(evObject.newFloatEvent,this,&testApp::newFloat); // add the newFloat method to listen for eventsAddon newFloatEvent ofAddListener(evObject.newIntEvent,this,&testApp::newInt); }
//-------------------------------------------------------------- void testApp::setup(){ // register touch events ofRegisterTouchEvents(this); //ofSetOrientation(OF_ORIENTATION_90_RIGHT); //this is to scale down the example for the iphone screen appIphoneScale = 0.5; ofBackground(255,255,255); ofSetFrameRate(60); nCurveVertices = 7; curveVertices[0].x = 326; curveVertices[0].y = 209; curveVertices[1].x = 306; curveVertices[1].y = 279; curveVertices[2].x = 265; curveVertices[2].y = 331; curveVertices[3].x = 304; curveVertices[3].y = 383; curveVertices[4].x = 374; curveVertices[4].y = 383; curveVertices[5].x = 418; curveVertices[5].y = 309; curveVertices[6].x = 345; curveVertices[6].y = 279; for (int i = 0; i < nCurveVertices; i++){ curveVertices[i].bOver = false; curveVertices[i].bBeingDragged = false; curveVertices[i].radius = 4; } }
void ofxRegisterMultitouch(ofxAndroidApp * app){ ofRegisterTouchEvents(app); }
void ofAppAndroidWindow::runAppViaInfiniteLoop(ofBaseApp * appPtr){ androidApp = dynamic_cast<ofxAndroidApp*>( appPtr ); if(androidApp){ ofRegisterTouchEvents(androidApp); } }
void ofApp::setup() { ofSetLogLevel(OF_LOG_NOTICE); ofLogNotice() << "setup()"; if (ofApp::isSemibreve()) ofLogNotice() << "Going to run Semibreve version"; if (ofApp::isOsx()) ofLogNotice() << "OSX detected"; if (ofApp::isIos()) ofLogNotice() << "iOS detected"; if (ofApp::isAndroid()) ofLogNotice() << "Android detected"; if (ofApp::isPhone()) ofLogNotice() << "Phone detected"; if (ofApp::isTablet()) ofLogNotice() << "Tablet detected"; // if (ofApp::isIphone()) ofLogNotice() << "iPhone detected"; // if (ofApp::isIpad()) ofLogNotice() << "iPad detected"; // if (ofApp::isAndroidPhone()) ofLogNotice() << "Android phone detected"; // if (ofApp::isAndroidTablet()) ofLogNotice() << "Android tablet detected"; #if defined TARGET_OSX ofLogNotice() << "Running OSX version"; ofSetDataPathRoot("../Resources/data/"); #endif #if defined TARGET_SEMIBREVE ofLogNotice() << "Running SEMIBREVE version"; oscReceiver.setup(RECEIVE_PORT); oscSender.setup(HOST, SEND_PORT); #endif #if defined TARGET_OF_IOS if (ofApp::isTablet()) { ofSetOrientation(OF_ORIENTATION_90_LEFT); swiper.setup(); ofAddListener(swiper.swipeRecognized, this, &ofApp::onSwipe); swiping = false; } else { swiper.setup(); ofAddListener(swiper.swipeRecognized, this, &ofApp::onSwipe); swiping = false; } #endif #ifndef TARGET_OSX if (isAndroid() || isIos()) { ofxAccelerometer.setup(); accelCount = 0; crop = 0; } #endif if (!ofApp::isIos()) { ofLogNotice() << "Registering for touch events if not ios"; ofRegisterTouchEvents(this); } ofSetFrameRate(FRAME_RATE); ofSetCircleResolution(CIRCLE_RESOLUTION); if (multitouch) ofHideCursor(); ofApp::language = ofApp::getSystemLanguage(); ofLogNotice() << "Language is " << ofApp::language; initTranslations(); initModules(); setupModules(); loadModuleSounds(); initImages(); appState = ABOUT; inactivityState = ACTIVE; // init global vars aboutY = 0; splashAlpha = 255; arrowDownY = ofGetHeight()/3*2; arrowDownYBase = arrowDownY; arrowDownDir = 1; showSwipeInfo = true; ofApp::maxParticleY = round(ofGetHeight() * (1-LIMIT_PARTICLE)); uint swipeFontSize; if (isTablet()) swipeFontSize = 26; else swipeFontSize = 20; swipeFont.load(UI_FONT_FACE, swipeFontSize); }