void QgsAnnotationItem::setMapPositionFixed( bool fixed ) { if ( mMapPositionFixed && !fixed ) { //set map position to the top left corner of the balloon setMapPosition( toMapCoordinates( QPointF( pos() + mOffsetFromReferencePoint ).toPoint() ) ); mOffsetFromReferencePoint = QPointF( 0, 0 ); } else if ( fixed && !mMapPositionFixed ) { setMapPosition( toMapCoordinates( QPointF( pos() + QPointF( -100, -100 ) ).toPoint() ) ); mOffsetFromReferencePoint = QPointF( 100, 100 ); } mMapPositionFixed = fixed; updateBoundingRect(); updateBalloon(); update(); }
void BouncyBee::draw() { setMapPosition(); if (flinching) { double elapsed = (getMs() - flinchTimer); if ((long)(elapsed / 100) % 2 == 0) { return; } } SDL_Rect rect = getCollisionRect(); //drawRect(rect); mapObjectDraw(); }
void FireBall::draw() { setMapPosition(); mapObjectDraw(); /* if (facingRight) { SDL_Rect posRect = {(int)(x + xmap - width/2), (int)(y + ymap - height/2), width, height}; SDL_Rect cropRect = animation.getImageRect(); SDL_RenderCopyEx(renderTarget, animation.getFrameTexture(), &cropRect, &posRect, 0, NULL, SDL_FLIP_NONE); } else { SDL_Rect posRect = {(int)(x + xmap - width/2), (int)(y + ymap - height/2), width, height}; SDL_Rect cropRect = animation.getImageRect(); SDL_RenderCopyEx(renderTarget, animation.getFrameTexture(), &cropRect, &posRect, 0, NULL, SDL_FLIP_HORIZONTAL); } */ }
void BaseMap::initMap() { isStart = false; isEnd = false; GameManager::getInstance()->LEVEL = level; this->difficulty = difficulty; mapSprite = Sprite::createWithSpriteFrameName(String::createWithFormat("Stage_%d.png",level+1)->getCString()); mapSprite->setAnchorPoint(Point(0,0)); mapSprite->setPosition(Point(0,0)); addChild(mapSprite); loadAndSetLevelData(); loadPathFromPlist(); addOrnament(); wave = -1; time = 0; addTerrains(); initTouchLayer(); setMapPosition(); }