clooneljump/src/character.cpp
2014-02-25 14:17:09 +01:00

69 lines
2.5 KiB
C++

/*
Copyright 2014 Michele "King_DuckZ" Santullo
This file is part of CloonelJump.
CloonelJump is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
CloonelJump is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with CloonelJump. If not, see <http://www.gnu.org/licenses/>.
*/
#include "character.hpp"
#include "sdlmain.hpp"
#include "texture.hpp"
namespace cloonel {
///-------------------------------------------------------------------------
///-------------------------------------------------------------------------
Character::Character (const std::string& parPath, SDLMain* parMain, ushort2 parSize) :
Placeable(float2(0.0f)),
Drawable(parSize),
m_texture(new Texture(parPath, parMain, false))
{
}
///-------------------------------------------------------------------------
///-------------------------------------------------------------------------
Character::Character (const std::string&& parPath, SDLMain* parMain, ushort2 parSize) :
Placeable(float2(0.0f)),
Drawable(parSize),
m_texture(new Texture(parPath, parMain, false))
{
}
///-------------------------------------------------------------------------
///-------------------------------------------------------------------------
Character::~Character() noexcept {
}
///-------------------------------------------------------------------------
///-------------------------------------------------------------------------
void Character::Prepare() {
const SDLMain* const sdlmain = m_texture->SDLObject();
const int2 screensize(sdlmain->DefWidthHeight());
m_texture->Reload();
}
///-------------------------------------------------------------------------
///-------------------------------------------------------------------------
void Character::Destroy() noexcept {
m_texture->Destroy();
}
///-------------------------------------------------------------------------
///-------------------------------------------------------------------------
void Character::Draw() const {
const int2 pos(GetPos() + 0.5f);
m_texture->Render(pos, m_wh);
}
} //namespace cloonel