windstille-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Windstille-devel] rev 319 - in trunk/src: . scripting


From: Ingo Ruhnke
Subject: [Windstille-devel] rev 319 - in trunk/src: . scripting
Date: Fri, 14 May 2004 22:27:15 +0200

Author: grumbel
Date: 2004-05-14 22:27:14 +0200 (Fri, 14 May 2004)
New Revision: 319

Removed:
   trunk/src/tilemap_diamond_tool.cxx
   trunk/src/tilemap_diamond_tool.hxx
Modified:
   trunk/src/Makefile.am
   trunk/src/SConstruct
   trunk/src/command.hxx
   trunk/src/editor_map.hxx
   trunk/src/editor_map_layer.hxx
   trunk/src/editor_objmap.hxx
   trunk/src/editor_tilemap.hxx
   trunk/src/flexlay.cxx
   trunk/src/flexlay.hxx
   trunk/src/flexlay_python.cxx
   trunk/src/globals.hxx
   trunk/src/object_add_command.hxx
   trunk/src/paint_command.cxx
   trunk/src/paint_command.hxx
   trunk/src/python_functor.cxx
   trunk/src/python_functor.hxx
   trunk/src/scripting/editor.cxx
   trunk/src/scripting/editor.hxx
   trunk/src/tile.hxx
   trunk/src/tile_brush.hxx
   trunk/src/tile_selection.hxx
   trunk/src/tileset.hxx
   trunk/src/tool_manager.cxx
   trunk/src/tool_manager.hxx
   trunk/src/workspace.hxx
Log:
- added some docu
- switched from unusable slow boost::python back to swig

Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am       2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/Makefile.am       2004-05-14 20:27:14 UTC (rev 319)
@@ -96,8 +96,6 @@
   tile_selection.hxx  \
   tile_selector.cxx  \
   tile_selector.hxx  \
-  tilemap_diamond_tool.cxx  \
-  tilemap_diamond_tool.hxx  \
   tilemap_paint_tool.cxx  \
   tilemap_paint_tool.hxx  \
   tilemap_select_tool.cxx  \

Modified: trunk/src/SConstruct
===================================================================
--- trunk/src/SConstruct        2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/SConstruct        2004-05-14 20:27:14 UTC (rev 319)
@@ -1,59 +1,54 @@
 ## -*- mode: python -*-
 
-BuildDir('build', '.', duplicate=0)
 env = Environment(CXX = 'g++-3.3',
-                  CCFLAGS = '-g -O2 -Wall')
+                  CCFLAGS = '-g -O2 -Wall',
+                  SWIGFLAGS='-c++ -python')
 
+Depends('flexlay_wrap.cc', ['flexlay.i', 'clanlib.i'])
+ 
 env.SharedLibrary(
-    'hellopy',
-    ['hellopy.cxx'],
-    CPPPATH=['/usr/include/python2.2/'],
-    LIBS=['boost_python'])
-
-env.SharedLibrary(
-    target = 'flexlay',
+    target = '_flexlay',
     source = [
-    'build/command_group.cxx',
-    'build/editor.cxx',
-    'build/scripting/editor.cxx',
-    'build/editor_grid_layer.cxx',
-    'build/editor_map.cxx',
-    'build/editor_map_component.cxx',
-    'build/editor_mapsize_layer.cxx',
-    'build/editor_objmap.cxx',
-    'build/editor_tilemap.cxx',
-    'build/flexlay.cxx',
-    'build/flexlay_python.cxx',
-    'build/globals.cxx',
-    'build/graphic_context_state.cxx',
-    'build/gui_manager.cxx',
-    'build/minimap.cxx',
-    'build/object_add_command.cxx',
-    'build/object_brush.cxx',
-    'build/object_delete_command.cxx',
-    'build/object_move_command.cxx',
-    'build/object_selector.cxx',
-    'build/object_transform_command.cxx',
-    'build/objmap_object.cxx',
-    'build/objmap_select_tool.cxx',
-    'build/objmap_sprite_object.cxx',
-    'build/paint_command.cxx',
-    'build/popup_menu.cxx',
-    'build/python_functor.cxx',
-    'build/scripting/gui.cxx',
-    'build/tile.cxx',
-    'build/tile_brush.cxx',
-    'build/tile_editor.cxx',
-    'build/tile_selection.cxx',
-    'build/tile_selector.cxx',
-    'build/tilemap_diamond_tool.cxx',
-    'build/tilemap_paint_tool.cxx',
-    'build/tilemap_select_tool.cxx',
-    'build/tilemap_tool.cxx',
-    'build/tileset.cxx',
-    'build/tool_manager.cxx',
-    'build/workspace.cxx',
-    'build/zoom_tool.cxx'],
+    'flexlay.i',
+    'command_group.cxx',
+    'editor.cxx',
+    'scripting/editor.cxx',
+    'editor_grid_layer.cxx',
+    'editor_map.cxx',
+    'editor_map_component.cxx',
+    'editor_mapsize_layer.cxx',
+    'editor_objmap.cxx',
+    'editor_tilemap.cxx',
+    'flexlay.cxx',
+    'globals.cxx',
+    'graphic_context_state.cxx',
+    'gui_manager.cxx',
+    'minimap.cxx',
+    'object_add_command.cxx',
+    'object_brush.cxx',
+    'object_delete_command.cxx',
+    'object_move_command.cxx',
+    'object_selector.cxx',
+    'object_transform_command.cxx',
+    'objmap_object.cxx',
+    'objmap_select_tool.cxx',
+    'objmap_sprite_object.cxx',
+    'paint_command.cxx',
+    'popup_menu.cxx',
+    'python_functor.cxx',
+    'scripting/gui.cxx',
+    'tile.cxx',
+    'tile_brush.cxx',
+    'tile_editor.cxx',
+    'tile_selection.cxx',
+    'tile_selector.cxx',
+    'tilemap_paint_tool.cxx',
+    'tilemap_select_tool.cxx',
+    'tilemap_tool.cxx',
+    'tileset.cxx',
+    'tool_manager.cxx',
+    'workspace.cxx',
+    'zoom_tool.cxx'],
     CPPPATH=['/home/ingo/run/ClanLib-0.7-current//include/ClanLib-0.7/',
              '/usr/include/python2.2/',
              '..'],
@@ -66,5 +61,59 @@
           'clanGUIStyleSilver',
           'boost_python'])
 
+# env.SharedLibrary(
+#     target = 'flexlay',
+#     source = [
+#     'command_group.cxx',
+#     'editor.cxx',
+#     'scripting/editor.cxx',
+#     'editor_grid_layer.cxx',
+#     'editor_map.cxx',
+#     'editor_map_component.cxx',
+#     'editor_mapsize_layer.cxx',
+#     'editor_objmap.cxx',
+#     'editor_tilemap.cxx',
+#     'flexlay.cxx',
+#     'flexlay_python.cxx',
+#     'globals.cxx',
+#     'graphic_context_state.cxx',
+#     'gui_manager.cxx',
+#     'minimap.cxx',
+#     'object_add_command.cxx',
+#     'object_brush.cxx',
+#     'object_delete_command.cxx',
+#     'object_move_command.cxx',
+#     'object_selector.cxx',
+#     'object_transform_command.cxx',
+#     'objmap_object.cxx',
+#     'objmap_select_tool.cxx',
+#     'objmap_sprite_object.cxx',
+#     'paint_command.cxx',
+#     'popup_menu.cxx',
+#     'python_functor.cxx',
+#     'scripting/gui.cxx',
+#     'tile.cxx',
+#     'tile_brush.cxx',
+#     'tile_editor.cxx',
+#     'tile_selection.cxx',
+#     'tile_selector.cxx',
+#     'tilemap_paint_tool.cxx',
+#     'tilemap_select_tool.cxx',
+#     'tilemap_tool.cxx',
+#     'tileset.cxx',
+#     'tool_manager.cxx',
+#     'workspace.cxx',
+#     'zoom_tool.cxx'],
+#     CPPPATH=['/home/ingo/run/ClanLib-0.7-current//include/ClanLib-0.7/',
+#              '/usr/include/python2.2/',
+#              '..'],
+#     LIBPATH=['/home/ingo/run/ClanLib-0.7-current//lib/'],
+#     LIBS=['clanCore',
+#           'clanDisplay',
+#           'clanGL',
+#           'clanSignals',
+#           'clanGUI',
+#           'clanGUIStyleSilver',
+#           'boost_python'])
 
 # EOF #

Modified: trunk/src/command.hxx
===================================================================
--- trunk/src/command.hxx       2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/command.hxx       2004-05-14 20:27:14 UTC (rev 319)
@@ -20,7 +20,10 @@
 #ifndef HEADER_COMMAND_HXX
 #define HEADER_COMMAND_HXX
 
-/** */
+/** Command is an abstract base class for all data manipulating
+    operations on EditorLayer or even EditorMap metedata. Each Command
+    that manipulates data must provide a way to undo and redo the
+    operations. */
 class Command
 {
 private:

Modified: trunk/src/editor_map.hxx
===================================================================
--- trunk/src/editor_map.hxx    2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/editor_map.hxx    2004-05-14 20:27:14 UTC (rev 319)
@@ -78,7 +78,6 @@
 
   EditorMapLayer* get_layer_by_name(int i);
   EditorMapLayer* get_layer(int i);
-  void set_active_layer(int i);
 
 #ifdef SWIGGUILE
   void   set_metadata(const SCMObj& obj);

Modified: trunk/src/editor_map_layer.hxx
===================================================================
--- trunk/src/editor_map_layer.hxx      2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/editor_map_layer.hxx      2004-05-14 20:27:14 UTC (rev 319)
@@ -22,7 +22,11 @@
 
 class EditorMapComponent;
 
-/** */
+/** Each \a EditorMap consists out of one or more \a EditorMapLayer,
+    The \a EditorMapLayer is an abstract base class from which the
+    data holding layers derive. The basic functionality of a layer
+    consists only of data holding and visualization. (FIXME: move
+    visuals off into another class) */
 class EditorMapLayer
 {
 public:

Modified: trunk/src/editor_objmap.hxx
===================================================================
--- trunk/src/editor_objmap.hxx 2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/editor_objmap.hxx 2004-05-14 20:27:14 UTC (rev 319)
@@ -31,8 +31,9 @@
 
 class ObjMapObject;
 
-/** GUI Component that holds positioned objects, ie. objects which
-    consist of a CL_Sprite and some properties */
+/** The EditorObjMap provides a simple Layer for holding positioned
+    objects. Objects consist of a CL_Sprite and some properties
+    accessible from scripting languages */
 class EditorObjMap : public EditorMapLayer
 {
 private:

Modified: trunk/src/editor_tilemap.hxx
===================================================================
--- trunk/src/editor_tilemap.hxx        2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/editor_tilemap.hxx        2004-05-14 20:27:14 UTC (rev 319)
@@ -29,8 +29,11 @@
 class CL_PixelBuffer;
 class TileBrush;
 
-/** Holds the tilemap data for the editor and provides functions to
-    manipulate them */
+/** EditorTileMap holds the tilemap data for the editor and provides
+    functions to manipulate them. Each \a EditorTilemap is associated
+    with a \a Tileset, which provides information on which ids are
+    mapped to which Tiles, the tilemap itself only knows the ids of
+    tiles.  */
 class EditorTileMap : public EditorMapLayer
 {
 private:

Modified: trunk/src/flexlay.cxx
===================================================================
--- trunk/src/flexlay.cxx       2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/flexlay.cxx       2004-05-14 20:27:14 UTC (rev 319)
@@ -24,8 +24,6 @@
 #include "globals.hxx"
 #include "flexlay.hxx"
 
-Flexlay flexlay;
-
 Flexlay::Flexlay()
 {
   screen_width  = 800;

Modified: trunk/src/flexlay.hxx
===================================================================
--- trunk/src/flexlay.hxx       2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/flexlay.hxx       2004-05-14 20:27:14 UTC (rev 319)
@@ -22,6 +22,58 @@
 
 #include <ClanLib/Display/display_window.h>
 
+/*! \mainpage Flexlay - A Flexible Layered 2D Editor
+  
+\section intro Introduction
+
+Flexlay is a rather flexible layered editor mainly meant for editing
+game data such as levels, tilemaps, enemy placement and such. It
+provides a basic framework which makes it easy to add new
+functionality, special dialog windows and such needed to customize it
+for a specific game. Flexlay itself is actually a Python module and
+not an editor in itself, however due to reasonably simple Python
+scripts one can already have a fully working editor.
+
+\section structure Structure
+
+Flexlay provides the following basic classes on which everything else
+is build:
+
+Command: each operation on data is encapsuled in a Command object
+which provides undo/redo capability, together with a way to easily
+record macros and write scripts with it.
+
+EditorMapLayer: a map layer is the class that holds the data, special
+layers such as object or tilemap layers derive from this class to
+provide the capabilites needed to use them
+
+Tool: A tool manages and dispatches mouse input to Commands, thus
+giving the user an interactive way to manipulate map data.
+
+GUI: Flexlay provides a simple GUI framework that can be used from
+Python to create dialogboxes, add buttons to the main window and such.
+
+\section games Games
+
+Currently Flexlay supports the following games with different levels
+of completeness:
+
+netPanzer: fully working load/save and map editing capabilites
+
+SuperTux: fully working load/save and map editing capabilites, however
+a bit limited when it comes to object properties
+
+Windstille: fully working load/save support, however due to the game
+itself not being ready this is not so usefull
+
+Pingus: just very basic load support
+
+*/
+
+/** Flexlay holds the DisplayWindow and manages the graphic mode and
+    screen resolution that should be. Its the top most class that
+    needs to be inited before the rest becomes useable. FIXME: Make
+    Flexlay 'batchable' so that it can run without a GUI */
 class Flexlay
 {
 private:
@@ -41,8 +93,6 @@
   void deinit();
 };
 
-extern Flexlay flexlay;
-
 #endif
 
 /* EOF */

Modified: trunk/src/flexlay_python.cxx
===================================================================
--- trunk/src/flexlay_python.cxx        2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/flexlay_python.cxx        2004-05-14 20:27:14 UTC (rev 319)
@@ -7,8 +7,12 @@
 #include <boost/python.hpp>
 #include <iostream>
 
+#include "command.hxx"
+#include "paint_command.hxx"
+
 #include "scripting/editor.hxx"
 #include "tile.hxx"
+#include "tile_brush.hxx"
 #include "editor.hxx"
 #include "editor_map.hxx"
 #include "workspace.hxx"
@@ -132,6 +136,22 @@
     .def("get_tile", &EditorTileMap::get_tile)
     .def("resize",   &EditorTileMap::resize);
 
+  class_<TileBrush>
+    ("TileBrush", init<int, int>())
+    .def("set_opaque",      &TileBrush::set_opaque)
+    .def("set_transparent", &TileBrush::set_transparent)
+    .def("auto_crop",       &TileBrush::auto_crop);
+
+  class_<Command, boost::noncopyable>
+    ("Command", no_init)
+    .def("execute", &Command::execute)
+    .def("undo",    &Command::undo)
+    .def("redo",    &Command::redo);
+  
+  class_<PaintCommand, bases<Command>, PaintCommand, boost::noncopyable>
+    ("PaintCommand", init<EditorTileMap*, TileBrush>())
+    .def("add_point", &PaintCommand::add_point);
+
   def("tilemap_set_current", &EditorTileMap::set_current);
   def("tilemap_paint_tool_set_tilemap", &tilemap_paint_tool_set_tilemap);
 }

Modified: trunk/src/globals.hxx
===================================================================
--- trunk/src/globals.hxx       2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/globals.hxx       2004-05-14 20:27:14 UTC (rev 319)
@@ -34,7 +34,6 @@
 
 extern CL_ResourceManager* resources;
 
-extern float game_speed;
 extern int   debug;
 
 #endif

Modified: trunk/src/object_add_command.hxx
===================================================================
--- trunk/src/object_add_command.hxx    2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/object_add_command.hxx    2004-05-14 20:27:14 UTC (rev 319)
@@ -25,7 +25,10 @@
 class EditorObjMap;
 class ObjMapObject;
 
-/** */
+/** ObjectAddCommand adds on object to an EditorObjMap, the user needs
+    to supply an Object together with the \a EditorObjMap to which it
+    should be added. FIXME: position should be part of the command,
+    not the object */
 class ObjectAddCommand : public Command
 {
 private:

Modified: trunk/src/paint_command.cxx
===================================================================
--- trunk/src/paint_command.cxx 2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/paint_command.cxx 2004-05-14 20:27:14 UTC (rev 319)
@@ -24,6 +24,15 @@
 #include "editor_tilemap.hxx"
 #include "paint_command.hxx"
 
+PaintCommand::PaintCommand(EditorTileMap* t, const TileBrush& b)
+  : field(t->get_map()), brush(b)
+{
+  undo_field = *field;
+
+  redo_brush = 0;
+  undo_brush = 0;
+}
+
 PaintCommand::PaintCommand(Field<int>* f, const TileBrush& b)
   : field(f), brush(b)
 {  

Modified: trunk/src/paint_command.hxx
===================================================================
--- trunk/src/paint_command.hxx 2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/paint_command.hxx 2004-05-14 20:27:14 UTC (rev 319)
@@ -26,7 +26,12 @@
 #include "tile_brush.hxx"
 #include "command.hxx"
 
-/** */
+class EditorTileMap;
+
+/** The PaintCommand provides functionality to draw onto an
+    EditorTileMap. The user needs to supply a brush and a map to draw
+    to and the points to which should be drawn, undo, redo and the
+    internals of drawing are handled by the PaintCommand itself. */
 class PaintCommand : public Command
 {
 private: 
@@ -43,6 +48,7 @@
   
 public:
   PaintCommand(Field<int>* f, const TileBrush& b);
+  PaintCommand(EditorTileMap* t, const TileBrush& b);
   virtual ~PaintCommand();
   
   void add_point(const CL_Point& pos);

Modified: trunk/src/python_functor.cxx
===================================================================
--- trunk/src/python_functor.cxx        2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/python_functor.cxx        2004-05-14 20:27:14 UTC (rev 319)
@@ -17,7 +17,6 @@
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-#include <boost/python.hpp>
 #include "python_functor.hxx"
 
 PythonFunctor::PythonFunctor()
@@ -25,18 +24,21 @@
 {
 }
 
-PythonFunctor::PythonFunctor(boost::python::object o)
+PythonFunctor::PythonFunctor(PyObject* o)
 {
   obj = o;
+  Py_XINCREF(obj);
 }
 
 PythonFunctor::PythonFunctor(const PythonFunctor& copy)
 {
   obj = copy.obj;
+  Py_XINCREF(obj);
 }
 
 PythonFunctor::~PythonFunctor()
 {
+  Py_XDECREF(obj);
 }
 
 PythonFunctor&
@@ -45,6 +47,7 @@
   if (this != &copy)
     {
       obj = copy.obj;
+      Py_XINCREF(obj);
     }
   return *this;  
 }
@@ -53,7 +56,13 @@
 PythonFunctor::operator()()
 {
   PyObject* arglist = PyTuple_New(0);
-  PyEval_CallObject(obj.ptr(),  arglist);
+  if (PyEval_CallObject(obj,  arglist) == 0)
+    {
+      if (PyErr_Occurred())
+        {
+          PyErr_Print();
+        }
+    }
   Py_DECREF(arglist);
 }
 

Modified: trunk/src/python_functor.hxx
===================================================================
--- trunk/src/python_functor.hxx        2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/python_functor.hxx        2004-05-14 20:27:14 UTC (rev 319)
@@ -20,21 +20,22 @@
 #ifndef HEADER_PYTHON_FUNCTOR_HXX
 #define HEADER_PYTHON_FUNCTOR_HXX
 
+#include <boost/python.hpp>
 #include "Python.h"
 
 /** */
 class PythonFunctor
 {
 private:
-  boost::python::object obj;
+  PyObject* obj;
 public:
   PythonFunctor();
-  PythonFunctor(boost::python::object o);
-  ~PythonFunctor();
-
+  PythonFunctor(PyObject* o);
   PythonFunctor(const PythonFunctor& copy);
   PythonFunctor& operator=(const PythonFunctor& copy);
 
+  ~PythonFunctor();
+
   void operator()();
 };
 

Modified: trunk/src/scripting/editor.cxx
===================================================================
--- trunk/src/scripting/editor.cxx      2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/scripting/editor.cxx      2004-05-14 20:27:14 UTC (rev 319)
@@ -60,6 +60,7 @@
 #include "../editor_grid_layer.hxx"
 #include "../editor_tilemap.hxx"
 
+#include "../python_functor.hxx"
 #include "editor.hxx"
 
 SCM component2scm(CL_Component* comp);
@@ -1001,6 +1002,13 @@
   return new Tileset(tile_size);
 }
 
+void connect(CL_Signal_v0& sig, PyObject* obj)
+{
+  std::cout << "Connecting functor: " << std::endl;
+  new CL_Slot(sig.connect_functor(PythonFunctor(obj)));
+}
+
+
 #ifdef SWIGGUILE
 Tileset*
 tileset_create_from_file(const char* resourcefile)

Modified: trunk/src/scripting/editor.hxx
===================================================================
--- trunk/src/scripting/editor.hxx      2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/scripting/editor.hxx      2004-05-14 20:27:14 UTC (rev 319)
@@ -23,10 +23,14 @@
 #include <string>
 #include <vector>
 
+#include <ClanLib/Signals/signal_v0.h>
+
 #ifdef SWIGGUILE
 #  include <guile/gh.h>
 #endif
 
+#include "Python.h"
+
 class Workspace;
 class EditorMap;
 class EditorObjMap;
@@ -102,6 +106,8 @@
 void            editor_tilemap_set_fgcolor(EditorMapLayer* l, int r, int g, 
int b, int a);
 void            editor_tilemap_save_png(EditorMapLayer* l, const char* 
filename);
 
+void connect(CL_Signal_v0& sig, PyObject* obj);
+
 Workspace* workspace_current();
 Workspace* workspace_create();
 void workspace_add_map(Workspace* workspace, EditorMap* m, int x, int y);
@@ -109,7 +115,9 @@
 EditorMap* workspace_get_current_map(Workspace* workspace);
 
 Tileset* tileset_create(int tile_size);
+#ifdef SWIGGUILE
 Tileset* tileset_create_from_file(const char* resourcefile);
+#endif
 void tileset_set_current(Tileset* tileset);
 
 EditorMapLayer* editor_mapsize_layer_create(int w, int h);

Modified: trunk/src/tile.hxx
===================================================================
--- trunk/src/tile.hxx  2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/tile.hxx  2004-05-14 20:27:14 UTC (rev 319)
@@ -24,10 +24,8 @@
 #include <ClanLib/Display/sprite.h>
 #include <ClanLib/Display/pixel_buffer.h>
 
-/** A Tile is a surface or sprite together with information for
- *  collision detection (aka colmap). The collision map is at a
- *  resolution of 8x8 bits. Position information is handled in the
- *  TileMap and not here. (flyweight pattern). */
+/** A Tile is a surface or sprite together with meta information for
+    collision (aka colmap), walkability or such. */
 class Tile
 {
 private:
@@ -42,6 +40,7 @@
   CL_Color  attribute_color;
 
   std::string filename;
+
 public:
   unsigned char colmap[8];
 

Modified: trunk/src/tile_brush.hxx
===================================================================
--- trunk/src/tile_brush.hxx    2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/tile_brush.hxx    2004-05-14 20:27:14 UTC (rev 319)
@@ -23,7 +23,10 @@
 #include "field.hxx"
 
 /** */
-class TileBrush : public Field<int>
+class TileBrush 
+#ifndef SWIGPYTHON
+  : public Field<int>
+#endif
 {
 private:
   /** if true transparent tiles are drawn the same as opaque tiles, ie
@@ -35,7 +38,10 @@
 public:
   TileBrush();
   TileBrush(int w, int h);
+
+#ifndef SWIGPYTHON
   TileBrush(const Field<int>& f, int w, int h, int pos_x, int pos_y);
+#endif
 
   void set_opaque() { opaque = true; }
   void set_transparent() { opaque = false; }

Modified: trunk/src/tile_selection.hxx
===================================================================
--- trunk/src/tile_selection.hxx        2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/tile_selection.hxx        2004-05-14 20:27:14 UTC (rev 319)
@@ -27,7 +27,10 @@
 
 class EditorTileMap;
 
-/** */
+/** The TileSelection is a little helper class to manage rectangular
+    selections of tiles and provides a way to convert this selection
+    to a Brush which then can be used for either serialisation or be
+    used for painting on the map itself */
 class TileSelection
 {
 private:

Deleted: trunk/src/tilemap_diamond_tool.cxx
===================================================================
--- trunk/src/tilemap_diamond_tool.cxx  2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/tilemap_diamond_tool.cxx  2004-05-14 20:27:14 UTC (rev 319)
@@ -1,103 +0,0 @@
-//  $Id: tilemap_diamond_tool.cxx,v 1.2 2003/09/26 14:29:36 grumbel Exp $
-//
-//  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 <ClanLib/Display/mouse.h>
-#include <ClanLib/Display/keys.h>
-#include <ClanLib/Display/input_event.h>
-#include "editor_tilemap.hxx"
-#include "editor_map.hxx"
-#include "editor_map_component.hxx"
-#include "globals.hxx"
-#include "editor_names.hxx"
-#include "tilemap_diamond_tool.hxx"
-
-TileMapDiamondTool::TileMapDiamondTool()
-  : sprite("diamond", resources)
-{
-  painting = false;
-  current_tile = CL_Point(0, 0);
-}
-
-TileMapDiamondTool::~TileMapDiamondTool() 
-{
-}
-
-void
-TileMapDiamondTool::draw()
-{
-  EditorMapComponent* parent = EditorMapComponent::current();
-  CL_Point pos = parent->screen2world(CL_Point(CL_Mouse::get_x(), 
CL_Mouse::get_y()));
- 
-  sprite.set_frame(7);
-  sprite.draw(current_tile.x/64 * 64,
-              current_tile.y/64 * 64);
-}
-
-void
-TileMapDiamondTool::on_mouse_up  (const CL_InputEvent& event)
-{
-  painting = false;
-  paint(event.mouse_pos);
-}
-
-void
-TileMapDiamondTool::on_mouse_down(const CL_InputEvent& event)
-{
-  if (event.id == CL_MOUSE_LEFT)
-    {
-      color = true;
-    }
-  else
-    {
-      color = false;
-    }
-
-  painting = true;
-  paint(event.mouse_pos);
-}
-
-void
-TileMapDiamondTool::on_mouse_move(const CL_InputEvent& event)
-{
-  EditorMapComponent* parent = EditorMapComponent::current();
-
-  if (painting)
-    {
-      paint(event.mouse_pos);
-    }
-  current_tile = parent->screen2world(event.mouse_pos);
-}
-
-void
-TileMapDiamondTool::paint(const CL_Point& mpos)
-{
-#if 0
-  EditorTileMap* tilemap
-    = 
dynamic_cast<EditorTileMap*>(EditorMapComponent::current()->get_workspace()->get_current_map()->get_layer_by_name(TILEMAP_NAME));
-  EditorMapComponent* parent = EditorMapComponent::current();
-
-  CL_Point pos = parent->screen2world(mpos);
-
-  tilemap->get_diamond_map()->at(int(pos.x/64), 
-                                 int(pos.y/64)) = color;
-#endif
-}
-
-/* EOF */

Deleted: trunk/src/tilemap_diamond_tool.hxx
===================================================================
--- trunk/src/tilemap_diamond_tool.hxx  2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/tilemap_diamond_tool.hxx  2004-05-14 20:27:14 UTC (rev 319)
@@ -1,54 +0,0 @@
-//  $Id: tilemap_diamond_tool.hxx,v 1.2 2003/09/26 14:29:36 grumbel Exp $
-// 
-//  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_TILEMAP_DIAMOND_TOOL_HXX
-#define HEADER_TILEMAP_DIAMOND_TOOL_HXX
-
-#include <ClanLib/Display/sprite.h>
-#include "tilemap_tool.hxx"
-
-/** */
-class TileMapDiamondTool : public TileMapTool
-{
-private:
-  CL_Sprite sprite;
-  bool painting;
-  bool color;
-  CL_Point current_tile;
-
-public:
-  TileMapDiamondTool();
-  ~TileMapDiamondTool();
-
-  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);
-
-private:
-  void paint(const CL_Point&);
-
-  TileMapDiamondTool (const TileMapDiamondTool&);
-  TileMapDiamondTool& operator= (const TileMapDiamondTool&);
-};
-
-#endif
-
-/* EOF */

Modified: trunk/src/tileset.hxx
===================================================================
--- trunk/src/tileset.hxx       2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/tileset.hxx       2004-05-14 20:27:14 UTC (rev 319)
@@ -28,7 +28,9 @@
 
 class Tile;
 
-/** */
+/** A \a Tileset provides the mapping from an \a id to a \a Tile
+    structure. It also contains information of the tile_size and other
+    necesarry information that are needed to display a TileMap */
 class Tileset
 {
 private:
@@ -41,8 +43,6 @@
 
   static Tileset* current_;
 public:
-  static std::string tile_def_file;
-
   typedef Tiles::iterator iterator;
   
   iterator begin() { return tiles.begin(); }

Modified: trunk/src/tool_manager.cxx
===================================================================
--- trunk/src/tool_manager.cxx  2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/tool_manager.cxx  2004-05-14 20:27:14 UTC (rev 319)
@@ -21,7 +21,6 @@
 #include "tilemap_paint_tool.hxx"
 #include "tilemap_select_tool.hxx"
 #include "objmap_select_tool.hxx"
-#include "tilemap_diamond_tool.hxx"
 #include "zoom_tool.hxx"
 #include "editor_tilemap.hxx"
 #include "editor_map.hxx"

Modified: trunk/src/tool_manager.hxx
===================================================================
--- trunk/src/tool_manager.hxx  2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/tool_manager.hxx  2004-05-14 20:27:14 UTC (rev 319)
@@ -24,7 +24,8 @@
 
 class TileMapTool;
 
-/** */
+/** 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:

Modified: trunk/src/workspace.hxx
===================================================================
--- trunk/src/workspace.hxx     2004-05-14 01:25:50 UTC (rev 318)
+++ trunk/src/workspace.hxx     2004-05-14 20:27:14 UTC (rev 319)
@@ -39,7 +39,8 @@
 /** */
 class Workspace
 {
-public:
+private:
+  friend class EditorMapComponent;
   GraphicContextState gc_state;
 
   typedef std::vector<WorkspaceItem*> Items;
@@ -52,6 +53,7 @@
   CL_Pointf old_trans_offset;
 
   static Workspace* current_;
+
 public:
   static void set_current(Workspace* w) { current_ = w; }
   static Workspace* current() { return current_; }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]