Draw and move the texture.
Display the test texture and move it on a line. The program is unresponsive to events and quits automatically after 15 seconnds.
This commit is contained in:
parent
a8f8d50129
commit
fb92097419
7 changed files with 50 additions and 10 deletions
|
@ -42,12 +42,15 @@ 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);
|
||||
}
|
||||
|
||||
///------------------------------------------------------------------------
|
||||
///------------------------------------------------------------------------
|
||||
void Texture::Render() {
|
||||
void Texture::Render (int parX, int parY) {
|
||||
assert(IsLoaded());
|
||||
SDL_RenderCopy(m_sdlmain->GetRenderer(), m_texture, nullptr, nullptr);
|
||||
const SDL_Rect dest = { parX, parY, m_width, m_height };
|
||||
SDL_RenderCopy(m_sdlmain->GetRenderer(), m_texture, nullptr, &dest);
|
||||
}
|
||||
} //namespace cloonel
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue