X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fgameobjs.h;h=5ebbe07dfda7a12c81355e9158703dfbe70e3ff3;hb=875ef8eb7e93726bc67dfa7f05da946250e588d4;hp=103defa85d2197666a832fd36e2e4c5ec06db9aa;hpb=403f2652505e814b645892bffaf89a584984f9b8;p=supertux.git diff --git a/src/gameobjs.h b/src/gameobjs.h index 103defa85..5ebbe07df 100644 --- a/src/gameobjs.h +++ b/src/gameobjs.h @@ -22,104 +22,81 @@ #ifndef SUPERTUX_GAMEOBJS_H #define SUPERTUX_GAMEOBJS_H -#include "type.h" -#include "texture.h" +#include "video/surface.h" #include "timer.h" #include "scene.h" -#include "physic.h" +#include "math/physic.h" #include "collision.h" -#include "game_object.h" -#include "drawable.h" -#include "moving_object.h" -#include "lispwriter.h" +#include "special/game_object.h" +#include "special/moving_object.h" +#include "serializable.h" +#include "utils/lispwriter.h" /* Bounciness of distros: */ #define NO_BOUNCE 0 #define BOUNCE 1 -class BouncyDistro : public GameObject, public Drawable +namespace SuperTux { +class Sprite; +} + +class BouncyCoin : public GameObject { public: - BouncyDistro(DisplayManager& displaymanager, const Vector& pos); + BouncyCoin(const Vector& pos); + ~BouncyCoin(); virtual void action(float elapsed_time); - virtual void draw(ViewPort& viewport, int layer); - virtual std::string type() const - { return "BouncyDistro"; }; + virtual void draw(DrawingContext& context); private: + Sprite* sprite; Vector position; - float ym; + Timer2 timer; }; -extern Surface* img_distro[4]; - -#define BOUNCY_BRICK_MAX_OFFSET 8 -#define BOUNCY_BRICK_SPEED 0.9 - -class Tile; - -class BrokenBrick : public GameObject, public Drawable +class BrokenBrick : public GameObject { public: - BrokenBrick(DisplayManager& displaymanager, Tile* tile, - const Vector& pos, const Vector& movement); + BrokenBrick(Sprite* sprite, const Vector& pos, const Vector& movement); + ~BrokenBrick(); virtual void action(float elapsed_time); - virtual void draw(ViewPort& viewport, int layer); - - virtual std::string type() const - { return "BrokenBrick"; }; + virtual void draw(DrawingContext& context); private: - Timer timer; - Tile* tile; + Timer2 timer; + Sprite* sprite; Vector position; Vector movement; }; -class BouncyBrick : public GameObject, public Drawable +class FloatingText : public GameObject { public: - BouncyBrick(DisplayManager& displaymanager, const Vector& pos); - virtual void action(float elapsed_time); - virtual void draw(ViewPort& viewport, int layer); - - virtual std::string type() const - { return "BouncyBrick"; }; - -private: - Vector position; - float offset; - float offset_m; - int shape; -}; - -class FloatingScore : public GameObject, public Drawable -{ -public: - FloatingScore(DisplayManager& displaymanager, const Vector& pos, int s); + FloatingText(const Vector& pos, const std::string& text_); + FloatingText(const Vector& pos, int s); // use this for score, for instance virtual void action(float elapsed_time); - virtual void draw(ViewPort& viewport, int layer); - virtual std::string type() const - { return "FloatingScore"; }; + virtual void draw(DrawingContext& context); private: Vector position; - char str[10]; - Timer timer; + std::string text; + Timer2 timer; }; -class Trampoline : public MovingObject, public Drawable, public Serializable +#if 0 +extern Sprite *img_trampoline; + +class Trampoline : public MovingObject, public Serializable { public: - Trampoline(DisplayManager& displaymanager, LispReader& reader); + Trampoline(LispReader& reader); + Trampoline(float x, float y); virtual void write(LispWriter& writer); virtual void action(float frame_ratio); - virtual void draw(ViewPort& viewport, int layer); - virtual std::string type() const - { return "Trampoline"; }; + virtual void draw(DrawingContext& context); virtual void collision(const MovingObject& other, int); void collision(void *p_c_object, int c_object, CollisionType type); @@ -131,8 +108,52 @@ public: float power; unsigned int frame; }; +#endif + +extern Sprite *img_smoke_cloud; + +class SmokeCloud : public GameObject +{ +public: + SmokeCloud(const Vector& pos); + + virtual void action(float elapsed_time); + virtual void draw(DrawingContext& context); + +private: + Timer2 timer; + Vector position; +}; + +class Particles : public GameObject +{ +public: + Particles(const Vector& epicenter, int min_angle, int max_angle, + const Vector& initial_velocity, const Vector& acceleration, + int number, Color color, int size, float life_time, int drawing_layer); + ~Particles(); + + virtual void action(float elapsed_time); + virtual void draw(DrawingContext& context); + +private: + Vector accel; + Timer2 timer; + bool live_forever; + + Color color; + float size; + int drawing_layer; + + struct Particle { + Vector pos, vel; +// float angle; + }; + std::vector particles; +}; void load_object_gfx(); +void free_object_gfx(); #endif