00001 /* 00002 spacegameengine is a portable easy to use game engine written in C++. 00003 Copyright (C) 2006-2007 Carl Philipp Reh (sefi@s-e-f-i.de) 00004 00005 This program is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public License 00007 as published by the Free Software Foundation; either version 2 00008 of the License, or (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 */ 00019 00020 00021 #ifndef SGE_SPRITE_OBJECT_HPP_INCLUDED 00022 #define SGE_SPRITE_OBJECT_HPP_INCLUDED 00023 00024 #include "../export.hpp" 00025 #include "../math/rect.hpp" 00026 #include "../math/vector.hpp" 00027 #include "../math/dim.hpp" 00028 #include "../math/circle.hpp" 00029 #include "../texture/part.hpp" 00030 #include "../renderer/color.hpp" 00031 #include "types.hpp" 00032 #include <boost/optional.hpp> 00033 00034 namespace sge 00035 { 00036 namespace sprite 00037 { 00038 00039 SGE_SYMBOL extern const dim texture_dim; 00040 SGE_SYMBOL extern const texture::part_ptr no_texture; 00041 00042 namespace defaults 00043 { 00044 00045 SGE_SYMBOL extern const point pos_; 00046 SGE_SYMBOL extern const texture::part_ptr texture_; 00047 SGE_SYMBOL extern const dim dim_; 00048 SGE_SYMBOL extern const color color_; 00049 SGE_SYMBOL extern const depth_type depth_; 00050 SGE_SYMBOL extern const rotation_type rotation_; 00051 SGE_SYMBOL extern const bool visible_; 00052 00053 } 00054 00055 class object { 00056 public: 00057 SGE_SYMBOL object( 00058 boost::optional<point> = defaults::pos_, 00059 boost::optional<texture::part_ptr> = defaults::texture_, 00060 boost::optional<dim> = defaults::dim_, 00061 boost::optional<color> = defaults::color_, 00062 boost::optional<depth_type> = defaults::depth_, 00063 boost::optional<rotation_type> = defaults::rotation_, 00064 boost::optional<bool> visible = defaults::visible_); 00065 00066 SGE_SYMBOL unit& x(); 00067 SGE_SYMBOL unit& y(); 00068 SGE_SYMBOL point& pos(); 00069 SGE_SYMBOL unit& w(); 00070 SGE_SYMBOL unit& h(); 00071 SGE_SYMBOL dim& size(); 00072 SGE_SYMBOL depth_type& z(); 00073 SGE_SYMBOL void visible(bool visible); 00074 SGE_SYMBOL void set_texture(texture::part_ptr); 00075 SGE_SYMBOL void rotation(rotation_type rot); 00076 SGE_SYMBOL void rotate_around(point p); 00077 SGE_SYMBOL void rotate_around(); 00078 SGE_SYMBOL void repeat(repetition_type); 00079 SGE_SYMBOL void set_color(color c); 00080 SGE_SYMBOL void set_center(const point &); 00081 00082 SGE_SYMBOL const unit& x() const; 00083 SGE_SYMBOL const unit& y() const; 00084 SGE_SYMBOL const depth_type& z() const; 00085 SGE_SYMBOL const point& pos() const; 00086 SGE_SYMBOL const unit& w() const; 00087 SGE_SYMBOL const unit& h() const; 00088 SGE_SYMBOL const dim& size() const; 00089 SGE_SYMBOL bool visible() const; 00090 SGE_SYMBOL rect get_rect() const; 00091 SGE_SYMBOL point center() const; 00092 SGE_SYMBOL rotation_type rotation() const; 00093 SGE_SYMBOL space_unit radius() const; 00094 SGE_SYMBOL repetition_type repeat() const; 00095 SGE_SYMBOL color get_color() const; 00096 SGE_SYMBOL rect bounding_quad() const; 00097 SGE_SYMBOL math::circle bounding_circle() const; 00098 SGE_SYMBOL const point rotation_center() const; 00099 SGE_SYMBOL const texture::part_ptr get_texture() const; 00100 private: 00101 point pos_; 00102 dim size_; 00103 depth_type z_; 00104 rotation_type rotation_; 00105 texture::part_ptr tex; 00106 point rot_around_; 00107 repetition_type repeat_; 00108 color color_; 00109 bool visible_; 00110 bool use_rot_around; 00111 }; 00112 00113 } 00114 } 00115 00116 #endif
1.5.5