Ejemplo n.º 1
0
CameraOptions Map::cameraForLatLngs(std::vector<LatLng> latLngs, EdgeInsets padding) {
    CameraOptions options;
    if (latLngs.empty()) {
        return options;
    }

    // Calculate the bounds of the possibly rotated shape with respect to the viewport.
    vec2<> nePixel = {-INFINITY, -INFINITY};
    vec2<> swPixel = {INFINITY, INFINITY};
    for (LatLng latLng : latLngs) {
        vec2<> pixel = pixelForLatLng(latLng);
        swPixel.x = std::min(swPixel.x, pixel.x);
        nePixel.x = std::max(nePixel.x, pixel.x);
        swPixel.y = std::min(swPixel.y, pixel.y);
        nePixel.y = std::max(nePixel.y, pixel.y);
    }
    vec2<> size = nePixel - swPixel;

    // Calculate the zoom level.
    double scaleX = (getWidth() - padding.left - padding.right) / size.x;
    double scaleY = (getHeight() - padding.top - padding.bottom) / size.y;
    double minScale = ::fmin(scaleX, scaleY);
    double zoom = ::log2(getScale() * minScale);
    zoom = ::fmax(::fmin(zoom, getMaxZoom()), getMinZoom());

    // Calculate the center point of a virtual bounds that is extended in all directions by padding.
    vec2<> paddedNEPixel = {
        nePixel.x + padding.right / minScale,
        nePixel.y + padding.top / minScale,
    };
    vec2<> paddedSWPixel = {
        swPixel.x - padding.left / minScale,
        swPixel.y - padding.bottom / minScale,
    };
    vec2<> centerPixel = (paddedNEPixel + paddedSWPixel) * 0.5;
    LatLng centerLatLng = latLngForPixel(centerPixel);

    options.center = centerLatLng;
    options.zoom = zoom;
    return options;
}
Ejemplo n.º 2
0
//----------------------------------------------------------------------------
AwTextureTarget *AwShape::processAwesomiumHit (const Point3F &start, const Point3F &end)
{
	if (!mTextureTarget)
	{
		return NULL;
	}

	Point3F localStart, localEnd;
	MatrixF mat = getTransform();
	mat.scale (Point3F (getScale ()));
	mat.inverse ();

	mat.mulP (start, &localStart);
	mat.mulP (end, &localEnd);

	RayInfo info;
	info.generateTexCoord = true;
	if (!mShapeInstance || !mShapeInstance->castRayOpcode (0, localStart, localEnd, &info))
	{
		return NULL;
	}

	if (info.texCoord.x != -1 && info.texCoord.y != -1 && info.material == mMatInstance)
	{
		Point2I pnt (info.texCoord.x * mTextureTarget->getResolution ().x, info.texCoord.y * mTextureTarget->getResolution ().y);
		
		AwManager::sCursor->setPosition (pnt);

		if (mIsMouseDown)
		{
			mTextureTarget->injectMouseDown ();
		}
		else
		{
			mTextureTarget->injectMouseUp ();
		}

		return mTextureTarget;
	}
	return NULL;
}
Ejemplo n.º 3
0
void CBackgroundManager::centerTileMapOnTileCoord(Point tilePos)
{
    // 获取屏幕大小和屏幕中心点
    Size screenSize = Director::getInstance()->getWinSize();
    Point screenCenter(screenSize.width * 0.5f, screenSize.height * 0.5f);

    // 仅在内部使用:瓷砖的Y坐标要减去1
    tilePos.y -= 1;
    // 获取瓷砖坐标处以像素表示的坐标信息
    Point scrollPosition =  m_groundLayer->getPositionAt(tilePos);
    // 考虑到地图移动的情况,我将像素坐标信息乘以 -1,从而得到负值
    scrollPosition = scrollPosition * -1;
    // 为屏幕中央坐标添加位移值
    scrollPosition = scrollPosition + screenCenter;
    
    // 移动瓷砖地图
    setPosition(scrollPosition * getScale());
//    Action* move = [CCMoveTo actionWithDuration:0.2f position:scrollPosition];
//    [tileMap stopAllActions];
//    [tileMap runAction:move];
}
Ejemplo n.º 4
0
void AvatarManager::simulateAvatarFades(float deltaTime) {
    QVector<AvatarSharedPointer>::iterator fadingIterator = _avatarFades.begin();
    
    const float SHRINK_RATE = 0.9f;
    const float MIN_FADE_SCALE = 0.001f;
    
    render::ScenePointer scene = Application::getInstance()->getMain3DScene();
    render::PendingChanges pendingChanges;
    while (fadingIterator != _avatarFades.end()) {
        auto avatar = std::static_pointer_cast<Avatar>(*fadingIterator);
        avatar->setTargetScale(avatar->getScale() * SHRINK_RATE, true);
        if (avatar->getTargetScale() < MIN_FADE_SCALE) {
            avatar->removeFromScene(*fadingIterator, scene, pendingChanges);
            fadingIterator = _avatarFades.erase(fadingIterator);
        } else {
            avatar->simulate(deltaTime);
            ++fadingIterator;
        }
    }
    scene->enqueuePendingChanges(pendingChanges);
}
Ejemplo n.º 5
0
void HasGraphics::update(sf::Time frameTime) {

    //animations[activeAnimationIndex]->update(frameTime);
    
    for (int i = 0; i < m_animations.size(); i++) {
    
        //in case texture pointer in animation goes out of scope
        if (m_animations[i].getSpriteSheet() != &m_spriteSheet) {
            m_animations[i].setSpriteSheet(m_spriteSheet);
        }
    
        //sync other stats
        m_animations[i].update(frameTime);
        m_animations[i].Transformable::setScale(getScale());
        m_animations[i].Transformable::setRotation(getRotation());
        m_animations[i].Transformable::setOrigin(getOrigin());
        m_animations[i].Transformable::setPosition(getPosition());
    
    }

};
Ejemplo n.º 6
0
U32 CoverPoint::packUpdate(NetConnection *conn, U32 mask, BitStream *stream)
{
   U32 retMask = Parent::packUpdate(conn, mask, stream);

   stream->writeInt(mSize, 4);

   stream->writeFlag(mOccupied);

   stream->writeFlag(peekLeft());
   stream->writeFlag(peekRight());
   stream->writeFlag(peekOver());

   // Write our transform information
   if(stream->writeFlag(mask & TransformMask))
   {
      mathWrite(*stream, getTransform());
      mathWrite(*stream, getScale());
   }

   return retMask;
}
Ejemplo n.º 7
0
void KyraEngine_MR::drawSceneAnimObject(AnimObj *obj, int x, int y, int layer) {
	if (obj->type == 1) {
		if (obj->shapeIndex1 == 0xFFFF)
			return;
		int scale = getScale(obj->xPos1, obj->yPos1);
		_screen->drawShape(2, getShapePtr(obj->shapeIndex1), x, y, 2, obj->flags | 0x104, _paletteOverlay, obj->palette, layer, scale, scale);
	} else {
		if (obj->shapePtr) {
			_screen->drawShape(2, obj->shapePtr, x, y, 2, obj->flags, 7);
		} else {
			if (obj->shapeIndex3 == 0xFFFF || obj->animNum == 0xFFFF)
				return;
			uint16 flags = 0x4000;
			if (obj->flags & 0x800)
				flags |= 0x8000;
			x = obj->xPos2 - _sceneAnimMovie[obj->animNum]->xAdd();
			y = obj->yPos2 - _sceneAnimMovie[obj->animNum]->yAdd();
			_sceneAnimMovie[obj->animNum]->displayFrame(obj->shapeIndex3, 2, x, y, flags | layer, 0, 0);
		}
	}
}
Ejemplo n.º 8
0
float DiffTraversal::View::computePriority(const EntityItemPointer& entity) const {
    if (!entity) {
        return PrioritizedEntity::DO_NOT_SEND;
    }

    if (!usesViewFrustums()) {
        return PrioritizedEntity::WHEN_IN_DOUBT_PRIORITY;
    }

    bool success = false;
    auto cube = entity->getQueryAACube(success);
    if (!success) {
        return PrioritizedEntity::WHEN_IN_DOUBT_PRIORITY;
    }

    auto center = cube.calcCenter(); // center of bounding sphere
    auto radius = 0.5f * SQRT_THREE * cube.getScale(); // radius of bounding sphere

    auto priority = PrioritizedEntity::DO_NOT_SEND;

    for (const auto& frustum : viewFrustums) {
        auto position = center - frustum.getPosition(); // position of bounding sphere in view-frame
        float distance = glm::length(position); // distance to center of bounding sphere

        // Check the size of the entity, it's possible that a "too small to see" entity is included in a
        // larger octree cell because of its position (for example if it crosses the boundary of a cell it
        // pops to the next higher cell. So we want to check to see that the entity is large enough to be seen
        // before we consider including it.
        float angularSize = frustum.getAngularSize(distance, radius);
        if (angularSize > lodScaleFactor * MIN_ENTITY_ANGULAR_DIAMETER &&
            frustum.intersects(position, distance, radius)) {

            // use the angular size as priority
            // we compute the max priority for all frustums
            priority = std::max(priority, angularSize);
        }
    }

    return priority;
}
Ejemplo n.º 9
0
void Grid::draw(int index_load)

{

	GLfloat m[16];
	vector <float > c = getColor();
    vector <float > r = getRotation();
    vector <float > t = getTranslation();
    vector <float > s = getScale();

    glm::quat quat (glm::vec3(r[0]*PI/BASE, r[1]*PI/BASE, r[2]*PI/BASE));
    glm::quat quaternion = quat ; 
    glm::mat4 mat  = glm::toMat4(quaternion);

    int count = 0;
    for (int k = 0; k < 4; ++k){
        for (int j = 0; j < 4; ++j){
            m[count] = mat[k][j];
            count++;
        }   
    }
    glLoadName(index_load); // register object.
    glPushMatrix();

        glColor3f(c[0],c[1],c[2]);
        glScalef(s[0], s[1], s[2]);
        glTranslatef(t[0],t[1],t[2]);
        glMultMatrixf(m);
        glBegin(GL_LINES);
        vector < float * > vertex = getVertex();

        for (int j = 0; j < (int) vertex.size(); ++j){
            
            glVertex3fv(vertex[j]);
        }
        glEnd();
    
    glPopMatrix();
    //glPopName();
}
Ejemplo n.º 10
0
//=============================================================================
// Circular collision detection method
// Called by collision(), default collision detection method
// Post: returns true if collision, false otherwise
//       sets collisionVector if collision
//=============================================================================
bool Entity::collideCircle(Entity &ent, VECTOR2 &collisionVector)
{
    // difference between centers
    distSquared = *getCenter() - *ent.getCenter();
    distSquared.x = distSquared.x * distSquared.x;      // difference squared
    distSquared.y = distSquared.y * distSquared.y;

    // Calculate the sum of the radii (adjusted for scale)
    sumRadiiSquared = (radius*getScale()) + (ent.radius*ent.getScale());
    sumRadiiSquared *= sumRadiiSquared;                 // square it

    // if entities are colliding
    if(distSquared.x + distSquared.y <= sumRadiiSquared)
    {
        // set collision vector
        collisionVector = *ent.getCenter() - *getCenter();
        collisionCenter = *getCenter();
        ent.setCollisionCenter(*ent.getCenter());
        return true;
    }
    return false;   // not colliding
}
Ejemplo n.º 11
0
void Matrix3DUtils::setScale(Matrix3D &m, float x, float y, float z, const float smooth) {
    if (x < MIN_SCALE) {
        x = MIN_SCALE;
    }
    if (y < MIN_SCALE) {
        y = MIN_SCALE;
    }
    if (z < MIN_SCALE) {
        z = MIN_SCALE;
    }
    getScale(m, _scale);
    _x = _scale.x;
    _y = _scale.y;
    _z = _scale.z;
    _scale.x += (x - _scale.x) * smooth;
    _scale.y += (y - _scale.y) * smooth;
    _scale.z += (z - _scale.z) * smooth;
    _right.scaleBy(_scale.x / _x);
    _up.scaleBy(_scale.y / _y);
    _dir.scaleBy(_scale.z / _z);
    setVectors(m, _right, _up, _dir);
}
Ejemplo n.º 12
0
void PxSingleActor::renderObject(SceneState* state)
{
   GFXTransformSaver saver;

   // Set up our TS render state here.
   TSRenderState rdata;
   rdata.setSceneState( state );
   //rdata.setObjScale( &getScale() );

   LightManager *lm = gClientSceneGraph->getLightManager();
   if ( !state->isShadowPass() )
      lm->setupLights( this, getWorldSphere() );

   MatrixF mat = getTransform();
   mat.scale( getScale() );
   GFX->setWorldMatrix( mat );

   mShapeInstance->animate();
   mShapeInstance->render( rdata );
   
   lm->resetLights();  
}
Ejemplo n.º 13
0
	void Tree::Update( float frame_time )
	{
		if(enable_ && flower_state_ != WAITING)
		{            
			time_ +=frame_time;
		}
		ofVec3f scale = getScale();
		switch (flower_state_)
		{
		case GROWING:
			org_pos_ = pos;
			if(scale.x < max_scale_)
			{
				scale += scale_speed_;
			}
// 			if(time_ > staying_time_)
// 			{
// 				flower_state_ = DISAPPEARING;
// 				org_pos_ = pos;
// 				time_=0;			
// 			}
			break;
		case DISAPPEARING:
			if(scale.x > 0)
				scale -= scale_speed_;
			else
			{
				scale = ofVec3f(0, 0, 0);
				pos = org_pos_;
				flower_state_ = WAITING;
				time_ = 0;
			}
			break;
		default:
			break;
		}            
		setScale(scale.x, scale.y, scale.z);      
	}
Ejemplo n.º 14
0
bool AdObject::displaySpriteAttachment(AdObject *attachment) {
	if (!attachment->_active) {
		return STATUS_OK;
	}

	float scaleX, scaleY;
	getScale(&scaleX, &scaleY);

	int origX = attachment->_posX;
	int origY = attachment->_posY;

	// inherit position from owner
	attachment->_posX = (int)(this->_posX + attachment->_posX * scaleX / 100.0f);
	attachment->_posY = (int)(this->_posY + attachment->_posY * scaleY / 100.0f);

	// inherit other props
	attachment->_alphaColor = this->_alphaColor;
	attachment->_blendMode = this->_blendMode;

	attachment->_scale = this->_scale;
	attachment->_relativeScale = this->_relativeScale;
	attachment->_scaleX = this->_scaleX;
	attachment->_scaleY = this->_scaleY;

	attachment->_rotate = this->_rotate;
	attachment->_relativeRotate = this->_relativeRotate;
	attachment->_rotateValid = this->_rotateValid;

	attachment->_registerAlias = this;
	attachment->_registrable = this->_registrable;

	bool ret = attachment->display();

	attachment->_posX = origX;
	attachment->_posY = origY;

	return ret;
}
int main(int argc, char **argv) {
	if (argc != 5) {
		printf("Invalid arguments\n");
		printf("\tprogram height width ix iy\n");
		exit(EXIT_FAILURE);	
	}

	int height = atoi(argv[1]),
		width = atoi(argv[2]);
	float ix = atof(argv[3]), //zoom en x
		  iy = atof(argv[4]); //zoom en y
	int delay = 2;

	struct timeval t0, t1, t;	
	
	int **originalImage = getImage(height, width);	
	assert (gettimeofday (&t0, NULL) == 0);
//	El mirrorImage se cuenta como entrada del procesamiento, asi no contamos el tiempo que se tarda crearlo
	int **mirrorImage   = getMirror(originalImage, height, width, delay);
	int **scaleImage    = getScale(mirrorImage, height, width, delay, ix, iy);
	
	assert (gettimeofday (&t1, NULL) == 0);
	timersub(&t1, &t0, &t);
	
//	printf("Original\n");
//	print_image(originalImage, height, width);

//	printf("Espejo\n");
//	print_image(mirrorImage, height+4, width+4);

//	printf("Resultado\n");
//	print_image(scaleImage, height*iy, width*ix);
	
	printf ("Tiempo      = %ld:%ld(seg:mseg)\n", t.tv_sec, t.tv_usec/1000);

	exit(0);

}
Ejemplo n.º 16
0
void AGOSEngine::vc76_setScaleXOffs() {
	if (getGameType() == GType_PP && getBitFlag(120)) {
		VgaSprite *vsp1, *vsp2;
		uint16 old_file_1, tmp1, tmp2;

		old_file_1 = _vgaCurSpriteId;

		_vgaCurSpriteId = vcReadVar(vcReadNextWord());
		 vsp1 = findCurSprite();
		_vgaCurSpriteId = vcReadVar(vcReadNextWord());
		 vsp2 = findCurSprite();

		tmp1 = vsp1->x;
		tmp2 = vsp2->x;
		vsp1->x = tmp2;
		vsp2->x = tmp1;
		tmp1 = vsp1->y;
		tmp2 = vsp2->y;
		vsp1->y = tmp2;
		vsp2->y = tmp1;

		_vgaCurSpriteId = old_file_1;
		_vcPtr += 2;
	} else {
		VgaSprite *vsp = findCurSprite();

		vsp->image = vcReadNextWord();
		int16 x = vcReadNextWord();
		uint16 var = vcReadNextWord();

		vsp->x += getScale(vsp->y, x);
		_variableArrayPtr[var] = vsp->x;

		checkScrollX(x, vsp->x);

		vsp->flags = kDFScaled;
	}
}
Ejemplo n.º 17
0
void Map::fitBounds(AnnotationSegment segment, EdgeInsets padding, Duration duration) {
    if (segment.empty()) {
        return;
    }
    
    // Calculate the bounds of the possibly rotated shape with respect to the viewport.
    vec2<> nePixel = {-INFINITY, -INFINITY};
    vec2<> swPixel = {INFINITY, INFINITY};
    for (LatLng latLng : segment) {
        vec2<> pixel = pixelForLatLng(latLng);
        swPixel.x = std::min(swPixel.x, pixel.x);
        nePixel.x = std::max(nePixel.x, pixel.x);
        swPixel.y = std::min(swPixel.y, pixel.y);
        nePixel.y = std::max(nePixel.y, pixel.y);
    }
    vec2<> size = nePixel - swPixel;

    // Calculate the zoom level.
    double scaleX = (getWidth() - padding.left - padding.right) / size.x;
    double scaleY = (getHeight() - padding.top - padding.bottom) / size.y;
    double minScale = std::fmin(scaleX, scaleY);
    double zoom = std::log2(getScale() * minScale);
    zoom = std::fmax(std::fmin(zoom, getMaxZoom()), getMinZoom());

    // Calculate the center point of a virtual bounds that is extended in all directions by padding.
    vec2<> paddedNEPixel = {
        nePixel.x + padding.right / minScale,
        nePixel.y + padding.top / minScale,
    };
    vec2<> paddedSWPixel = {
        swPixel.x - padding.left / minScale,
        swPixel.y - padding.bottom / minScale,
    };
    vec2<> centerPixel = (paddedNEPixel + paddedSWPixel) * 0.5;
    LatLng centerLatLng = latLngForPixel(centerPixel);

    setLatLngZoom(centerLatLng, zoom, duration);
}
Ejemplo n.º 18
0
bool CCMenuItemSprite::initWithNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite, CCObject* target, SEL_MenuHandler selector)
{
    CCMenuItem::initWithTarget(target, selector); 
    setNormalImage(normalSprite);
    setSelectedImage(selectedSprite);
    setDisabledImage(disabledSprite);

    if(m_pNormalImage)
    {
        this->setContentSize(m_pNormalImage->getContentSize());
        // #HLP_BEGIN
        // #resource_scale_fix
        if(getTag() != TAG_INTERNET_MENU_ITEM_IMAGE){
            setScale(getScale() * CC_CONTENT_SCALE_FACTOR() / CC_RESOURCE_SCALE_FACTOR());
        }
        // #HLP_END
    }
    
    setCascadeColorEnabled(true);
    setCascadeOpacityEnabled(true);
    
    return true;
}
Ejemplo n.º 19
0
void Item::_updatePhysics()
{
   SAFE_DELETE( mPhysicsRep );

   if ( !PHYSICSMGR )
      return;

   if (mDataBlock->simpleServerCollision)
   {
      // We only need the trigger on the server.
      if ( isServerObject() )
      {
         PhysicsCollision *colShape = PHYSICSMGR->createCollision();
         colShape->addBox( mObjBox.getExtents() * 0.5f, MatrixF::Identity );

         PhysicsWorld *world = PHYSICSMGR->getWorld( isServerObject() ? "server" : "client" );
         mPhysicsRep = PHYSICSMGR->createBody();
         mPhysicsRep->init( colShape, 0, PhysicsBody::BF_TRIGGER | PhysicsBody::BF_KINEMATIC, this, world );
         mPhysicsRep->setTransform( getTransform() );
      }
   }
   else
   {
      if ( !mShapeInstance )
         return;

      PhysicsCollision* colShape = mShapeInstance->getShape()->buildColShape( false, getScale() );

      if ( colShape )
      {
         PhysicsWorld *world = PHYSICSMGR->getWorld( isServerObject() ? "server" : "client" );
         mPhysicsRep = PHYSICSMGR->createBody();
         mPhysicsRep->init( colShape, 0, PhysicsBody::BF_KINEMATIC, this, world );
         mPhysicsRep->setTransform( getTransform() );
      }
   }
}
Ejemplo n.º 20
0
void TurretShape::getWeaponMountTransform( S32 index, const MatrixF &xfm, MatrixF *outMat )
{
   // Returns mount point to world space transform
   if ( index >= 0 && index < SceneObject::NumMountPoints) {
      S32 ni = mDataBlock->weaponMountNode[index];
      if (ni != -1) {
         MatrixF mountTransform = mShapeInstance->mNodeTransforms[ni];
         mountTransform.mul( xfm );
         const Point3F& scale = getScale();

         // The position of the mount point needs to be scaled.
         Point3F position = mountTransform.getPosition();
         position.convolve( scale );
         mountTransform.setPosition( position );

         // Also we would like the object to be scaled to the model.
         outMat->mul(mObjToWorld, mountTransform);
         return;
      }
   }

   // Then let SceneObject handle it.
   GrandParent::getMountTransform( index, xfm, outMat );      
}
Ejemplo n.º 21
0
	void Sprite::render(const Matrix4f& view,
						const Matrix4f& projection) const {

		// We must have a loaded texture to render
		if(!m_texture.isLoaded())
			return;

		// We need an OpenGL context
		ensureContext();
		// Our data has to be uploaded
		ensureUpdatedVertexArray();

		// Create Transformable that takes Rectangle's dimensions into account
		Transformable2D t;
		t.setPosition(getPosition());
		t.setRotation(getRotation());
		t.setScale(getScale() * getDimensions());

		// Setup shader
		const Shader& shader = BurnShaders::getShader(BurnShaders::SPRITE2D);
		shader.resetTextureUnitCounter();
		shader.setUniform("gModelMatrix", t.getModelMatrix());
		shader.setUniform("gViewMatrix", view);
		shader.setUniform("gProjectionMatrix", projection);
		shader.setUniform("gColor", getColor());
		shader.setUniform("gUvStart", m_uvStart);
		shader.setUniform("gUvEnd", m_uvEnd);
		shader.bindTexture("gTextureSampler", m_texture);
		shader.activate();

		// Render
		m_vertexArray.bind();
		glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
		m_vertexArray.unbind();

	}
Ejemplo n.º 22
0
//WARNING: event ID must match enum ddDataType!!! this event was created on view
void ddTextTableItemFigure::OnGenericPopupClick(wxCommandEvent &event, hdDrawingView *view)
{
	wxTextEntryDialog *nameDialog = NULL;
	ddPrecisionScaleDialog *numericDialog = NULL;
	wxString tmpString;
	int answer;
	int tmpprecision;
	long tmpvalue;
	hdRemoveDeleteDialog *delremDialog = NULL;

	switch(event.GetId())
	{
		case MNU_DDADDCOLUMN:
			nameDialog = new wxTextEntryDialog(view, wxT("New column name"), wxT("Add a column"));
			answer = nameDialog->ShowModal();
			if (answer == wxID_OK)
			{
				tmpString = nameDialog->GetValue();
				getOwnerColumn()->getOwnerTable()->addColumn(view->getIdx(), new ddColumnFigure(tmpString, getOwnerColumn()->getOwnerTable()));
				view->notifyChanged();
			}
			delete nameDialog;
			break;
		case MNU_DELCOLUMN:
			answer = wxMessageBox(wxT("Are you sure you wish to delete column ") + getText(true) + wxT("?"), wxT("Delete column?"), wxYES_NO | wxNO_DEFAULT, view);
			if (answer == wxYES)
			{
				getOwnerColumn()->getOwnerTable()->removeColumn(view->getIdx(), getOwnerColumn());
				view->notifyChanged();
			}
			break;
		case MNU_AUTONAMCOLUMN:
			getOwnerColumn()->activateGenFkName();
			getOwnerColumn()->getFkSource()->syncAutoFkName();
			view->notifyChanged();
			break;
		case MNU_RENAMECOLUMN:
			nameDialog = new wxTextEntryDialog(view, wxT("New column name"), wxT("Rename Column"), getText());
			nameDialog->ShowModal();
			if(getOwnerColumn()->isGeneratedForeignKey()) //after a manual user column rename, deactivated automatic generation of fk name.
				getOwnerColumn()->deactivateGenFkName();
			setText(nameDialog->GetValue());
			delete nameDialog;
			view->notifyChanged();
			break;
		case MNU_NOTNULL:
			if(getOwnerColumn()->isNotNull())
				getOwnerColumn()->setColumnOption(null);
			else
				getOwnerColumn()->setColumnOption(notnull);
			view->notifyChanged();
			break;
		case MNU_PKEY:
			if(getOwnerColumn()->isPrimaryKey())
			{
				getOwnerColumn()->disablePrimaryKey();
			}
			else
			{
				getOwnerColumn()->enablePrimaryKey();
				getOwnerColumn()->setColumnOption(notnull);
			}
			view->notifyChanged();
			break;
		case MNU_UKEY:
			getOwnerColumn()->toggleColumnKind(uk, view);
			view->notifyChanged();
			break;
		case MNU_TYPESERIAL:
			setDataType(dt_serial);  //Should use setDataType always to set this value to allow fk to work flawlessly
			recalculateDisplayBox();
			getOwnerColumn()->displayBoxUpdate();
			getOwnerColumn()->getOwnerTable()->updateTableSize();
			view->notifyChanged();
			break;
		case MNU_TYPEBOOLEAN:
			setDataType(dt_boolean);
			recalculateDisplayBox();
			getOwnerColumn()->displayBoxUpdate();
			getOwnerColumn()->getOwnerTable()->updateTableSize();
			view->notifyChanged();
			break;
		case MNU_TYPEINTEGER:
			setDataType(dt_integer);
			recalculateDisplayBox();
			getOwnerColumn()->displayBoxUpdate();
			getOwnerColumn()->getOwnerTable()->updateTableSize();
			view->notifyChanged();
			break;
		case MNU_TYPEMONEY:
			setDataType(dt_money);
			recalculateDisplayBox();
			getOwnerColumn()->displayBoxUpdate();
			getOwnerColumn()->getOwnerTable()->updateTableSize();
			view->notifyChanged();
			break;
		case MNU_TYPEVARCHAR:
			setDataType(dt_varchar);
			tmpprecision = wxGetNumberFromUser(_("Varchar size"),
			                                   _("Size for varchar datatype"),
			                                   _("Varchar size"),
			                                   getPrecision(), 0, 255, view);
			if (tmpprecision >= 0)
			{
				setPrecision(tmpprecision);
				setScale(-1);
			}
			recalculateDisplayBox();
			getOwnerColumn()->displayBoxUpdate();
			getOwnerColumn()->getOwnerTable()->updateTableSize();
			view->notifyChanged();
			break;
		case MNU_TYPEOTHER:
			answer = wxGetSingleChoiceIndex(wxT("New column datatype"), wxT("Column Datatypes"), dataTypes(), view);
			if(answer >= 0)
			{
				view->notifyChanged();
				if(answer == dt_varchar || answer == dt_bit || answer == dt_char || answer == dt_interval || answer == dt_varbit)
				{
					tmpprecision = wxGetNumberFromUser(_("datatype size"),
					                                   _("Size for datatype"),
					                                   _("size"),
					                                   getPrecision(), 0, 255, view);
					if (tmpprecision >= 0)
					{
						setPrecision(tmpprecision);
						setScale(-1);
					}
					recalculateDisplayBox();
					getOwnerColumn()->displayBoxUpdate();
					getOwnerColumn()->getOwnerTable()->updateTableSize();
				}
				if(answer == dt_numeric)
				{
					numericDialog = new ddPrecisionScaleDialog(	view,
					        NumToStr((long)getPrecision()),
					        NumToStr((long)getScale()));
					numericDialog->ShowModal();
					numericDialog->GetValue1().ToLong(&tmpvalue);
					setPrecision(tmpvalue);
					numericDialog->GetValue2().ToLong(&tmpvalue);
					setScale(tmpvalue);
					delete numericDialog;
					recalculateDisplayBox();
					getOwnerColumn()->displayBoxUpdate();
					getOwnerColumn()->getOwnerTable()->updateTableSize();
				}


				setDataType( (ddDataType) answer );
				recalculateDisplayBox();
				getOwnerColumn()->displayBoxUpdate();
				getOwnerColumn()->getOwnerTable()->updateTableSize();
			}
			break;
		case MNU_TYPEPKEY_CONSTRAINTNAME:
			tmpString = wxGetTextFromUser(wxT("New name of primary key:"), getOwnerColumn()->getOwnerTable()->getPkConstraintName(), getOwnerColumn()->getOwnerTable()->getPkConstraintName(), view);
			if(tmpString.length() > 0)
			{
				getOwnerColumn()->getOwnerTable()->setPkConstraintName(tmpString);
				view->notifyChanged();
			}
			break;
		case MNU_TYPEUKEY_CONSTRAINTNAME:
			answer = wxGetSingleChoiceIndex(wxT("Select Unique Key constraint to edit name"), wxT("Select Unique Constraint to edit name:"), getOwnerColumn()->getOwnerTable()->getUkConstraintsNames(), view);
			if(answer >= 0)
			{
				tmpString = wxGetTextFromUser(wxT("Change name of Unique Key constraint:"), getOwnerColumn()->getOwnerTable()->getUkConstraintsNames().Item(answer), getOwnerColumn()->getOwnerTable()->getUkConstraintsNames().Item(answer), view);
				if(tmpString.length() > 0)
				{
					getOwnerColumn()->getOwnerTable()->getUkConstraintsNames().Item(answer) = tmpString;
					view->notifyChanged();
				}
			}
			break;
		case MNU_DELTABLE:

			delremDialog = new hdRemoveDeleteDialog(wxT("Are you sure you wish to delete table ") + getOwnerColumn()->getOwnerTable()->getTableName() + wxT("?"), wxT("Delete table?"), view);
			answer = delremDialog->ShowModal();
			ddTableFigure *table = getOwnerColumn()->getOwnerTable();
			if (answer == DD_DELETE)
			{
				ddDrawingEditor *editor = (ddDrawingEditor *) view->editor();
				//Unselect table at all diagrams
				editor->removeFromAllSelections(table);
				//Drop foreign keys with this table as origin or destination
				table->processDeleteAlert(view->getDrawing());
				//Drop table
				editor->deleteModelFigure(table);
				editor->getDesign()->refreshBrowser();
				view->notifyChanged();
			}
			else if(answer == DD_REMOVE)
			{
				ddDrawingEditor *editor = (ddDrawingEditor *) view->editor();
				editor->getExistingDiagram(view->getIdx())->removeFromSelection(table);
				editor->getExistingDiagram(view->getIdx())->remove(table);
				view->notifyChanged();
			}
			delete delremDialog;
			break;
	}
}
Ejemplo n.º 23
0
static void 
scaleChanged (Widget w, XtPointer textField, XmScaleCallbackStruct *cbs) {
    setTextField ((Widget) textField, cbs->value);
    setCell (getScale(redScale), getScale(greenScale), getScale(blueScale));
}
Ejemplo n.º 24
0
bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) {
	switch ((int)event.type) {
	case Common::EVENT_KEYDOWN:
		if (event.kbd.hasFlags(Common::KBD_ALT)) {
			// Alt-Return and Alt-Enter toggle full screen mode
			if (event.kbd.keycode == Common::KEYCODE_RETURN ||
				event.kbd.keycode == (Common::KeyCode)SDLK_KP_ENTER) {
				toggleFullScreen(0);
				return true;
			}

			// Alt-S create a screenshot
			if (event.kbd.keycode == 's') {
				Common::String filename;

				for (int n = 0;; n++) {
					SDL_RWops *file;

					filename = Common::String::format("scummvm%05d.bmp", n);
					file = SDL_RWFromFile(filename.c_str(), "r");
					if (!file)
						break;
					SDL_RWclose(file);
				}
				if (saveScreenshot(filename.c_str()))
					debug("Saved screenshot '%s'", filename.c_str());
				else
					warning("Could not save screenshot");
				return true;
			}
		}

		if (event.kbd.hasFlags(Common::KBD_CTRL|Common::KBD_ALT)) {
			// Ctrl-Alt-Return and Ctrl-Alt-Enter switch between full screen modes
			if (event.kbd.keycode == Common::KEYCODE_RETURN ||
				event.kbd.keycode == (Common::KeyCode)SDLK_KP_ENTER) {
				toggleFullScreen(1);
				return true;
			}

			// Ctrl-Alt-a switch between display modes
			if (event.kbd.keycode == 'a') {
				beginGFXTransaction();
					setFeatureState(OSystem::kFeatureAspectRatioCorrection, !getFeatureState(OSystem::kFeatureAspectRatioCorrection));
				endGFXTransaction();
#ifdef USE_OSD
			Common::String osdMessage;
			if (getFeatureState(OSystem::kFeatureAspectRatioCorrection))
				osdMessage = Common::String::format("%s\n%d x %d -> %d x %d",
				        _("Enabled aspect ratio correction"),
				        _videoMode.screenWidth, _videoMode.screenHeight,
				        _hwscreen->w, _hwscreen->h);
			else
				osdMessage = Common::String::format("%s\n%d x %d -> %d x %d",
				        _("Disabled aspect ratio correction"),
				        _videoMode.screenWidth, _videoMode.screenHeight,
				        _hwscreen->w, _hwscreen->h);
			displayMessageOnOSD(osdMessage.c_str());
#endif
				internUpdateScreen();
				return true;
			}

			// Ctrl-Alt-f toggles antialiasing
			if (event.kbd.keycode == 'f') {
				beginGFXTransaction();
					toggleAntialiasing();
				endGFXTransaction();

#ifdef USE_OSD
				// TODO: This makes guesses about what internal antialiasing
				// modes we use, we might want to consider a better way of
				// displaying information to the user.
				if (getAntialiasingState())
					displayMessageOnOSD(_("Active filter mode: Linear"));
				else
					displayMessageOnOSD(_("Active filter mode: Nearest"));
#endif
				return true;
			}

			SDLKey sdlKey = (SDLKey)event.kbd.keycode;

			// Ctrl+Alt+Plus/Minus Increase/decrease the scale factor
			if ((sdlKey == SDLK_EQUALS || sdlKey == SDLK_PLUS || sdlKey == SDLK_MINUS ||
				sdlKey == SDLK_KP_PLUS || sdlKey == SDLK_KP_MINUS)) {
				int factor = getScale();
				factor += (sdlKey == SDLK_MINUS || sdlKey == SDLK_KP_MINUS) ? -1 : +1;
				if (0 < factor && factor < 4) {
					// Check if the desktop resolution has been detected
					if (_desktopWidth > 0 && _desktopHeight > 0)
						// If the new scale factor is too big, do not scale
						if (_videoMode.screenWidth * factor > _desktopWidth ||
							_videoMode.screenHeight * factor > _desktopHeight)
							return false;

					beginGFXTransaction();
						setScale(factor);
					endGFXTransaction();
#ifdef USE_OSD
					displayScaleChangedMsg();
#endif
					return true;
				}
			}

			const bool isNormalNumber = (SDLK_1 <= sdlKey && sdlKey <= SDLK_3);
			const bool isKeypadNumber = (SDLK_KP1 <= sdlKey && sdlKey <= SDLK_KP3);

			// Ctrl-Alt-<number key> will change the GFX mode
			if (isNormalNumber || isKeypadNumber) {
				if (sdlKey - (isNormalNumber ? SDLK_1 : SDLK_KP1) <= 3) {
#ifdef USE_OSD
					int lastMode = _videoMode.mode;
#endif
					// We need to query the scale and set it up, because
					// setGraphicsMode sets the default scale to 2
					int oldScale = getScale();
					beginGFXTransaction();
						setGraphicsMode(sdlKey - (isNormalNumber ? SDLK_1 : SDLK_KP1));
						setScale(oldScale);
					endGFXTransaction();
#ifdef USE_OSD
					if (lastMode != _videoMode.mode)
						displayModeChangedMsg();
#endif
					internUpdateScreen();
				}
			}
		}

		if (event.kbd.hasFlags(Common::KBD_CTRL|Common::KBD_SHIFT)) {
			// Ctrl-Shift-Return and Ctrl-Shift-Enter switch backwards between full screen modes
			if (event.kbd.keycode == Common::KEYCODE_RETURN ||
				event.kbd.keycode == (Common::KeyCode)SDLK_KP_ENTER) {
				toggleFullScreen(-1);
				return true;
			}
		}
		break;

	case Common::EVENT_KEYUP:
		return isHotkey(event);

	default:
		break;
	}

	return false;
}
Ejemplo n.º 25
0
bool OpenGLSdlGraphicsManager::loadGFXMode() {
	// If the screen was resized, do not change its size
	if (!_screenResized) {
		const int scaleFactor = getScale();
		_videoMode.overlayWidth = _videoMode.hardwareWidth = _videoMode.screenWidth * scaleFactor;
		_videoMode.overlayHeight = _videoMode.hardwareHeight = _videoMode.screenHeight * scaleFactor;

		// The only modes where we need to adapt the aspect ratio are 320x200
		// and 640x400. That is since our aspect ratio correction in fact is
		// only used to ensure that the original pixel size aspect for these
		// modes is used.
		// (Non-square pixels on old monitors vs square pixel on new ones).
		if (_videoMode.aspectRatioCorrection
		    && ((_videoMode.screenWidth == 320 && _videoMode.screenHeight == 200)
		    || (_videoMode.screenWidth == 640 && _videoMode.screenHeight == 400)))
			_videoMode.overlayHeight = _videoMode.hardwareHeight = 240 * scaleFactor;
		else
			_videoMode.overlayHeight = _videoMode.hardwareHeight = _videoMode.screenHeight * scaleFactor;
	}

	_screenResized = false;

	// Setup OpenGL attributes for SDL
	SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
	SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
	SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
	SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
	SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);

	const bool isFullscreen = getFullscreenMode();

	// In case we have an fullscreen mode and we are not in a rollback, detect
	// a proper mode to use. In case we are in a rollback, we already detected
	// a proper mode when setting up that mode, thus there is no need to run
	// the detection again.
	if (isFullscreen && _transactionMode != kTransactionRollback) {
		if (!setupFullscreenMode())
			// Failed setuping a fullscreen mode
			return false;
	}

	_videoMode.overlayWidth = _videoMode.hardwareWidth;
	_videoMode.overlayHeight = _videoMode.hardwareHeight;

	uint32 flags = SDL_OPENGL;

	if (isFullscreen)
		flags |= SDL_FULLSCREEN;
	else
		flags |= SDL_RESIZABLE;

	// Create our window
	_hwscreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, 32, flags);
#ifdef USE_RGB_COLOR
	detectSupportedFormats();
#endif

	if (_hwscreen == NULL) {
		// DON'T use error(), as this tries to bring up the debug
		// console, which WON'T WORK now that _hwscreen is hosed.

		if (!_oldVideoMode.setup) {
			warning("SDL_SetVideoMode says we can't switch to that mode (%s)", SDL_GetError());
			g_system->quit();
		} else
			// Cancel GFX load, and go back to last mode
			return false;
	}

	// Check if the screen is BGR format
	_formatBGR = _hwscreen->format->Rshift != 0;

	if (isFullscreen) {
		_lastFullscreenModeWidth = _videoMode.hardwareWidth;
		_lastFullscreenModeHeight = _videoMode.hardwareHeight;
		ConfMan.setInt("last_fullscreen_mode_width", _lastFullscreenModeWidth);
		ConfMan.setInt("last_fullscreen_mode_height", _lastFullscreenModeHeight);
	}

	// Call and return parent implementation of this method
	return OpenGLGraphicsManager::loadGFXMode();
}
// create
//---------------------------------------------------------------------------
void PuffParticle2D::create(	PUFF_TYPE particleType,
                             float     scaleMin,
                             float     scaleRand,
                             int       FPSmin,
                             int       FPSrand,
                             int       layer,
                             int       shadowLayer,
                             int       isFarAway /* = 0 */)
{
    assert(scaleMin >= 0.0);
    assert(scaleRand >= 0.0);

    scale = getScale(scaleMin, scaleRand);

    PuffParticle2D::layer       = layer;
    PuffParticle2D::shadowLayer = shadowLayer;
    PuffParticle2D::isFarAway   = isFarAway;

    index = getPakIndex(scale, staticPackedSmokeLightPuff.size());

    if (particleType == LIGHT) {
        packedSurface.setData( *(staticPackedSmokeLightPuff[index]) );
        packedSurfaceShadow.setData( *(staticPackedSmokeLightPuff[index]) );
    } else if (particleType == DARK) {
        packedSurface.setData( *(staticPackedSmokeDarkPuff[index]) );
        packedSurfaceShadow.setData( *(staticPackedSmokeDarkPuff[index]) );
    } else if (particleType == DIRT) {
        packedSurface.setData( *(staticPackedDirtPuff[index]) );
        packedSurfaceShadow.setData( *(staticPackedDirtPuff[index]) );
    } else {
        throw Exception("ERROR: Unsupported particleType.");
    }

    packedSurfaceShadow.setDrawModeBlend(&Palette::colorTableDarkenALittle);

    if (GameConfig::video_blendsmoke) {
        int randColorTable = rand() % 4;

        if (randColorTable == 0) {
            packedSurface.setDrawModeBlend(&Palette::colorTable2080);
        } else if(randColorTable == 1) {
            packedSurface.setDrawModeBlend(&Palette::colorTable4060);
        } else if(randColorTable == 2) {
            packedSurface.setDrawModeBlend(&Palette::colorTable6040);
        } else if(randColorTable == 3) {
            packedSurface.setDrawModeBlend(&Palette::colorTable8020);

        } else {
            assert(false);
        }

    } else {
        packedSurface.setDrawModeSolid();
    }

    packedSurface.setFPS(getFPS(FPSmin, FPSrand));

    // If the particles are far away, speed them up.
    if (isFarAway) {
        assert(packedSurface.getFPS() > 0);

        packedSurface.setFPS(packedSurface.getFPS() * 2.0f);
    }

    // Set the shadow FPS to match the non-shadow particle.
    packedSurfaceShadow.setFPS(packedSurface.getFPS());

} // end PuffParticle2D::create
Ejemplo n.º 27
0
void Ball::spawnBall(cocos2d::Layer *layer, Point throwerPosition, int throwerGrowth,/* int type, float speed,*/ int way)
{
	//Point throwerPosition = thrower->getPosition();
    CCLOG( "SPAWN BALL" );
    
    auto ball = Sprite::create( IMG_BALL );
    
    auto ballPosition = throwerPosition;
	ballPosition.y += way*throwerGrowth;

	ball->setPosition(ballPosition);
	ball->setScale(1.3f);
    
	auto ballBody = PhysicsBody::createCircle(ball->getContentSize().width/2);
	ballBody->setCollisionBitmask(BALL_COLLISION_BITMASK);
	ballBody->setContactTestBitmask(true);
	ball->setPhysicsBody(ballBody);
	ball->setName("ball");
    
	layer->addChild(ball, 100);
    
    auto ballAction = MoveBy::create( (1.0f/BALL_MOVEMENT_SPEED) * visibleSize.height * ball->getScale(), Point( 0, way*visibleSize.height * 1.5 ) );
    
	ball->runAction(ballAction);
}
Ejemplo n.º 28
0
//--------------------------------------------------------------------
// drawShape()
//--------------------------------------------------------------------
U32 LLViewerJointShape::drawShape( F32 pixelArea, BOOL first_pass )
{
	U32 triangle_count = 0;

	//----------------------------------------------------------------
	// render ST_NULL
	//----------------------------------------------------------------
	if (mType == ST_NULL)
	{
		return triangle_count;
	}

	//----------------------------------------------------------------
	// setup current color
	//----------------------------------------------------------------
	glColor4fv(mColor.mV);

	//----------------------------------------------------------------
	// setup current texture
	//----------------------------------------------------------------
	glMatrixMode(GL_TEXTURE);
	glPushMatrix();
	glLoadIdentity();
	if (mType == ST_SPHERE)
	{
		glTranslatef(-0.25f, 0.0f, 0.0f);
	}
	glMatrixMode(GL_MODELVIEW);
	LLViewerImage::bindTexture(mTexture);

	//----------------------------------------------------------------
	// update pixel area
	//----------------------------------------------------------------
	F32 s1 = llmax( getScale().mV[VX], llmax( getScale().mV[VY], getScale().mV[VZ] ) );
	F32 s2 = llmin( getScale().mV[VX], llmax( getScale().mV[VY], getScale().mV[VZ] ) );
	pixelArea *= s1 * s2;

	//----------------------------------------------------------------
	// render shape
	//----------------------------------------------------------------
	switch ( mType )
	{
	case ST_CUBE:
		gBox.render();
		break;

	case ST_SPHERE:
		gSphere.render( pixelArea );
		break;

	case ST_CYLINDER:
		gCylinder.render( pixelArea );
		break;

	default:
		break;
	}

	//----------------------------------------------------------------
	// disable texture
	//----------------------------------------------------------------
	if ( mTexture )
	{
		glMatrixMode(GL_TEXTURE);
		glPopMatrix();
		glMatrixMode(GL_MODELVIEW);
	}

	return triangle_count;
}
	// 更新触发器数据,调用这个会导致一次遍历查询,并回调
	void OctreeTriggerPlayer::updateTrigger()
	{
		if(m_aabb.isNull())
			return;
		// 更新有向包围盒信息
		m_obb.setCenter(getPosition());
		m_obb.setExtents(getBoundingBox().getHalfSize() * getScale());
		m_obb.setOrientation(getOrientation());

		m_query->setBox(getWorldBoundingBox(true));
		SceneQueryResult& result = m_query->execute();

		// 现在发生了碰撞的列表
		MapCollideTriggerEntity mapCollideTriggerEntity;

		// 遍历结果
		for(SceneQueryResultMovableList::iterator iter = result.movables.begin() ; iter != result.movables.end() ; iter ++)
		{
			// 先转换成ITriggerEntity
			ITriggerEntity *entity = trigger_cast((*iter)->getUserAny());
			if(entity)
			{
				// 做碰撞计算,如果发生碰撞了
				if(entity->collide(this))
				{				
					// 添加进去
					mapCollideTriggerEntity[entity->getName()] = entity;
				}
			}
		}

		// 遍历发生碰撞的结果
		for(MapCollideTriggerEntity::iterator iter = mapCollideTriggerEntity.begin() ; iter != mapCollideTriggerEntity.end() ; iter ++)
		{
			// 如果不在里面,就说明进去了
			if(m_mapCollideTriggerEntity.find(iter->second->getName()) == m_mapCollideTriggerEntity.end())
			{
				// 回调到玩家
				const ITriggerPlayer::ListListener &listPlayer = getListenerList();
				for(size_t i = 0 ; i < listPlayer.size() ; i ++)
				{
					listPlayer[i]->onEnter(iter->second , this);
				}
				// 回调到触发器
				const ITriggerEntity::ListListener &listEntity = iter->second->getListenerList();
				for(size_t i = 0 ; i < listEntity.size() ; i ++)
				{
					listEntity[i]->onEnter(iter->second , this);
				}
				// 回调到世界
				const ITriggerWorld::ListListener &listWorld = m_world->getListenerList();
				for(size_t i = 0 ; i < listWorld.size() ; i ++)
				{
					listWorld[i]->onEnter(iter->second , this);
				}
			}
		}

		// 遍历未发生碰撞的结果
		for(MapCollideTriggerEntity::iterator iter = m_mapCollideTriggerEntity.begin() ; iter != m_mapCollideTriggerEntity.end() ; iter ++)
		{
			// 如果不在里面,就说明出去了
			if(mapCollideTriggerEntity.find(iter->second->getName()) == mapCollideTriggerEntity.end())
			{
				// 回调到玩家
				const ITriggerPlayer::ListListener &listPlayer = getListenerList();
				for(size_t i = 0 ; i < listPlayer.size() ; i ++)
				{
					listPlayer[i]->onLeave(iter->second , this);
				}
				// 回调到触发器
				const ITriggerEntity::ListListener &listEntity = iter->second->getListenerList();
				for(size_t i = 0 ; i < listEntity.size() ; i ++)
				{
					listEntity[i]->onLeave(iter->second , this);
				}
				// 回调到世界
				const ITriggerWorld::ListListener &listWorld = m_world->getListenerList();
				for(size_t i = 0 ; i < listWorld.size() ; i ++)
				{
					listWorld[i]->onLeave(iter->second , this);
				}
			}
		}

		// 保存新的结果
		m_mapCollideTriggerEntity = mapCollideTriggerEntity;
	}
Ejemplo n.º 30
0
void Spaceship::Draw(sf::RenderTarget& target, sf::RenderStates states, float alpha)
{
	//Create interpolated transform from last transform to current transform
	sf::Transform tt = RenderMath::InterpolateTransforms(lastPosition, getPosition(), lastAngle, getRotation(), getScale(),getScale(), alpha);

	states.transform.combine(tt);
	target.draw(*tPart, states); 
	target.draw(mSprite, states);	
	lastAngle = getRotation();
	lastPosition = getPosition();

}