Пример #1
0
	Block::Block(Rules& rules, const sf::Color& color, int health) : Entity(rules) {
		_highlight = false;
		_highlightPhase = 0.0f;

		_drop = false;
		_health = health;
		_decay = 1.0f;
		_rotation = 0.0f;
		_angularVelocity = 0.0f;

		_color = color;

		_blockSprite = ImageManager::Instance().CreateSprite("res/brick.png");
		_blockSprite.Resize(BLOCK_WIDTH, BLOCK_HEIGHT);
		_blockSprite.SetColor(_color);

		SetBBox(MATH::BBox2(MATH::Vector2(0.0f, 0.0f),
			MATH::Vector2(BLOCK_WIDTH, BLOCK_HEIGHT)));

		SetPhysicsModel(PHY_GHOST);
		SetCollisionModel(PHY_SOLID);

		SetAcceleration(1.0f);
		SetVelocity(MATH::Vector2(0.0f, 0.0f));
		SetMass(100000.0f);
	}
Пример #2
0
Player::Player(sf::Texture &tex):Image(tex) {
	objectIndex=1;
	direction=0;
	SetBBox(-gridSize/2-gridSize/32*2,-gridSize/2-gridSize/32*7,gridSize-gridSize/32*4,gridSize-gridSize/32*12);
	//SetBBox(-28,-24,56,48);
	AddSequence(0,0,0.25);
};
Пример #3
0
Player::Player(char* path):Image(path) {
	objectIndex=1;
	direction=0;
	SetBBox(-gridSize/2+gridSize/32*2,-gridSize/2+gridSize/32*7,gridSize-gridSize/32*4,gridSize-gridSize/32*12);
	//SetBBox(-28,-18,56,36);
	AddSequence(0,0,0.25);
};
Пример #4
0
Block::Block():Object() {
	SetBBox(-engine->gridSize/2,-engine->gridSize/2,engine->gridSize,engine->gridSize);
	//SetBBox(-32,-32,64,64);
	objectIndex=0;
	visible=false;
	solid=true;
};
Пример #5
0
Npc::Npc(sf::Texture* tex):Image(tex) {
	locked=true;
	direction=0;
	objectIndex=6;
	index=0;

	SetOrigin(imageWidth/2,imageHeight-11);

	SetBBox(-engine->gridSize/2+engine->gridSize/32*4,-engine->gridSize/2+engine->gridSize/32*8,
		engine->gridSize-engine->gridSize/32*8,engine->gridSize-engine->gridSize/32*15);

	AddSequence(0,0,0.25);
	AddSequence(5,5,0.25);
	AddSequence(10,10,0.25);
	AddSequence(15,15,0.25);

	AddSequence(1,4,0.2);
	AddSequence(6,9,0.2);
	AddSequence(11,14,0.2);
	AddSequence(16,19,0.2);

	SetSequence(0,1);

	sprShadow.setTexture(*engine->resourcesManager->GetTexture("sprShadow"),true);
	sprShadow.setOrigin(engine->resourcesManager->GetTexture("sprShadow")->getSize().x/2,
		engine->resourcesManager->GetTexture("sprShadow")->getSize().y/2-1*2);
};
Пример #6
0
	Ball::Ball(Rules& rules) : Entity(rules) {
		rules.numBalls++;

		_ignited = false;
		_dying = false;

		_scoreSound = SoundManager::Instance().GetSound("res/ding.wav", false);
		_bounceSound = SoundManager::Instance().GetSound("res/bounce.wav", false);

		_ballSprite = ImageManager::Instance().CreateSprite("res/ball3.png");
		_ballSprite.SetColor(sf::Color(232, 243, 255));
		_ballSprite.Resize(BALL_SIZE, BALL_SIZE);

		MATH::Vector2 randomVector(0, -1.0f);
		randomVector = MATH::Rotate(randomVector, sf::Randomizer::Random(-0.1f, 0.1f));
		randomVector = MATH::Normalize(randomVector);

		SetAcceleration(1.0f);
		SetVelocity(randomVector * 300.0f);
		SetMass(1.0f);

		SetPhysicsModel(PHY_TOUCHING | PHY_SOLID | PHY_BOUNCING);
		SetCollisionModel(PHY_SOLID);

		SetBBox(MATH::BBox2(MATH::Vector2(0.0f, 0.0f),
			MATH::Vector2(BALL_SIZE, BALL_SIZE)));
	}
Пример #7
0
	bool GetFeatureRequest::Create(rude::CGI& cgi, Map* pMap)
	{
		WebContext* pWebContext = augeGetWebContextInstance();
		char parameter[AUGE_NAME_MAX];

		SetVersion(cgi["version"]);

		//auge_web_parameter_encoding(, parameter, AUGE_NAME_MAX, pWebContext->IsIE());
		SetTypeName(cgi["typeName"],true);
		
		auge_web_parameter_encoding(cgi["sourceName"], parameter, AUGE_NAME_MAX, pWebContext->IsIE());
		SetSourceName(parameter);

		//auge_web_parameter_encoding(cgi["mapName"], parameter, AUGE_NAME_MAX, pWebContext->IsIE());
		SetMapName(cgi["mapName"], true);

		SetOutputFormat(cgi["outputFormat"]);
		SetMaxFeatures(cgi["maxFeatures"]);
		SetOffset(cgi["offset"]);
		SetBBox(cgi["bbox"]);

		SetEncoding(cgi["encoding"]);

		m_filter = cgi["filter"];
		m_fields = cgi["fields"];
		//if(!m_extent.IsValid())
		//{
		//	SetQuery(cgi["filter"],cgi["fields"], GetTypeName(), pMap);
		//}

		return true;
	}
Пример #8
0
void CMeshObj::SetMesh(CMesh* pMesh) {
	m_pMesh = pMesh;
	if (m_pMesh) {
		SetRadius(m_pMesh->GetRadius());
		SetCenter(m_pMesh->GetCenter());
		SetBBox(m_pMesh->GetBBox());
	}
}
Пример #9
0
Subcurve::Subcurve(const Subcurve &_scurve)
{
    m_islinear = _scurve.m_islinear;
    m_curve = _scurve.m_curve->Duplicate();
    m_t = _scurve.m_t;
    m_children[0] = m_children[1] = NULL;
    SetBBox(_scurve.m_node);
}
Пример #10
0
Usable::Usable():Object() {
	SetBBox(-gridSize/2+gridSize/32*2,-gridSize/2+gridSize/32*2,gridSize-gridSize/32*4,gridSize-gridSize/32*4);
	//SetBBox(-28,-28,56,56);
	objectIndex=2;
	functionIndex=0;
	function="none";
	text.setColor(sf::Color::Black);
	text.setCharacterSize(14);
	text.setFont(engine->font);
};
Пример #11
0
	bool GetCountRequest::Create(rude::CGI& cgi, Map* pMap)
	{
		SetVersion(cgi["version"]);
		SetTypeName(cgi["typeName"]);
		
		SetSourceName(cgi["sourceName"]);
		SetMapName(cgi["mapName"],true);

		SetBBox(cgi["bbox"]);
		m_filter = cgi["filter"];
		
		return true;
	}
	ExtraBallItem::ExtraBallItem(Rules& rules) : Entity(rules) {
		_itemSprite = ImageManager::Instance().CreateSprite("res/item_extraball.png");
		_itemSprite.Resize(ITEM_WIDTH, ITEM_HEIGHT);

		SetBBox(MATH::BBox2(MATH::Vector2(0.0f, 0.0f),
			MATH::Vector2(ITEM_WIDTH, ITEM_HEIGHT)));

		SetAcceleration(1.0f);
		SetVelocity(MATH::Vector2(0.0f, 1.0f) * 100.0f);
		SetMass(1.0f);

		SetPhysicsModel(PHY_TOUCHING | PHY_GHOST);
		SetCollisionModel(PHY_GHOST);
	}
Пример #13
0
void Worker::UpdateBBox() {

  // Calculate hit points bounding box
  //std::cerr << "Building hit points bounding box: ";

  BBox hitPointsbbox = BBox();

  for (unsigned int i = 0; i < engine->hitPointTotal; ++i) {
    HitPointPositionInfo *hp = GetHitPointInfo(i);

    if (hp->type == SURFACE)
      hitPointsbbox = Union(hitPointsbbox, hp->position);
  }
  SetBBox(hitPointsbbox);

}
Пример #14
0
Image::Image(sf::Texture &tex):Object() {
	texture=tex;
	imageWidth=texture.getSize().y;
	imageHeight=texture.getSize().y;
	imageSpeed=0.25;
	imageFrame=0;
	sprite.setTexture(texture);
	sprite.setTextureRect(sf::IntRect(0,0,imageWidth,imageHeight));
	firstFrame=0;
	lastFrame=3;
	seq=0;
	seqOld=-1;
	x=100;
	y=100;
	SetBBox(0,0,32,32);
	SetOrigin(imageWidth/2,imageHeight-8);
};
Пример #15
0
bool Image::Load(char* path) {
	texture.loadFromFile(path);
	imageWidth=texture.getSize().y;
	imageHeight=texture.getSize().y;
	imageSpeed=0.25;
	imageFrame=0;
	sprite.setTexture(texture);
	sprite.setTextureRect(sf::IntRect(0,0,imageWidth,imageHeight));
	firstFrame=0;
	lastFrame=3;
	seq=0;
	seqOld=-1;
	x=100;
	y=100;
	SetBBox(0,0,32,32);
	SetOrigin(imageWidth/2,imageHeight-8);
	return true;
};
Пример #16
0
svGlyph::svGlyph(svVector3 _lbbox, svVector3 _rbbox) 
            : svPrimitive(1)
{
  SetBBox(_lbbox, _rbbox);

  glyphPos = NULL;
  glyphColors = NULL;
  glyphWidth = NULL;
  glyphDir = NULL;
  glyphFrequency= DEFAULT_GLYPH_FREQUENCY;
/*
  infile = strdup(inf);

  glyph_radius = DEFAULT_GLYPH_RADIUS;
  glyph_height = DEFAULT_GLYPH_HEIGHT;
  glyph_section_num = DEFAULT_GLYPH_SECTION_NUM;
  tube_radius = glyph_radius * 0.5;
*/
  ENABLE_GLYPH_SCALE=false;
}
Пример #17
0
void IndexedFaceSet::ComputeBBox()
{
    real XMax = _Vertices[0];
    real YMax = _Vertices[1];
    real ZMax = _Vertices[2];

    real XMin = _Vertices[0];
    real YMin = _Vertices[1];
    real ZMin = _Vertices[2];

    // parse all the coordinates to find
    // the Xmax, YMax, ZMax
    real *v = _Vertices;

    for(unsigned i=0; i<_VSize/3; i++)
    {
        // X
        if(*v > XMax)
            XMax = *v;
        if(*v < XMin)
            XMin = *v;
        v++;

        if(*v > YMax)
            YMax = *v;
        if(*v < YMin)
            YMin = *v;
        v++;

        if(*v > ZMax)
            ZMax = *v;
        if(*v < ZMin)
            ZMin = *v;
        v++;
    }

    SetBBox(BBox<Vec3r>(Vec3r(XMin, YMin, ZMin), Vec3r(XMax, YMax, ZMax)));
}