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_CON_CONSOLE_GFX_HPP_INCLUDED 00022 #define SGE_CON_CONSOLE_GFX_HPP_INCLUDED 00023 00024 #include "../font/font.hpp" 00025 #include "../renderer/device.hpp" 00026 #include "../input/system.hpp" 00027 #include "../scoped_connection.hpp" 00028 #include "../sprite/system.hpp" 00029 #include "../sprite/object.hpp" 00030 #include "../time/timer.hpp" 00031 #include "../texture/part.hpp" 00032 #include "../string.hpp" 00033 #include "../export.hpp" 00034 #include "action_var.hpp" 00035 #include "arg_list.hpp" 00036 #include <boost/noncopyable.hpp> 00037 #include <deque> 00038 #include <cstddef> 00039 00040 namespace sge 00041 { 00042 namespace con 00043 { 00044 00045 class console_gfx : boost::noncopyable { 00046 public: 00047 SGE_SYMBOL console_gfx( 00048 renderer::device_ptr, 00049 texture::part_ptr, 00050 font::font_ptr, 00051 input::system_ptr, 00052 sprite::point const &, 00053 sprite::dim const &); 00054 SGE_SYMBOL void key_callback(const input::key_pair &); 00055 SGE_SYMBOL void key_action(const input::key_type &); 00056 SGE_SYMBOL void draw(); 00057 SGE_SYMBOL space_unit change_cursor_rate( 00058 const space_unit &n, 00059 const space_unit &); 00060 SGE_SYMBOL void toggle(); 00061 SGE_SYMBOL bool active() const; 00062 SGE_SYMBOL void print(const string &); 00063 SGE_SYMBOL void clear(const arg_list &); 00064 SGE_SYMBOL void dump(const arg_list &); 00065 00066 private: 00067 void tabcomplete(string &); 00068 00069 typedef std::deque<string> history_container; 00070 00071 const renderer::device_ptr rend; 00072 const font::font_ptr fn; 00073 scoped_connection ic,irc; 00074 sprite::system ss; 00075 sprite::object bg; 00076 bool active_; 00077 00078 // input and history stuff 00079 time::timer cursor_timer; 00080 action_var<space_unit>::type cursor_rate; 00081 bool cursor_active; 00082 string::value_type cursor_char; 00083 string il; 00084 string::size_type cursor_pos; 00085 history_container history; 00086 history_container input_history; 00087 history_container::iterator history_pos; 00088 history_container::iterator input_history_pos; 00089 std::size_t history_size; 00090 }; 00091 00092 } 00093 } 00094 00095 #endif
1.5.5