00001 /* $Id: halo.hpp 52533 2012-01-07 02:35:17Z shadowmaster $ */ 00002 /* 00003 Copyright (C) 2003 - 2012 by David White <dave@whitevine.net> 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 /** @file */ 00017 00018 #ifndef HALO_HPP_INCLUDED 00019 #define HALO_HPP_INCLUDED 00020 00021 class display; 00022 00023 #include "map_location.hpp" 00024 00025 namespace halo 00026 { 00027 00028 struct manager 00029 { 00030 manager(display& disp); 00031 ~manager(); 00032 00033 private: 00034 display* const old; 00035 }; 00036 00037 enum ORIENTATION { NORMAL, HREVERSE, VREVERSE, HVREVERSE }; 00038 const int NO_HALO = 0; 00039 00040 /** 00041 * Add a haloing effect using 'image centered on (x,y). 00042 * @return The handle to the halo object. 00043 * @retval 0 is the invalid handle. 00044 00045 * If the halo is attached to an item, it needs to be hidden if the 00046 * shroud is active. (Note it will be shown with the fog active.) 00047 * If it is not attached to an item, the location should be set to -1, -1 00048 */ 00049 int add(int x, int y, const std::string& image, const map_location& loc, 00050 ORIENTATION orientation=NORMAL, bool infinite=true); 00051 00052 /** Set the position of an existing haloing effect, according to its handle. */ 00053 void set_location(int handle, int x, int y); 00054 00055 /** Remove the halo with the given handle. */ 00056 void remove(int handle); 00057 00058 struct remover 00059 { 00060 void operator()(int handle) const { remove(handle); } 00061 }; 00062 00063 /** 00064 * Render and unrender haloes. 00065 * 00066 * Which haloes are rendered is determined by invalidated_locations and the 00067 * internal state in the control sets (in halo.cpp). 00068 */ 00069 void unrender(std::set<map_location> invalidated_locations); 00070 void render(); 00071 00072 } // end namespace halo 00073 00074 #endif
| Generated by doxygen 1.7.1 on Fri May 25 2012 01:03:00 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |