Use the new vector class wherever possible.
This commit is contained in:
parent
e2e932358b
commit
abee07a844
5 changed files with 18 additions and 16 deletions
|
@ -42,15 +42,18 @@ namespace cloonel {
|
|||
|
||||
m_texture = SDL_CreateTextureFromSurface(m_sdlmain->GetRenderer(), surf);
|
||||
SDL_FreeSurface(surf);
|
||||
if (m_texture)
|
||||
SDL_QueryTexture(m_texture, nullptr, nullptr, &m_width, &m_height);
|
||||
if (m_texture) {
|
||||
int width, height;
|
||||
SDL_QueryTexture(m_texture, nullptr, nullptr, &width, &height);
|
||||
m_size = int2(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
///------------------------------------------------------------------------
|
||||
///------------------------------------------------------------------------
|
||||
void Texture::Render (int parX, int parY) {
|
||||
void Texture::Render (const int2& parPos) {
|
||||
assert(IsLoaded());
|
||||
const SDL_Rect dest = { parX, parY, m_width, m_height };
|
||||
const SDL_Rect dest = { parPos.x(), parPos.y(), m_size.x(), m_size.y() };
|
||||
SDL_RenderCopy(m_sdlmain->GetRenderer(), m_texture, nullptr, &dest);
|
||||
}
|
||||
} //namespace cloonel
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue