MyCurry/src/gamelib/character.hpp

55 lines
1.6 KiB
C++

/*
Copyright 2016, 2017 Michele "King_DuckZ" Santullo
This file is part of MyCurry.
MyCurry 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.
MyCurry 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 MyCurry. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "vector.hpp"
#include "rect.hpp"
#include "world_moveable.hpp"
#include "drawable.hpp"
#include "collider.hpp"
namespace cloonel {
class SDLMain;
class InputBag;
} //namespace cloonel
namespace curry {
class WorldGrid;
class Character : public Drawable, public WorldMoveable {
public:
Character (cloonel::InputBag* parInputBag, const WorldSizeNotifiable::DeferredRegister& parDeferredRegister);
virtual ~Character() noexcept = default;
Rect<float> destination_rect (const vec2f& parWorldPos) const;
Rect<float> source_rect() const;
virtual void do_movement (float parDeltaT) override;
void set_speed (float parSpeed);
virtual void draw (DrawingQueue& parDQ, const WorldViewport& parViewport) override;
private:
virtual void on_texture_size_changed (const vec2f& parOldSz, const vec2f& parNewSz) override;
cloonel::InputBag* m_input_bag;
Collider m_collider;
float m_speed;
};
} //namespace curry