cEntity::cEntity(float x, float y, float w, float h, float vx, float vy, float offx, float offy, float offw, float offh) :m_AnimFPS(10), m_AnimLooping(true) { m_Anim.SetTicksPerFrame((int) (1000.0f * (1.0f / m_AnimFPS))); m_Pos = Vec2f(x, y); m_Dim = Vec2f(w, h); m_Vel = Vec2f(vx, vy); m_BBox = cRectf(offx, offy, offw, offh); }
void cTileMap::RenderTileData(cTile *a_pTile, int a_lLayer) { static int count = 0; cTileDataNormal *pData = static_cast<cTileDataNormal*>(a_pTile->GetTileData()); if (pData==NULL) return; cRectf _obj = cRectf(a_pTile->GetPosition().x-m_fTileSize/2, a_pTile->GetPosition().y-m_fTileSize/2,m_fTileSize, m_fTileSize); cRenderObject2D _obj2 = cRenderObject2D(pData->GetMaterial(), pData->GetVertexVec(a_pTile->GetAngle()), pData->GetIndexVec(a_pTile->GetAngle()), ePrimitiveType_Quad, a_pTile->GetPosition().z, _obj, NULL, a_pTile->GetPositionPtr()); m_pGraphics->GetRenderer2D()->AddObject(_obj2); count++; }
static cRectf GetShiftedRect(const cRectf& r, const Vec2f& v) { return cRectf(v.x+r.Left(), v.y+r.Top(), r.Width(), r.Height()); }