57 lines
1.6 KiB
C++
57 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 "safe_ptr.hh"
|
|
#include "vector.hpp"
|
|
#include <vector>
|
|
|
|
namespace cloonel {
|
|
class SDLMain;
|
|
} //namespace cloonel
|
|
|
|
namespace curry {
|
|
template <typename T> class SafeStackObject;
|
|
class Texture;
|
|
class DrawingQueue;
|
|
class WorldViewport;
|
|
|
|
class Drawable {
|
|
public:
|
|
Drawable();
|
|
virtual ~Drawable() noexcept;
|
|
|
|
size_t add_texture (const char* parTexturePath, cloonel::SDLMain& parSDLMain);
|
|
size_t add_texture (const vec2f& parSize, cloonel::SDLMain& parSDLMain);
|
|
|
|
void unload_textures() noexcept;
|
|
const vec2f& width_height() const;
|
|
Kakoune::SafePtr<Texture>& texture();
|
|
virtual void draw ( DrawingQueue& parDQ, const WorldViewport& parViewport ) = 0;
|
|
|
|
private:
|
|
size_t store_new_texture (SafeStackObject<Texture>&& parNewTexture);
|
|
virtual void on_texture_size_changed (const vec2f& parOldSz, const vec2f& parNewSz);
|
|
|
|
std::vector<SafeStackObject<Texture>> m_textures;
|
|
vec2f m_width_height;
|
|
};
|
|
} //namespace curry
|