void DMEngine::openEntranceDoors() { Box rightDoorBox(109, 231, 30, 193); byte *rightDoorBitmap = _displayMan->getNativeBitmapOrGraphic(k3_entranceRightDoorGraphicIndice); Box leftDoorBox(0, 100, 30, 193); uint16 leftDoorBlitFrom = 0; byte *leftDoorBitmap = _displayMan->getNativeBitmapOrGraphic(k2_entranceLeftDoorGraphicIndice); Box screenBox(0, 319, 0, 199); for (uint16 animStep = 1; animStep < 32; ++animStep) { if ((animStep % 3) == 1) { // Strangerke: CHECKME: Earlier versions of the game were using G0565_puc_Graphic535_Sound02DoorRattle instead of k02_soundDOOR_RATTLE 2 _sound->play(k02_soundDOOR_RATTLE, 145, 0x40, 0x40); } _displayMan->blitToScreen(_savedScreenForOpenEntranceDoors, &screenBox, 160, kM1_ColorNoTransparency, 200); _displayMan->blitToBitmap(leftDoorBitmap, _displayMan->_bitmapScreen, leftDoorBox, leftDoorBlitFrom, 0, 64, k160_byteWidthScreen, kM1_ColorNoTransparency, 161, k200_heightScreen); _displayMan->blitToBitmap(rightDoorBitmap, _displayMan->_bitmapScreen, rightDoorBox, 0, 0, 64, k160_byteWidthScreen, kM1_ColorNoTransparency, 161, k200_heightScreen); _eventMan->discardAllInput(); _displayMan->updateScreen(); leftDoorBox._x2 -= 4; leftDoorBlitFrom += 4; rightDoorBox._x1 += 4; delay(3); } delete[] _savedScreenForOpenEntranceDoors; _savedScreenForOpenEntranceDoors = nullptr; }
void TestState::frame(double interp) { Vec2 screenSize = _game->screenSize().template cast<float>(); Vec2 viewCenter = _obj->posInterp(interp); Boxf viewBox(viewCenter - screenSize / 2, viewCenter + screenSize / 2); Boxf screenBox(Vec2::Zero(), screenSize); _scene.beginRender(); if(_scene.level().nLayers() > 0) { _scene.renderLevelLayer(0, viewBox, screenBox); } _scene.render(interp, viewBox, screenBox); for(unsigned layer = 1; layer < _scene.level().nLayers(); ++layer) { _scene.renderLevelLayer(layer, viewBox, screenBox); } _font.render(_game, 100, 400, "Hello World !"); _font.render(_game, 100, 432, "A quite long string in a box a bit too small.", 200); _scene.endRender(); }
// Cursor control int PCBNEW_CONTROL::CursorControl( const TOOL_EVENT& aEvent ) { long type = aEvent.Parameter<long>(); bool fastMove = type & COMMON_ACTIONS::CURSOR_FAST_MOVE; type &= ~COMMON_ACTIONS::CURSOR_FAST_MOVE; GRID_HELPER gridHelper( m_frame ); VECTOR2D cursor = getViewControls()->GetCursorPosition(); VECTOR2I gridSize = gridHelper.GetGrid(); VECTOR2D newCursor = gridHelper.Align( cursor ); if( fastMove ) gridSize = gridSize * 10; switch( type ) { case COMMON_ACTIONS::CURSOR_UP: newCursor -= VECTOR2D( 0, gridSize.y ); break; case COMMON_ACTIONS::CURSOR_DOWN: newCursor += VECTOR2D( 0, gridSize.y ); break; case COMMON_ACTIONS::CURSOR_LEFT: newCursor -= VECTOR2D( gridSize.x, 0 ); break; case COMMON_ACTIONS::CURSOR_RIGHT: newCursor += VECTOR2D( gridSize.x, 0 ); break; case COMMON_ACTIONS::CURSOR_CLICK: // fall through case COMMON_ACTIONS::CURSOR_DBL_CLICK: { TOOL_ACTIONS action = TA_NONE; int modifiers = 0; modifiers |= wxGetKeyState( WXK_SHIFT ) ? MD_SHIFT : 0; modifiers |= wxGetKeyState( WXK_CONTROL ) ? MD_CTRL : 0; modifiers |= wxGetKeyState( WXK_ALT ) ? MD_ALT : 0; if( type == COMMON_ACTIONS::CURSOR_CLICK ) action = TA_MOUSE_CLICK; else if( type == COMMON_ACTIONS::CURSOR_DBL_CLICK ) action = TA_MOUSE_DBLCLICK; else assert( false ); TOOL_EVENT evt( TC_MOUSE, action, BUT_LEFT | modifiers ); evt.SetMousePosition( getViewControls()->GetCursorPosition() ); m_toolMgr->ProcessEvent( evt ); return 0; } break; } // Handler cursor movement KIGFX::VIEW* view = getView(); newCursor = view->ToScreen( newCursor ); newCursor.x = KiROUND( newCursor.x ); newCursor.y = KiROUND( newCursor.y ); // Pan the screen if required const VECTOR2I& screenSize = view->GetGAL()->GetScreenPixelSize(); BOX2I screenBox( VECTOR2I( 0, 0 ), screenSize ); if( !screenBox.Contains( newCursor ) ) { VECTOR2D delta( 0, 0 ); if( newCursor.x < screenBox.GetLeft() ) { delta.x = newCursor.x - screenBox.GetLeft(); newCursor.x = screenBox.GetLeft(); } else if( newCursor.x > screenBox.GetRight() ) { delta.x = newCursor.x - screenBox.GetRight(); // -1 is to keep the cursor within the drawing area, // so the cursor coordinates are still updated newCursor.x = screenBox.GetRight() - 1; } if( newCursor.y < screenBox.GetTop() ) { delta.y = newCursor.y - screenBox.GetTop(); newCursor.y = screenBox.GetTop(); } else if( newCursor.y > screenBox.GetBottom() ) { delta.y = newCursor.y - screenBox.GetBottom(); // -1 is to keep the cursor within the drawing area, // so the cursor coordinates are still updated newCursor.y = screenBox.GetBottom() - 1; } view->SetCenter( view->GetCenter() + view->ToWorld( delta, false ) ); } m_frame->GetGalCanvas()->WarpPointer( newCursor.x, newCursor.y ); return 0; }