src/sprite/sprite_data.hpp

Go to the documentation of this file.
00001 //  SuperTux
00002 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
00003 //
00004 //  This program is free software: you can redistribute it and/or modify
00005 //  it under the terms of the GNU General Public License as published by
00006 //  the Free Software Foundation, either version 3 of the License, or
00007 //  (at your option) any later version.
00008 //
00009 //  This program is distributed in the hope that it will be useful,
00010 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 //  GNU General Public License for more details.
00013 //
00014 //  You should have received a copy of the GNU General Public License
00015 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016 
00017 #ifndef HEADER_SUPERTUX_SPRITE_SPRITE_DATA_HPP
00018 #define HEADER_SUPERTUX_SPRITE_SPRITE_DATA_HPP
00019 
00020 #include <map>
00021 #include <vector>
00022 
00023 #include "util/reader_fwd.hpp"
00024 #include "video/surface.hpp"
00025 
00026 class SpriteData
00027 {
00028 public:
00030   SpriteData(const Reader& cur, const std::string& basedir);
00031   ~SpriteData();
00032 
00033   const std::string& get_name() const
00034   {
00035     return name;
00036   }
00037 
00038 private:
00039   friend class Sprite;
00040 
00041   struct Action
00042   {
00043     Action();
00044     ~Action();
00045 
00046     std::string name;
00047 
00049     float x_offset;
00050     float y_offset;
00051 
00053     float hitbox_w;
00054 
00056     float hitbox_h;
00057 
00059     int z_order;
00060 
00062     float fps;
00063 
00064     std::vector<SurfacePtr> surfaces;
00065   };
00066 
00067   typedef std::map <std::string, Action*> Actions;
00068 
00069   void parse_action(const Reader& lispreader, const std::string& basedir);
00071   const Action* get_action(const std::string act);
00072 
00073   Actions actions;
00074   std::string name;
00075 };
00076 
00077 #endif
00078 
00079 /* EOF */

Generated on Mon Jun 9 03:38:21 2014 for SuperTux by  doxygen 1.5.1