예제 #1
0
GameObject::GameObject(Entity* parent, const PropertySet& properties)
: Entity(parent, 0, properties)
, m_name(properties.hasProperty("name") ? properties["name"].get<std::string>() : "")
, m_position(vec2(properties["positionX"].get<float>(), properties["positionY"].get<float>()))
//, m_offset(vec2(properties["offsetX"].get<float>(), properties["offsetY"].get<float>()))
, m_topLeft(0.0f)
, m_bottomRight(0.0f)
, m_rotation(properties["rotation"].get<float>())
, m_size(vec2(properties["sizeX"].get<float>(), properties["sizeY"].get<float>()))
, m_tileScale(1.0f)
{
	recalcExtens();
}
예제 #2
0
GameObject::GameObject(int type, const vec2& position, const vec2& size, const std::string& name )
: m_name(name)
, m_position(position)
, m_offset(0)
, m_topLeft(0.0f)
, m_bottomRight(0.0f)
, m_rotation(0.0f)
, m_size(size)
, m_tileScale(1.0f)
, m_type(type)
{
	recalcExtens();
}
예제 #3
0
GameObject::GameObject(Entity* parent, int type, const vec2& position, const vec2& size, const std::string& name)
: Entity( parent, 0, Entity::getDefaultProperties() )
, m_name(name)
, m_position(position)
//, m_offset(0.0f)
, m_topLeft(0.0f)
, m_bottomRight(0.0f)
, m_rotation(0.0f)
, m_size(size)
, m_tileScale(1.0f)
{
	recalcExtens();
	(void)type; // Not needed. TODO: Remove someday
}
예제 #4
0
void GameObject::setPosition( const vec2& position )
{
	m_position = position; 
	recalcExtens();
} 
예제 #5
0
void GameObject::setTileSize(const vec2& tileSize )
{
	m_tileScale.x  = 1.0f / tileSize.x;
	m_tileScale.y  = 1.0f / tileSize.y;
	recalcExtens();
}
예제 #6
0
void GameObject::setSize( const vec2& size ) 
{ 
	assert(size.x >= 0.0f && size.y >= 0.0f); 
	m_size = size; 
	recalcExtens(); 
}