2015-08-20 13:14:22 +00:00
|
|
|
/* Copyright 2015, Michele Santullo
|
|
|
|
* This file is part of "Jumping in D".
|
|
|
|
*
|
|
|
|
* "Jumping in D" 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.
|
|
|
|
*
|
|
|
|
* "Jumping in D" 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 "Jumping in D". If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
module gameobj;
|
2015-09-16 12:56:36 +00:00
|
|
|
import derelict.sdl2.sdl;
|
2015-08-20 13:14:22 +00:00
|
|
|
|
2015-08-20 15:58:35 +00:00
|
|
|
interface GameObj {
|
|
|
|
void prepare();
|
|
|
|
void destroy();
|
|
|
|
void exec();
|
|
|
|
bool wants_to_quit() const;
|
2015-08-20 13:14:22 +00:00
|
|
|
}
|
2015-09-16 12:56:36 +00:00
|
|
|
|
|
|
|
class GameObjBase : GameObj {
|
|
|
|
public:
|
|
|
|
this (SDL_Renderer* parRenderer) {
|
|
|
|
m_renderer = parRenderer;
|
|
|
|
assert(m_renderer);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
SDL_Renderer* renderer() {
|
|
|
|
return m_renderer;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
SDL_Renderer* m_renderer;
|
|
|
|
}
|