MCPcopy Create free account
hub / github.com/cinder/Cinder / setup

Method setup

test/iosAppTest/src/iosAppTestApp.cpp:159–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157}
158
159void 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

Callers

nothing calls this directly

Calls 15

getWindowCenterFunction · 0.85
getWindowHeightFunction · 0.85
getWindowContentScaleFunction · 0.85
getNumWindowsFunction · 0.85
getWindowIndexFunction · 0.85
getWindowFunction · 0.50
bindFunction · 0.50
createFunction · 0.50
FontFunction · 0.50
getWindowSizeFunction · 0.50
FormatClass · 0.50
getNativeMethod · 0.45

Tested by

no test coverage detected