found in the game. Will be greatly improved later.legacy
| @@ -10,7 +10,7 @@ liblol_a_SOURCES = \ | |||||
| world.cpp world.h sample.cpp sample.h sampler.cpp sampler.h \ | world.cpp world.h sample.cpp sample.h sampler.cpp sampler.h \ | ||||
| text.cpp text.h emitter.cpp emitter.h numeric.h hash.cpp hash.h \ | text.cpp text.h emitter.cpp emitter.h numeric.h hash.cpp hash.h \ | ||||
| worldentity.cpp worldentity.h image.cpp image.h gradient.cpp gradient.h \ | worldentity.cpp worldentity.h image.cpp image.h gradient.cpp gradient.h \ | ||||
| platform.cpp platform.h \ | |||||
| platform.cpp platform.h sprite.cpp sprite.h \ | |||||
| \ | \ | ||||
| sdlapp.cpp sdlapp.h sdlinput.cpp sdlinput.h \ | sdlapp.cpp sdlapp.h sdlinput.cpp sdlinput.h \ | ||||
| \ | \ | ||||
| @@ -38,6 +38,7 @@ | |||||
| #include "font.h" | #include "font.h" | ||||
| #include "gradient.h" | #include "gradient.h" | ||||
| #include "sample.h" | #include "sample.h" | ||||
| #include "sprite.h" | |||||
| #include "text.h" | #include "text.h" | ||||
| #include "tileset.h" | #include "tileset.h" | ||||
| #include "world.h" | #include "world.h" | ||||
| @@ -0,0 +1,67 @@ | |||||
| // | |||||
| // Lol Engine | |||||
| // | |||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | |||||
| // modify it under the terms of the Do What The Fuck You Want To | |||||
| // Public License, Version 2, as published by Sam Hocevar. See | |||||
| // http://sam.zoy.org/projects/COPYING.WTFPL for more details. | |||||
| // | |||||
| #if defined HAVE_CONFIG_H | |||||
| # include "config.h" | |||||
| #endif | |||||
| #include "core.h" | |||||
| namespace lol | |||||
| { | |||||
| /* | |||||
| * Sprite implementation class | |||||
| */ | |||||
| class SpriteData | |||||
| { | |||||
| friend class Sprite; | |||||
| private: | |||||
| TileSet *tileset; | |||||
| vec3 pos; | |||||
| int id; | |||||
| }; | |||||
| /* | |||||
| * Public Sprite class | |||||
| */ | |||||
| Sprite::Sprite(TileSet *tileset, int id) | |||||
| : data(new SpriteData()) | |||||
| { | |||||
| data->tileset = tileset; | |||||
| data->pos = vec3(0); | |||||
| data->id = id; | |||||
| } | |||||
| void Sprite::TickGame(float deltams) | |||||
| { | |||||
| Entity::TickGame(deltams); | |||||
| } | |||||
| void Sprite::TickDraw(float deltams) | |||||
| { | |||||
| Entity::TickDraw(deltams); | |||||
| vec3i pos = (vec3i)data->pos; | |||||
| Scene::GetDefault()->AddTile(data->tileset, data->id, pos, 0); | |||||
| } | |||||
| Sprite::~Sprite() | |||||
| { | |||||
| Tiler::Deregister(data->tileset); | |||||
| delete data; | |||||
| } | |||||
| } /* namespace lol */ | |||||
| @@ -0,0 +1,44 @@ | |||||
| // | |||||
| // Lol Engine | |||||
| // | |||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | |||||
| // modify it under the terms of the Do What The Fuck You Want To | |||||
| // Public License, Version 2, as published by Sam Hocevar. See | |||||
| // http://sam.zoy.org/projects/COPYING.WTFPL for more details. | |||||
| // | |||||
| // | |||||
| // The Sprite class | |||||
| // ---------------- | |||||
| // | |||||
| #if !defined __LOL_SPRITE_H__ | |||||
| #define __LOL_SPRITE_H__ | |||||
| #include "worldentity.h" | |||||
| #include "tileset.h" | |||||
| namespace lol | |||||
| { | |||||
| class SpriteData; | |||||
| class Sprite : public WorldEntity | |||||
| { | |||||
| public: | |||||
| Sprite(TileSet *tileset, int id); | |||||
| virtual ~Sprite(); | |||||
| protected: | |||||
| virtual void TickGame(float deltams); | |||||
| virtual void TickDraw(float deltams); | |||||
| private: | |||||
| SpriteData *data; | |||||
| }; | |||||
| } /* namespace lol */ | |||||
| #endif // __LOL_SPRITE_H__ | |||||