Support texture resizing.

This commit is contained in:
King_DuckZ 2014-02-22 12:25:16 +01:00
parent e2bd48ec90
commit 739b75b0b6
8 changed files with 29 additions and 14 deletions

View file

@ -5,16 +5,18 @@
namespace cloonel {
///-------------------------------------------------------------------------
///-------------------------------------------------------------------------
Character::Character (const std::string& parPath, SDLMain* parMain) :
Character::Character (const std::string& parPath, SDLMain* parMain, ushort2 parSize) :
Placeable(0.0f, 0.0f),
Drawable(parSize),
m_texture(new Texture(parPath, parMain, false))
{
}
///-------------------------------------------------------------------------
///-------------------------------------------------------------------------
Character::Character (const std::string&& parPath, SDLMain* parMain) :
Character::Character (const std::string&& parPath, SDLMain* parMain, ushort2 parSize) :
Placeable(0.0f, 0.0f),
Drawable(parSize),
m_texture(new Texture(parPath, parMain, false))
{
}
@ -27,6 +29,9 @@ namespace cloonel {
///-------------------------------------------------------------------------
///-------------------------------------------------------------------------
void Character::Prepare() {
const SDLMain* const sdlmain = m_texture->SDLObject();
const int2 screensize(sdlmain->DefWidthHeight());
m_texture->Reload();
}
@ -40,6 +45,6 @@ namespace cloonel {
///-------------------------------------------------------------------------
void Character::Draw() const {
const int2 pos(m_pos + 0.5f);
m_texture->Render(pos);
m_texture->Render(pos, m_wh);
}
} //namespace cloonel