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

Method keyDown

test/windowTest/src/windowTestApp.cpp:155–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153}
154
155void WindowTestApp::keyDown( KeyEvent event )
156{
157 if( event.getCode() == KeyEvent::KEY_RSHIFT ) {
158 CI_LOG_V( "Right shift down" );
159 }
160 else if( event.getCode() == KeyEvent::KEY_LCTRL ) {
161 CI_LOG_V( "Left control down" );
162 }
163 if( event.getChar() == 'f' ) {
164 CI_LOG_V( "Toggling from fullscreen: " << getWindow()->isFullScreen() );
165 // This line forces fullscreen on the secondary display
166 //getWindow()->setFullScreen( ! getWindow()->isFullScreen(), FullScreenOptions().display( Display::getDisplays()[1] ) );
167 getWindow()->setFullScreen( ! getWindow()->isFullScreen() );
168 }
169 else if( event.getChar() == 'o' ) {
170 CI_LOG_V( "(kiosk) Toggling from fullscreen: " << getWindow()->isFullScreen() );
171 FullScreenOptions fullScreenOptions = FullScreenOptions().kioskMode();
172 if( event.isControlDown() )
173 fullScreenOptions.secondaryDisplayBlanking( false );
174 else
175 fullScreenOptions.secondaryDisplayBlanking( true );
176 //if( event.isControlDown() )
177 // fullScreenOptions.exclusive();
178 getWindow()->setFullScreen( ! getWindow()->isFullScreen(), fullScreenOptions );
179 }
180 else if( event.getCode() == KeyEvent::KEY_LEFT )
181 getWindow()->setPos( getWindow()->getPos().x - 1, getWindow()->getPos().y );
182 else if( event.getCode() == KeyEvent::KEY_RIGHT )
183 getWindow()->setPos( getWindow()->getPos().x + 1, getWindow()->getPos().y );
184 else if( event.getCode() == KeyEvent::KEY_UP )
185 getWindow()->setSize( getWindow()->getSize().x + 1, getWindow()->getSize().y );
186 else if( event.getCode() == KeyEvent::KEY_DOWN )
187 getWindow()->setSize( getWindow()->getSize().x + 1, getWindow()->getSize().y + 1 );
188 else if( event.getChar() == 'w' ) {
189 Window::Format format( RendererGl::create() );
190 //format.setFullScreen( true );
191 mSecondWindow = createWindow( format );
192 mSecondWindow->getSignalClose().connect( std::bind( &WindowTestApp::windowClose, this ) );
193 mSecondWindow->getSignalMouseDown().connect( std::bind( &WindowTestApp::windowMouseDown, this, std::placeholders::_1 ) );
194 mSecondWindow->getSignalDraw().connect( std::bind( &WindowTestApp::windowDraw, this ) );
195 mSecondWindow->setUserData( new WindowData );
196 }
197 else if( event.getChar() == 'c' ) {
198 getWindow()->close();
199// getWindow( getNumWindows() - 1 )->close();
200 }
201 else if( event.getChar() == 'h' ) {
202 if( getWindowIndex(0)->isHidden() )
203 getWindowIndex(0)->show();
204 else
205 getWindowIndex(0)->hide();
206 }
207 else if( event.getChar() == 'b' ) {
208 auto window = getWindow();
209 window->setBorderless( ! window->isBorderless() );
210 CI_LOG_V( "Borderless toggled, now: " << ( window->isBorderless() ? "true" : "false" ) );
211 }
212 else if( event.getChar() == 't' ) {

Callers

nothing calls this directly

Calls 15

getWindowIndexFunction · 0.85
spanAllDisplaysMethod · 0.80
getWindowFunction · 0.50
FullScreenOptionsFunction · 0.50
createFunction · 0.50
bindFunction · 0.50
isFullScreenMethod · 0.45
setFullScreenMethod · 0.45
setPosMethod · 0.45
getPosMethod · 0.45
setSizeMethod · 0.45
getSizeMethod · 0.45

Tested by

no test coverage detected