[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Windstille-devel] rev 364 - trunk/src
From: |
Ingo Ruhnke |
Subject: |
[Windstille-devel] rev 364 - trunk/src |
Date: |
Sat, 29 May 2004 21:16:53 +0200 |
Author: grumbel
Date: 2004-05-29 21:16:53 +0200 (Sat, 29 May 2004)
New Revision: 364
Removed:
trunk/src/tool_manager.cxx
trunk/src/tool_manager.hxx
Modified:
trunk/src/SConstruct
trunk/src/editor.cxx
trunk/src/editor.hxx
trunk/src/editor.py
trunk/src/editor_map_component.cxx
trunk/src/flexlay.i
trunk/src/tool.cxx
trunk/src/tool.hxx
trunk/src/workspace.cxx
trunk/src/workspace.hxx
Log:
- made tools available in the GUI
Modified: trunk/src/SConstruct
===================================================================
--- trunk/src/SConstruct 2004-05-29 18:53:43 UTC (rev 363)
+++ trunk/src/SConstruct 2004-05-29 19:16:53 UTC (rev 364)
@@ -109,7 +109,6 @@
'tilemap_layer.cxx',
'tileset.cxx',
'tool.cxx',
- 'tool_manager.cxx',
'workspace.cxx',
'window.cxx',
'viewport.cxx',
Modified: trunk/src/editor.cxx
===================================================================
--- trunk/src/editor.cxx 2004-05-29 18:53:43 UTC (rev 363)
+++ trunk/src/editor.cxx 2004-05-29 19:16:53 UTC (rev 364)
@@ -28,7 +28,6 @@
#include "editor_map.hxx"
#include "tile_selector.hxx"
#include "tile_editor.hxx"
-#include "tool_manager.hxx"
#include "globals.hxx"
Editor* Editor::current_ = 0;
@@ -38,12 +37,10 @@
current_ = this;
manager = new GUIManager();
- tool_manager = new ToolManager();
}
Editor::~Editor()
{
- delete tool_manager;
delete manager;
}
Modified: trunk/src/editor.hxx
===================================================================
--- trunk/src/editor.hxx 2004-05-29 18:53:43 UTC (rev 363)
+++ trunk/src/editor.hxx 2004-05-29 19:16:53 UTC (rev 364)
@@ -23,7 +23,6 @@
#include <vector>
class TileEditor;
-class ToolManager;
class EditorMap;
class GUIManager;
@@ -32,7 +31,6 @@
{
private:
GUIManager* manager;
- ToolManager* tool_manager;
static Editor* current_;
public:
@@ -41,7 +39,6 @@
Editor();
~Editor();
- ToolManager* get_tool_manager() const { return tool_manager; }
GUIManager* get_gui_manager() const { return manager; }
void run();
Modified: trunk/src/editor.py
===================================================================
--- trunk/src/editor.py 2004-05-29 18:53:43 UTC (rev 363)
+++ trunk/src/editor.py 2004-05-29 19:16:53 UTC (rev 364)
@@ -45,6 +45,14 @@
m = EditorMap()
workspace.set_map(m)
+# Tools
+tilemap_paint_tool = TileMapPaintTool()
+tilemap_select_tool = TileMapSelectTool()
+zoom_tool = ZoomTool()
+objmap_select_tool = ObjMapSelectTool()
+
+workspace.set_tool(tilemap_paint_tool.to_tool());
+
tileset = load_supertux_tiles()
tilemap = TilemapLayer(tileset, 200, 15)
m.add_layer(tilemap.to_layer())
@@ -129,13 +137,51 @@
connect(m.sig_change(), on_map_change)
+def set_tilemap_paint_tool():
+ workspace.set_tool(tilemap_paint_tool.to_tool())
+ paint.disable()
+ select.enable()
+ zoom.enable()
+ object.enable()
+
+def set_tilemap_select_tool():
+ workspace.set_tool(tilemap_select_tool.to_tool())
+ paint.enable()
+ select.disable()
+ zoom.enable()
+ object.enable()
+
+def set_zoom_tool():
+ workspace.set_tool(zoom_tool.to_tool())
+ paint.enable()
+ select.enable()
+ zoom.disable()
+ object.enable()
+
+def set_objmap_select_tool():
+ workspace.set_tool(objmap_select_tool.to_tool())
+ paint.enable()
+ select.enable()
+ zoom.enable()
+ object.disable()
+
toolbar = Panel(CL_Rect(CL_Point(0, 23+33), CL_Size(33, 256)),
gui.get_component())
-select = Icon(CL_Point(2, 32*0+2),
make_sprite("../data/images/tools/stock-tool-rect-select-22.png"), "Some
tooltip", toolbar);
-erase = Icon(CL_Point(2, 32+1+2),
make_sprite("../data/images/tools/stock-tool-eraser-22.png"), "Some tooltip",
toolbar);
-move = Icon(CL_Point(2, 32*2+2),
make_sprite("../data/images/tools/stock-tool-move-22.png"), "Some tooltip",
toolbar);
-paint = Icon(CL_Point(2, 32*3+2),
make_sprite("../data/images/tools/stock-tool-pencil-22.png"), "Some tooltip",
toolbar);
+paint = Icon(CL_Point(2, 32*0+2),
make_sprite("../data/images/tools/stock-tool-pencil-22.png"), "Some tooltip",
toolbar);
+paint.set_callback(set_tilemap_paint_tool)
+select = Icon(CL_Point(2, 32*1+2),
make_sprite("../data/images/tools/stock-tool-rect-select-22.png"), "Some
tooltip", toolbar);
+select.set_callback(set_tilemap_select_tool)
+
+zoom = Icon(CL_Point(2, 32*2+2),
make_sprite("../data/images/tools/stock-tool-zoom-22.png"), "Some tooltip",
toolbar);
+zoom.set_callback(set_zoom_tool)
+
+object = Icon(CL_Point(2, 32*3+2),
make_sprite("../data/images/tools/stock-tool-clone-22.png"), "Some tooltip",
toolbar);
+object.set_callback(set_objmap_select_tool)
+
+# erase = Icon(CL_Point(2, 32+1+2),
make_sprite("../data/images/tools/stock-tool-eraser-22.png"), "Some tooltip",
toolbar);
+# move = Icon(CL_Point(2, 32*2+2),
make_sprite("../data/images/tools/stock-tool-move-22.png"), "Some tooltip",
toolbar);
+
supertux = SuperTuxGUI(tileset, gui)
def block():
Modified: trunk/src/editor_map_component.cxx
===================================================================
--- trunk/src/editor_map_component.cxx 2004-05-29 18:53:43 UTC (rev 363)
+++ trunk/src/editor_map_component.cxx 2004-05-29 19:16:53 UTC (rev 364)
@@ -24,7 +24,6 @@
#include "tileset.hxx"
#include "editor_names.hxx"
#include "editor_map.hxx"
-#include "tool_manager.hxx"
#include "editor.hxx"
#include "workspace.hxx"
#include "scrollbar.hxx"
Modified: trunk/src/flexlay.i
===================================================================
--- trunk/src/flexlay.i 2004-05-29 18:53:43 UTC (rev 363)
+++ trunk/src/flexlay.i 2004-05-29 19:16:53 UTC (rev 364)
@@ -44,6 +44,11 @@
#include "menu.hxx"
#include "menubar.hxx"
#include "scrollbar.hxx"
+
+#include "tilemap_paint_tool.hxx"
+#include "tilemap_select_tool.hxx"
+#include "objmap_select_tool.hxx"
+#include "zoom_tool.hxx"
%}
%include "std_string.i"
@@ -88,5 +93,9 @@
%include "menubar.hxx"
%include "scrollbar.hxx"
-
+%include "tilemap_paint_tool.hxx"
+%include "tilemap_select_tool.hxx"
+%include "objmap_select_tool.hxx"
+%include "zoom_tool.hxx"
+
/* EOF */
Modified: trunk/src/tool.cxx
===================================================================
--- trunk/src/tool.cxx 2004-05-29 18:53:43 UTC (rev 363)
+++ trunk/src/tool.cxx 2004-05-29 19:16:53 UTC (rev 364)
@@ -20,6 +20,10 @@
#include "tool_impl.hxx"
#include "tool.hxx"
+Tool::Tool()
+{
+}
+
Tool::Tool(SharedPtr<ToolImpl> impl_)
: impl(impl_)
{
Modified: trunk/src/tool.hxx
===================================================================
--- trunk/src/tool.hxx 2004-05-29 18:53:43 UTC (rev 363)
+++ trunk/src/tool.hxx 2004-05-29 19:16:53 UTC (rev 364)
@@ -33,6 +33,7 @@
protected:
public:
+ Tool();
Tool(SharedPtr<ToolImpl> impl_);
~Tool();
Deleted: trunk/src/tool_manager.cxx
===================================================================
--- trunk/src/tool_manager.cxx 2004-05-29 18:53:43 UTC (rev 363)
+++ trunk/src/tool_manager.cxx 2004-05-29 19:16:53 UTC (rev 364)
@@ -1,75 +0,0 @@
-// $Id$
-//
-// Flexlay - A Generic 2D Game Editor
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <iostream>
-#include "tilemap_paint_tool.hxx"
-#include "tilemap_select_tool.hxx"
-#include "objmap_select_tool.hxx"
-#include "zoom_tool.hxx"
-#include "editor_map.hxx"
-#include "editor_names.hxx"
-#include "tool_manager.hxx"
-
-ToolManager::ToolManager()
-{
- // FIXME: move this to scripting too
- tools.push_back(TileMapPaintTool().to_tool());
- tools.push_back(TileMapSelectTool().to_tool());
- //tools.push_back(Tool()); //new TileMapDiamondTool());
- tools.push_back(ObjMapSelectTool().to_tool());
- tools.push_back(ZoomTool().to_tool());
-
- //tool = tools[0];
- tool = 0;
-}
-
-ToolManager::~ToolManager()
-{
-}
-
-void
-ToolManager::set_tool(int i)
-{
- if (i >= 0 && i < int(tools.size()))
- {
- if (tool != i)
- {
- on_tool_change();
- tool = i;
- }
- }
- else
- {
- std::cout << "Only have " << tools.size() << " tools, tool " << i << "
can't be selected." << std::endl;
- }
-}
-
-CL_Signal_v0&
-ToolManager::sig_tool_change()
-{
- return on_tool_change;
-}
-
-Tool
-ToolManager::current_tool()
-{
- return tools[tool];
-}
-
-/* EOF */
Deleted: trunk/src/tool_manager.hxx
===================================================================
--- trunk/src/tool_manager.hxx 2004-05-29 18:53:43 UTC (rev 363)
+++ trunk/src/tool_manager.hxx 2004-05-29 19:16:53 UTC (rev 364)
@@ -1,49 +0,0 @@
-// $Id$
-//
-// Flexlay - A Generic 2D Game Editor
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_TOOL_MANAGER_HXX
-#define HEADER_TOOL_MANAGER_HXX
-
-#include <vector>
-#include "tool.hxx"
-
-/** The ToolManager is a simple class which holds all available tools
- and keep track of which on is the currently selected one. */
-class ToolManager
-{
-private:
- typedef std::vector<Tool> Tools;
- Tools tools;
-
- int tool;
- CL_Signal_v0 on_tool_change;
-public:
- ToolManager();
- ~ToolManager();
-
- // random stuff
- void set_tool(int i);
- Tool current_tool();
-
- CL_Signal_v0& sig_tool_change();
-};
-
-#endif
-
-/* EOF */
Modified: trunk/src/workspace.cxx
===================================================================
--- trunk/src/workspace.cxx 2004-05-29 18:53:43 UTC (rev 363)
+++ trunk/src/workspace.cxx 2004-05-29 19:16:53 UTC (rev 364)
@@ -26,7 +26,6 @@
#include "editor_names.hxx"
#include "tool.hxx"
#include "tileset.hxx"
-#include "tool_manager.hxx"
#include "workspace.hxx"
Workspace Workspace::current_;
@@ -43,6 +42,8 @@
CL_Pointf old_trans_offset;
EditorMap editor_map;
+
+ Tool tool;
};
Workspace::Workspace()
@@ -70,7 +71,7 @@
impl->editor_map.draw(EditorMapComponent::current());
if (1) // has_mouse_over()) FIXME: Seperate cursor and state here
- Editor::current()->get_tool_manager()->current_tool().draw();
+ impl->tool.draw();
CL_Display::flush();
@@ -84,7 +85,7 @@
{
case CL_MOUSE_LEFT:
case CL_MOUSE_RIGHT:
- Editor::current()->get_tool_manager()->current_tool().on_mouse_up(event);
+ impl->tool.on_mouse_up(event);
break;
case CL_MOUSE_MIDDLE:
@@ -102,7 +103,7 @@
void
Workspace::mouse_move(const CL_InputEvent& event)
{
- Editor::current()->get_tool_manager()->current_tool().on_mouse_move(event);
+ impl->tool.on_mouse_move(event);
if (impl->scrolling)
{
@@ -120,7 +121,7 @@
{
case CL_MOUSE_LEFT:
case CL_MOUSE_RIGHT:
-
Editor::current()->get_tool_manager()->current_tool().on_mouse_down(event);
+ impl->tool.on_mouse_down(event);
break;
case CL_MOUSE_MIDDLE:
@@ -158,4 +159,10 @@
return impl->gc_state;
}
+void
+Workspace::set_tool(const Tool& tool)
+{
+ impl->tool = tool;
+}
+
/* EOF */
Modified: trunk/src/workspace.hxx
===================================================================
--- trunk/src/workspace.hxx 2004-05-29 18:53:43 UTC (rev 363)
+++ trunk/src/workspace.hxx 2004-05-29 19:16:53 UTC (rev 364)
@@ -26,6 +26,7 @@
class WorkspaceImpl;
class EditorMap;
+class Tool;
/** */
class Workspace
@@ -50,6 +51,7 @@
GraphicContextState& get_gc_state();
+ void set_tool(const Tool& tool);
private:
CL_SharedPtr<WorkspaceImpl> impl;
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Windstille-devel] rev 364 - trunk/src,
Ingo Ruhnke <=