| 157 | } |
| 158 | |
| 159 | void iosAppTestApp::setup() |
| 160 | { |
| 161 | UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect]; |
| 162 | btn.bounds = CGRectMake(0, 100, 200, 26); |
| 163 | btn.center = CGPointMake( getWindowCenter().x, getWindowHeight() - 50 ); |
| 164 | btn.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; |
| 165 | btn.backgroundColor = [UIColor clearColor]; |
| 166 | [btn setTitle:@"An Exciting New Button" forState:UIControlStateNormal]; |
| 167 | [btn sizeToFit]; |
| 168 | CinderViewCocoaTouch *cinderView = reinterpret_cast<CinderViewCocoaTouch *>( getWindow()->getNative() ) ; |
| 169 | [cinderView addSubview:btn]; |
| 170 | |
| 171 | mMouseTouchId = 0; |
| 172 | sOrderTester.setState( TestCallbackOrder::SETUP ); |
| 173 | |
| 174 | getSignalProximitySensor().connect( std::bind( &iosAppTestApp::proximitySensor, this, std::placeholders::_1 ) ); |
| 175 | enableProximitySensor(); |
| 176 | |
| 177 | getSignalBatteryState().connect( std::bind( &iosAppTestApp::batteryStateChange, this, std::placeholders::_1 ) ); |
| 178 | enableBatteryMonitoring(); |
| 179 | |
| 180 | mFont = gl::TextureFont::create( Font( "Helvetica", 16 ) ); |
| 181 | |
| 182 | // Create a blue-green gradient as an OpenGL texture |
| 183 | Surface8u surface( 256, 256, false ); |
| 184 | Surface8u::Iter iter = surface.getIter(); |
| 185 | while( iter.line() ) { |
| 186 | while( iter.pixel() ) { |
| 187 | iter.r() = 0; |
| 188 | iter.g() = iter.x(); |
| 189 | iter.b() = iter.y(); |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | mTex = gl::Texture::create( surface ); |
| 194 | |
| 195 | CI_LOG_V( "window size: " << getWindowSize() << ", window content scale: " << getWindowContentScale() ); |
| 196 | |
| 197 | getWindow()->getSignalDraw().connect( std::bind( &iosAppTestApp::draw, this ) ); |
| 198 | |
| 199 | auto displays = Display::getDisplays(); |
| 200 | if( displays.size() > 1 ) |
| 201 | createWindow( Window::Format().display( displays[1] ) ); |
| 202 | |
| 203 | if( getNumWindows() > 1 ) { |
| 204 | mSecondWindow = getWindowIndex( 1 ); |
| 205 | mSecondWindow->getSignalDraw().connect( std::bind( &iosAppTestApp::draw, this ) ); |
| 206 | } |
| 207 | |
| 208 | getSignalDidEnterBackground().connect( bind( &iosAppTestApp::didEnterBackground, this ) ); |
| 209 | getSignalWillEnterForeground().connect( bind( &iosAppTestApp::willEnterForeground, this ) ); |
| 210 | getSignalWillResignActive().connect( bind( &iosAppTestApp::willResignActive, this ) ); |
| 211 | getSignalDidBecomeActive().connect( bind( &iosAppTestApp::didBecomeActive, this ) ); |
| 212 | getSignalCleanup().connect( bind( &iosAppTestApp::shuttingDown, this ) ); |
| 213 | getSignalMemoryWarning().connect( bind( &iosAppTestApp::memoryWarning, this ) ); |
| 214 | |
| 215 | getSignalSupportedOrientations().connect( std::bind( &iosAppTestApp::supportAllOrientations, this ) ); |
| 216 | // getSignalSupportedOrientations().connect( std::bind( &iosAppTestApp::supportPortraitOrientations, this ) ); // this one limits to only portrait, even though slot above says all |
nothing calls this directly
no test coverage detected