[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Windstille-devel] rev 387 - in trunk: . src
From: |
Ingo Ruhnke |
Subject: |
[Windstille-devel] rev 387 - in trunk: . src |
Date: |
Fri, 04 Jun 2004 00:41:47 +0200 |
Author: grumbel
Date: 2004-06-04 00:41:47 +0200 (Fri, 04 Jun 2004)
New Revision: 387
Added:
trunk/src/workspace_move_tool.cxx
trunk/src/workspace_move_tool.hxx
Modified:
trunk/NEWS
trunk/configure.ac
trunk/src/SConstruct
trunk/src/supertux.py
trunk/src/workspace.cxx
Log:
- some more news
- seperated move tool into its own class
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2004-06-03 18:56:46 UTC (rev 386)
+++ trunk/NEWS 2004-06-03 22:41:47 UTC (rev 387)
@@ -2,6 +2,11 @@
=============
- switched build system from autohell to SCons
- switching scripting language to Python
+ - restructured the scripting bindings
+ - C++ object hierachy now completly available in scripting
+ - major GUI cleanup
+ - a toolbar
+ - splitted flexlay into a C++ library and a python module
Flexlay 0.0.1
==============
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2004-06-03 18:56:46 UTC (rev 386)
+++ trunk/configure.ac 2004-06-03 22:41:47 UTC (rev 387)
@@ -1,4 +1,4 @@
-AC_INIT(Flexlay, 0.0.3)
+AC_INIT(Flexlay, 0.0.2)
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([src/editor_main.cxx])
AM_INIT_AUTOMAKE(dist-bzip2)
Modified: trunk/src/SConstruct
===================================================================
--- trunk/src/SConstruct 2004-06-03 18:56:46 UTC (rev 386)
+++ trunk/src/SConstruct 2004-06-03 22:41:47 UTC (rev 387)
@@ -113,6 +113,7 @@
'tilemap_select_tool.cxx',
'tilemap_layer.cxx',
'tileset.cxx',
+ 'workspace_move_tool.cxx',
'tool.cxx',
'workspace.cxx',
'window.cxx',
Modified: trunk/src/supertux.py
===================================================================
--- trunk/src/supertux.py 2004-06-03 18:56:46 UTC (rev 386)
+++ trunk/src/supertux.py 2004-06-03 22:41:47 UTC (rev 387)
@@ -724,6 +724,7 @@
gui_show_current()
set_tilemap_paint_tool()
+connect(editor_map.sig_on_key("f1"), lambda: gui_toggle_minimap())
connect(editor_map.sig_on_key("m"), lambda: gui_toggle_minimap())
connect(editor_map.sig_on_key("g"), lambda: gui_toggle_grid())
connect(editor_map.sig_on_key("4"), lambda: gui_toggle_display_props())
Modified: trunk/src/workspace.cxx
===================================================================
--- trunk/src/workspace.cxx 2004-06-03 18:56:46 UTC (rev 386)
+++ trunk/src/workspace.cxx 2004-06-03 22:41:47 UTC (rev 387)
@@ -25,6 +25,7 @@
#include "editor_map_component.hxx"
#include "editor_names.hxx"
#include "tool.hxx"
+#include "workspace_move_tool.hxx"
#include "tileset.hxx"
#include "workspace.hxx"
@@ -44,6 +45,7 @@
EditorMap editor_map;
Tool tool;
+ Tool move_tool;
};
Workspace::Workspace()
@@ -54,11 +56,9 @@
: impl(new WorkspaceImpl())
{
current_ = *this;
-
+
+ impl->move_tool = WorkspaceMoveTool(*this).to_tool();
impl->gc_state = GraphicContextState(w, h);
- impl->scrolling = false;
- impl->click_pos = CL_Point(0, 0);
- impl->old_trans_offset = CL_Pointf(0,0);
}
void
@@ -89,13 +89,7 @@
break;
case CL_MOUSE_MIDDLE:
- impl->scrolling = false;
- impl->gc_state.set_pos(CL_Pointf(impl->old_trans_offset.x
- + (impl->click_pos.x -
event.mouse_pos.x) / impl->gc_state.get_zoom(),
- impl->old_trans_offset.y
- + (impl->click_pos.y -
event.mouse_pos.y) / impl->gc_state.get_zoom()));
- impl->old_trans_offset = impl->gc_state.get_pos();
- EditorMapComponent::current()->release_mouse();
+ impl->move_tool.on_mouse_up(event);
break;
}
}
@@ -104,14 +98,7 @@
Workspace::mouse_move(const CL_InputEvent& event)
{
impl->tool.on_mouse_move(event);
-
- if (impl->scrolling)
- {
- impl->gc_state.set_pos(CL_Pointf(impl->old_trans_offset.x
- + (impl->click_pos.x -
event.mouse_pos.x)/impl->gc_state.get_zoom(),
- impl->old_trans_offset.y
- + (impl->click_pos.y -
event.mouse_pos.y)/impl->gc_state.get_zoom()));
- }
+ impl->move_tool.on_mouse_move(event);
}
void
@@ -125,10 +112,7 @@
break;
case CL_MOUSE_MIDDLE:
- impl->scrolling = true;
- impl->old_trans_offset = impl->gc_state.get_pos();
- impl->click_pos = event.mouse_pos;
- EditorMapComponent::current()->capture_mouse();
+ impl->move_tool.on_mouse_down(event);
break;
case CL_MOUSE_WHEEL_UP:
Added: trunk/src/workspace_move_tool.cxx
===================================================================
--- trunk/src/workspace_move_tool.cxx 2004-06-03 18:56:46 UTC (rev 386)
+++ trunk/src/workspace_move_tool.cxx 2004-06-03 22:41:47 UTC (rev 387)
@@ -0,0 +1,97 @@
+// $Id$
+//
+// Pingus - A free Lemmings clone
+// 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 <ClanLib/Core/Math/point.h>
+#include <ClanLib/Core/Math/rect.h>
+#include "tool_impl.hxx"
+#include "editor_map_component.hxx"
+#include "workspace.hxx"
+#include "workspace_move_tool.hxx"
+
+class WorkspaceMoveToolImpl : public ToolImpl
+{
+public:
+ Workspace workspace;
+
+ bool scrolling;
+ CL_Point click_pos;
+
+ /** Position of the center */
+ CL_Pointf old_trans_offset;
+
+ virtual void draw() {}
+
+ void on_mouse_up (const CL_InputEvent& event);
+ void on_mouse_down(const CL_InputEvent& event);
+ void on_mouse_move(const CL_InputEvent& event);
+};
+
+void
+WorkspaceMoveToolImpl::on_mouse_down(const CL_InputEvent& event)
+{
+ scrolling = true;
+ old_trans_offset = workspace.get_gc_state().get_pos();
+ click_pos = event.mouse_pos;
+ EditorMapComponent::current()->capture_mouse();
+}
+
+void
+WorkspaceMoveToolImpl::on_mouse_up(const CL_InputEvent& event)
+{
+ scrolling = false;
+ workspace.get_gc_state().set_pos(CL_Pointf(old_trans_offset.x
+ + (click_pos.x -
event.mouse_pos.x)
+ /
workspace.get_gc_state().get_zoom(),
+ old_trans_offset.y
+ + (click_pos.y -
event.mouse_pos.y)
+ /
workspace.get_gc_state().get_zoom()));
+ old_trans_offset = workspace.get_gc_state().get_pos();
+ EditorMapComponent::current()->release_mouse();
+}
+
+void
+WorkspaceMoveToolImpl::on_mouse_move(const CL_InputEvent& event)
+{
+ if (scrolling)
+ {
+ workspace.get_gc_state().set_pos(CL_Pointf(old_trans_offset.x
+ + (click_pos.x -
event.mouse_pos.x)
+ /
workspace.get_gc_state().get_zoom(),
+ old_trans_offset.y
+ + (click_pos.y -
event.mouse_pos.y)
+ /
workspace.get_gc_state().get_zoom()));
+ }
+}
+
+WorkspaceMoveTool::WorkspaceMoveTool(const Workspace& workspace_)
+ : impl(new WorkspaceMoveToolImpl())
+{
+ impl->workspace = workspace_;
+ impl->scrolling = false;
+ impl->click_pos = CL_Point(0, 0);
+ impl->old_trans_offset = CL_Pointf(0,0);
+}
+
+Tool
+WorkspaceMoveTool::to_tool()
+{
+ return Tool(impl);
+}
+
+/* EOF */
Added: trunk/src/workspace_move_tool.hxx
===================================================================
--- trunk/src/workspace_move_tool.hxx 2004-06-03 18:56:46 UTC (rev 386)
+++ trunk/src/workspace_move_tool.hxx 2004-06-03 22:41:47 UTC (rev 387)
@@ -0,0 +1,40 @@
+// $Id$
+//
+// Pingus - A free Lemmings clone
+// 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_WORKSPACE_MOVE_TOOL_HXX
+#define HEADER_WORKSPACE_MOVE_TOOL_HXX
+
+#include "tool.hxx"
+
+class WorkspaceMoveToolImpl;
+
+/** */
+class WorkspaceMoveTool
+{
+public:
+ WorkspaceMoveTool(const Workspace& workspace_);
+
+ Tool to_tool();
+private:
+ SharedPtr<WorkspaceMoveToolImpl> impl;
+};
+
+#endif
+
+/* EOF */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Windstille-devel] rev 387 - in trunk: . src,
Ingo Ruhnke <=