Author: ilor
Date: Wed Jul 2 18:47:00 2008
New Revision: 27662
URL: http://svn.gna.org/viewcvs/wesnoth?rev=27662&view=rev
Log:
editor2 file stubs -- some do not compile which is not a problem since they're
not used yet.
Added:
trunk/src/editor2/editor_controller.cpp (with props)
trunk/src/editor2/editor_controller.hpp (with props)
trunk/src/editor2/editor_display.cpp (with props)
trunk/src/editor2/editor_display.hpp (with props)
trunk/src/editor2/editor_map.cpp (with props)
trunk/src/editor2/editor_map.hpp (with props)
Modified:
trunk/src/editor2/action.hpp
Modified: trunk/src/editor2/action.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/action.hpp?rev=27662&r1=27661&r2=27662&view=diff
==============================================================================
--- trunk/src/editor2/action.hpp (original)
+++ trunk/src/editor2/action.hpp Wed Jul 2 18:47:00 2008
@@ -19,14 +19,12 @@
#define EDITOR2_ACTION_HPP
#include "action_base.hpp"
+#include "editor_map.hpp"
#include "../map.hpp"
#include "../terrain.hpp"
+
namespace editor2 {
-
-class editor_map : public gamemap
-{
-};
class brush
{
Added: trunk/src/editor2/editor_controller.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_controller.cpp?rev=27662&view=auto
==============================================================================
--- trunk/src/editor2/editor_controller.cpp (added)
+++ trunk/src/editor2/editor_controller.cpp Wed Jul 2 18:47:00 2008
@@ -1,0 +1,127 @@
+/*
+ Copyright (C) 2008 by Tomasz Sniatowski <[EMAIL PROTECTED]>
+ Part of the Battle for Wesnoth Project http://www.wesnoth.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ or at your option any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY.
+
+ See the COPYING file for more details.
+*/
+
+#include "editor_controller.hpp"
+#include "editor_display.hpp"
+#include "../preferences.hpp"
+
+#include "SDL.h"
+
+namespace editor2 {
+
+editor_controller::editor_controller(const config &game_config, CVideo& video)
+: game_config_(game_config), gui_(NULL)
+{
+ gui_.invalidate_game_status();
+ gui_.invalidate_all();
+ gui_.draw();
+ events::raise_draw_event();
+// redraw_everything();
+}
+
+editor_controller::init_gui(CVideo& video)
+{
+ const config* theme_cfg = get_theme(game_config_, "editor2");
+ const config theme = theme_cfg ? theme_cfg : config();
+ gui_ = new editor_display(video, map_, theme, game_config_, config());
+}
+
+editor_controller::~editor_controller()
+{
+ delete gui_;
+}
+
+void editor_controller::main_loop()
+{
+ for(;;) {
+ int mousex, mousey;
+ const int scroll_speed = preferences::scroll_speed();
+ Uint8 mouse_flags = SDL_GetMouseState(&mousex,&mousey);
+ const bool l_button_down = (0 != (mouse_flags &
SDL_BUTTON_LMASK));
+ const bool r_button_down = (0 != (mouse_flags &
SDL_BUTTON_RMASK));
+ const bool m_button_down = (0 != (mouse_flags &
SDL_BUTTON_MMASK));
+
+ const gamemap::location cur_hex =
gui_.hex_clicked_on(mousex,mousey);
+ const theme::menu* const m = gui_.menu_pressed();
+ if (m != NULL) {
+ const SDL_Rect& menu_loc =
m->location(gui_.screen_area());
+ const int x = menu_loc.x + 1;
+ const int y = menu_loc.y + menu_loc.h + 1;
+// show_menu(m->items(), x, y, false);
+ }
+
+ if(key_[SDLK_UP] || mousey == 0) {
+ gui_.scroll(0,-scroll_speed);
+ }
+ if(key_[SDLK_DOWN] || mousey == gui_.h()-1) {
+ gui_.scroll(0,scroll_speed);
+ }
+ if(key_[SDLK_LEFT] || mousex == 0) {
+ gui_.scroll(-scroll_speed,0);
+ }
+ if(key_[SDLK_RIGHT] || mousex == gui_.w()-1) {
+ gui_.scroll(scroll_speed,0);
+ }
+
+ if (l_button_down) {
+// left_button_down(mousex, mousey);
+ }
+ else {
+// if (l_button_held_func_ == MOVE_SELECTION) {
+ // When it is detected that the mouse is no
longer down
+ // and we are in the progress of moving a
selection,
+ // perform the movement.
+// perform_selection_move();
+// }
+ }
+ if (r_button_down) {
+// right_button_down(mousex, mousey);
+ }
+ if (m_button_down) {
+// middle_button_down(mousex, mousey);
+ }
+
+ gui_.draw(true, true);
+ events::raise_draw_event();
+
+ // When the map has changed, wait until the left mouse button
+ // is not held down, and then update the minimap and
+ // the starting position labels.
+// if (map_dirty_) {
+// if (!l_button_down && !r_button_down) {
+// if (auto_update_) {
+// gui_.rebuild_all();
+// gui_.invalidate_all();
+// map_dirty_ = false;
+// }
+ //gui_.recalculate_minimap();
+// recalculate_starting_pos_labels();
+// }
+// }
+ gui_.update_display();
+ SDL_Delay(20);
+ events::pump();
+// if (everything_dirty_) {
+// redraw_everything();
+// everything_dirty_ = false;
+// }
+// if (abort_ == ABORT_NORMALLY) {
+// if (!confirm_exit_and_save()) {
+// set_abort(DONT_ABORT);
+// }
+// }
+// mouse_moved_ = false;
+ }
+}
+
+} //end namespace editor2
Propchange: trunk/src/editor2/editor_controller.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/src/editor2/editor_controller.cpp
------------------------------------------------------------------------------
svn:keywords = 'Author Date Id Revision'
Added: trunk/src/editor2/editor_controller.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_controller.hpp?rev=27662&view=auto
==============================================================================
--- trunk/src/editor2/editor_controller.hpp (added)
+++ trunk/src/editor2/editor_controller.hpp Wed Jul 2 18:47:00 2008
@@ -1,0 +1,51 @@
+/*
+ Copyright (C) 2008 by Tomasz Sniatowski <[EMAIL PROTECTED]>
+ Part of the Battle for Wesnoth Project http://www.wesnoth.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ or at your option any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY.
+
+ See the COPYING file for more details.
+*/
+
+#ifndef EDITOR2_EDITOR_CONTROLLER_HPP_INCLUDED
+#define EDITOR2_EDITOR_CONTROLLER_HPP_INCLUDED
+
+#include "editor_common.hpp"
+
+#include <boost/utility.hpp>
+
+#include "../key.hpp"
+#include "../config.hpp"
+#include "../events.hpp"
+#include "../hotkeys.hpp"
+
+namespace editor2 {
+
+class editor_controller : public events::handler, public
hotkey::command_executor,
+ private boost::noncopyable
+{
+ public:
+ editor_controller(const config &game_config, CVideo& video);
+ ~editor_controller();
+ void main_loop();
+ bool can_execute_command(hotkey::HOTKEY_COMMAND, int) const {}
+ void handle_event(const SDL_Event&){}
+ private:
+ /** cref to the main game config */
+ const config& game_config_;
+ /** The current map object */
+ editor_map map_;
+ /** The display object used and owned by the editor. Possibly
recreated when a new map is created */
+ editor_display* gui_;
+
+ CKey key_;
+ bool map_dirty_;
+};
+
+} //end namespace editor2
+
+#endif
Propchange: trunk/src/editor2/editor_controller.hpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/src/editor2/editor_controller.hpp
------------------------------------------------------------------------------
svn:keywords = 'Author Date Id Revision'
Added: trunk/src/editor2/editor_display.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_display.cpp?rev=27662&view=auto
==============================================================================
--- trunk/src/editor2/editor_display.cpp (added)
+++ trunk/src/editor2/editor_display.cpp Wed Jul 2 18:47:00 2008
@@ -1,0 +1,58 @@
+/*
+ Copyright (C) 2008 by Tomasz Sniatowski <[EMAIL PROTECTED]>
+ Part of the Battle for Wesnoth Project http://www.wesnoth.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ or at your option any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY.
+
+ See the COPYING file for more details.
+*/
+
+#include "editor_display.hpp"
+#include "editor_common.hpp"
+#include <cassert>
+
+namespace editor2 {
+
+editor_display::editor_display(CVideo& video, const gamemap& map,
+ const config& theme_cfg, const config& cfg,
+ const config& level) :
+ display(video, map, theme_cfg, cfg, level)
+{
+ clear_screen();
+}
+
+void editor_display::pre_draw()
+{
+}
+
+image::TYPE editor_display::get_image_type(const gamemap::location& loc)
+{
+ if(loc == mouseoverHex_ && map_.on_board_with_border(mouseoverHex_)) {
+ return image::BRIGHTENED;
+ } else if (highlighted_locations_.find(loc) !=
highlighted_locations_.end()) {
+ return image::SEMI_BRIGHTENED;
+ }
+ return image::SCALED_TO_HEX;
+}
+
+const SDL_Rect& editor_display::get_clip_rect()
+{
+ return map_outside_area();
+}
+
+void editor_display::draw_sidebar()
+{
+ // Fill in the terrain report
+ if(map_.on_board_with_border(mouseoverHex_)) {
+ refresh_report(reports::TERRAIN,
reports::report(map_.get_terrain_string(mouseoverHex_);
+ refresh_report(reports::POSITION,
reports::report(lexical_cast<std::string>(mouseoverHex_);
+ }
+ refresh_report(reports::VILLAGES,
reports::report(lexical_cast<std::string>(map_.villages().size())));
+}
+
+
+} //end namespace editor2
Propchange: trunk/src/editor2/editor_display.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/src/editor2/editor_display.cpp
------------------------------------------------------------------------------
svn:keywords = 'Author Date Id Revision'
Added: trunk/src/editor2/editor_display.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_display.hpp?rev=27662&view=auto
==============================================================================
--- trunk/src/editor2/editor_display.hpp (added)
+++ trunk/src/editor2/editor_display.hpp Wed Jul 2 18:47:00 2008
@@ -1,0 +1,40 @@
+/*
+ Copyright (C) 2008 by Tomasz Sniatowski <[EMAIL PROTECTED]>
+ Part of the Battle for Wesnoth Project http://www.wesnoth.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ or at your option any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY.
+
+ See the COPYING file for more details.
+*/
+
+#ifndef EDITOR2_EDITOR_DISPLAY_HPP_INCLUDED
+#define EDITOR2_EDITOR_DISPLAY_HPP_INCLUDED
+
+#include "../display.hpp"
+
+namespace editor2 {
+
+class editor_display : public display
+{
+public:
+ editor_display(CVideo& video, const gamemap& map, const config&
theme_cfg,
+ const config& cfg, const config& level);
+
+ bool in_editor() const { return true; }
+
+protected:
+ void pre_draw();
+ /**
+ * The editor uses different rules for terrain highligting (e.g.
selections)
+ */
+ image::TYPE get_image_type(const gamemap::location& loc);
+ const SDL_Rect& get_clip_rect();
+ void draw_sidebar();
+};
+
+} //end namespace editor2
+#endif
Propchange: trunk/src/editor2/editor_display.hpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/src/editor2/editor_display.hpp
------------------------------------------------------------------------------
svn:keywords = 'Author Date Id Revision'
Added: trunk/src/editor2/editor_map.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_map.cpp?rev=27662&view=auto
==============================================================================
--- trunk/src/editor2/editor_map.cpp (added)
+++ trunk/src/editor2/editor_map.cpp Wed Jul 2 18:47:00 2008
@@ -1,0 +1,26 @@
+/* $Id$ */
+/*
+ Copyright (C) 2008 by Tomasz Sniatowski <[EMAIL PROTECTED]>
+ Part of the Battle for Wesnoth Project http://www.wesnoth.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ or at your option any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY.
+
+ See the COPYING file for more details.
+*/
+
+#include "editor_map.hpp"
+
+namespace editor2 {
+
+editor_map::editor_map(const config& terrain_cfg, const std::string& data)
+: gamemap(terrain_cfg, data)
+{
+}
+
+
+
+} //end namespace editor2
Propchange: trunk/src/editor2/editor_map.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/src/editor2/editor_map.cpp
------------------------------------------------------------------------------
svn:keywords = 'Author Date Id Revision'
Added: trunk/src/editor2/editor_map.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_map.hpp?rev=27662&view=auto
==============================================================================
--- trunk/src/editor2/editor_map.hpp (added)
+++ trunk/src/editor2/editor_map.hpp Wed Jul 2 18:47:00 2008
@@ -1,0 +1,35 @@
+/* $Id$ */
+/*
+ Copyright (C) 2008 by Tomasz Sniatowski <[EMAIL PROTECTED]>
+ Part of the Battle for Wesnoth Project http://www.wesnoth.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ or at your option any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY.
+
+ See the COPYING file for more details.
+*/
+
+#ifndef EDITOR2_EDITOR_MAP_HPP_INCLUDED
+#define EDITOR2_EDITOR_MAP_HPP_INCLUDED
+
+#include "../map.hpp"
+
+namespace editor2 {
+
+/**
+ * This class adds extra editor-specific functionality to a normal gamemap
+ */
+
+class editor_map : public gamemap
+{
+ editor_map(const config& terrain_cfg, const std::string& data);
+};
+
+
+} //end namespace editor2
+
+#endif
+
Propchange: trunk/src/editor2/editor_map.hpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/src/editor2/editor_map.hpp
------------------------------------------------------------------------------
svn:keywords = 'Author Date Id Revision'
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits