editor/toolkit/brush.hpp

Go to the documentation of this file.
00001 /* $Id: brush.hpp 53571 2012-03-20 20:24:19Z fendrin $ */
00002 /*
00003    Copyright (C) 2008 - 2012 by Tomasz Sniatowski <kailoran@gmail.com>
00004    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY.
00012 
00013    See the COPYING file for more details.
00014 */
00015 
00016 #ifndef EDITOR_BRUSH_HPP_INCLUDED
00017 #define EDITOR_BRUSH_HPP_INCLUDED
00018 
00019 #include "../map/editor_map.hpp"
00020 
00021 namespace editor {
00022 
00023 /**
00024  * The brush class represents a single brush -- a set of relative locations around a "hotspot",
00025  * and related info such as the icon image. It is constructed from WML -- the [brush] tag.
00026  */
00027 class brush
00028 {
00029 public:
00030     /**
00031      * Construct a default (empty) brush. Note that not even the hotspot is affected by default,
00032      */
00033     brush();
00034 
00035     /**
00036      * Construct a brush object from config
00037      */
00038     explicit brush(const config& cfg);
00039 
00040     /**
00041      * Add a location to the brush. If it already exists nothing will change.
00042      */
00043     void add_relative_location(int relative_x, int relative_y);
00044 
00045     /**
00046      * Get a set of locations affected (i.e. under the brush) when the center (hotspot)
00047      * is in given location
00048      */
00049     std::set<map_location> project(const map_location& hotspot) const;
00050 
00051     /**
00052      * @return the name of this brush
00053      */
00054     const std::string name() const { return name_; }
00055 
00056     /**
00057      * @return the image of this brush
00058      */
00059     const std::string image() const { return image_; }
00060 
00061 protected:
00062     /**
00063      * The relative locations of the brush
00064      */
00065     std::set<map_location> relative_tiles_;
00066 
00067     std::string name_;
00068     std::string image_;
00069 };
00070 
00071 
00072 } //end namespace editor
00073 
00074 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Wed May 23 2012 01:02:37 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs