pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src/editor editor.cxx, 1.55, 1.56 editor_


From: Ingo Ruhnke
Subject: [Pingus-CVS] CVS: Games/Pingus/src/editor editor.cxx, 1.55, 1.56 editor_event.cxx, 1.63, 1.64 editor_view.cxx, 1.11, 1.12 editor_view.hxx, 1.10, 1.11 object_selector.cxx, 1.43, 1.44 property_window.cxx, 1.17, 1.18 string_reader.cxx, 1.10, 1.11 string_reader.hxx, 1.8, 1.9 thumb_cache.cxx, 1.15, 1.16
Date: Sun, 19 Oct 2003 14:25:49 +0200

Update of /var/lib/cvs/Games/Pingus/src/editor
In directory dark:/tmp/cvs-serv19578/editor

Modified Files:
        editor.cxx editor_event.cxx editor_view.cxx editor_view.hxx 
        object_selector.cxx property_window.cxx string_reader.cxx 
        string_reader.hxx thumb_cache.cxx 
Log Message:
- some more stuff, still not much useable

Index: editor.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/editor/editor.cxx,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- editor.cxx  18 Oct 2003 23:17:27 -0000      1.55
+++ editor.cxx  19 Oct 2003 12:25:47 -0000      1.56
@@ -109,16 +109,20 @@
   scroll_map->editor_event = event;
 
   //std::cout << "Editor: registering event handler" << event << "... " << 
std::flush;
+#ifdef CLANLIB_0_6
   on_button_press_slot   = CL_Input::sig_button_press ().connect(event, 
&EditorEvent::on_button_press);
   on_button_release_slot = CL_Input::sig_button_release ().connect(event, 
&EditorEvent::on_button_release);
+#endif
 }
 
 Editor::~Editor ()
 {
   StatManager::instance()->set_bool("show-editor-help-screen", 
show_help_screen);
 
+#ifdef CLANLIB_0_6
   CL_Input::sig_button_press ().disconnect (on_button_press_slot);
   CL_Input::sig_button_release ().disconnect (on_button_release_slot);
+#endif 
 
   delete object_manager;
   delete status_line;
@@ -199,8 +203,8 @@
   gui->show ();
 
   if (get_gui_manager()->get_focus () == get_gui_manager ())
-    CL_Display::draw_rect (25, 0, CL_Display::get_width (), 
CL_Display::get_height (),
-                          1.0f, 1.0f, 1.0f);
+    CL_Display::draw_rect(CL_Rect(25, 0, CL_Display::get_width (), 
CL_Display::get_height ()),
+                          CL_Color(255, 255, 255));
 
 }
 
@@ -215,7 +219,7 @@
 
   CL_System::keep_alive();
 
-  while (CL_Mouse::right_pressed())
+  while (CL_Mouse::get_keycode(CL_MOUSE_RIGHT))
     {
       CL_System::keep_alive();
 
@@ -267,58 +271,63 @@
   font.draw(20, 400, "For information about the editor, have a look at the 
info pages.");
   font.draw(20, 420, "$ info pingus");
   Display::flip_display();
+#ifdef CLANLIB_0_6
   CL_Display::sync_buffers();
+#endif
 
-  CL_InputEvent event;
-  CL_InputBuffer* keys = new CL_InputBuffer;
-  bool  finished = false;
+  {
+    CL_InputEvent event;
+    CL_InputBuffer* keys = new CL_InputBuffer;
+    bool  finished = false;
 
-  while (!finished)
-    {
-      CL_System::keep_alive();
+    while (!finished)
+      {
+        CL_System::keep_alive();
 
-      if (keys->peek_key().type != CL_InputEvent::no_key)
-       {
-         event = keys->get_key();
+        if (keys->peek_key().type != CL_InputEvent::no_key)
+          {
+            event = keys->pop_key();
 
-         if (event.type == CL_InputEvent::pressed)
-           {
-             switch (event.id)
-               {
-               case CL_KEY_ENTER:
-                 finished = true;
-                 std::cout << "--- Enter pressed" << std::endl;
-                 break;
+            if (event.type == CL_InputEvent::pressed)
+              {
+                switch (event.id)
+                  {
+                  case CL_KEY_ENTER:
+                    finished = true;
+                    std::cout << "--- Enter pressed" << std::endl;
+                    break;
 
-               case CL_KEY_ESCAPE:
-                 str = "";
-                 finished = true;
-                 break;
+                  case CL_KEY_ESCAPE:
+                    str = "";
+                    finished = true;
+                    break;
 
-               case CL_KEY_DELETE:
-               case CL_KEY_BACKSPACE:
-                 if (!str.empty())
-                   str = str.substr(0, str.size() - 1);
-                 break;
+                  case CL_KEY_DELETE:
+                  case CL_KEY_BACKSPACE:
+                    if (!str.empty())
+                      str = str.substr(0, str.size() - 1);
+                    break;
 
-               case CL_KEY_TAB:
-                 std::cout << "Tab completion not implemented" << std::endl;
-                 break;
+                  case CL_KEY_TAB:
+                    std::cout << "Tab completion not implemented" << std::endl;
+                    break;
 
-               default:
-                  str += event.str;
-                 break;
-               }
-           }
-         CL_Display::clear();
-         font.draw(20, 20, prefix.c_str());
-         font.draw(20, 40, str.c_str());
-         Display::flip_display();
-       }
-    }
-  delete keys;
+                  default:
+                    str += event.str;
+                    break;
+                  }
+              }
+            CL_Display::clear();
+            font.draw(20, 20, prefix.c_str());
+            font.draw(20, 40, str.c_str());
+            Display::flip_display();
+          }
+      }
+    delete keys;
+  }
+  
   event->enable();
-
+  
   return str;
 }
 
@@ -379,15 +388,15 @@
          rect.right  = CL_Mouse::get_x ();
          rect.bottom = CL_Mouse::get_y ();
 
-         CL_Display::draw_rect (rect.left, rect.top, rect.right, rect.bottom,
-                                1.0, 1.0, 0.0, 1.0);
+         CL_Display::draw_rect(CL_Rect(rect.left, rect.top, rect.right, 
rect.bottom),
+                                CL_Color(255, 255, 0, 255));
        }
 
       mouse_cursor.draw(CL_Mouse::get_x (), CL_Mouse::get_y ());
 
       Display::flip_display(true);
     }
-
+  
   view->zoom_to (rect);
   tool = SELECTOR_TOOL;
 }
@@ -476,7 +485,7 @@
   // FIXME: To fix this the whole editor should be build up out of 
CL_Components
 
   CL_System::keep_alive();
-
+  
   selection->drag ();
   Vector old_pos (view->screen_to_world(Vector(CL_Mouse::get_x(), 
CL_Mouse::get_y())));
   while (CL_Mouse::get_keycode(CL_MOUSE_LEFT))

Index: editor_event.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/editor/editor_event.cxx,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- editor_event.cxx    18 Oct 2003 23:17:27 -0000      1.63
+++ editor_event.cxx    19 Oct 2003 12:25:47 -0000      1.64
@@ -564,7 +564,7 @@
       strings.push_back(temp_str);
     }
 
-  reader.set_strings(&strings);
+  reader.set_strings(strings);
 
   disable();
   str = reader.read_string();
@@ -606,7 +606,7 @@
       strings.push_back(str);
     }
 
-  reader.set_strings(&strings);
+  reader.set_strings(strings);
 
   disable();
   str = reader.read_string();

Index: editor_view.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/editor/editor_view.cxx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- editor_view.cxx     18 Oct 2003 23:17:27 -0000      1.11
+++ editor_view.cxx     19 Oct 2003 12:25:47 -0000      1.12
@@ -185,6 +185,7 @@
 void
 EditorView::draw (CL_Surface& sur, const Vector& pos)
 {
+#ifdef CLANLIB_0_6
   if (offset.z == 1.0)
     {
       sur.draw(int(pos.x + get_x_offset () + center.x),
@@ -196,6 +197,7 @@
                int((pos.y + get_y_offset ()) * offset.z + center.y),
                offset.z, offset.z);
     }
+#endif
   //CL_Display::draw_line (x1, y1, x2, y2, 1.0, 1.0, 0.0);
   //CL_Display::draw_line (x1, y2, x2, y1, 1.0, 1.0, 0.0);
 }
@@ -216,15 +218,18 @@
     }
   else
     {
+#ifdef CLANLIB_0_6
       sur.draw(int((x_pos + get_x_offset ()) * offset.z + center.x),
                int((y_pos + get_y_offset ()) * offset.z + center.y),
                offset.z, offset.z);
+#endif
     }
 }
 
 void
 EditorView::draw (CL_Surface& sur, int x_pos, int y_pos, int frame)
 {
+#ifdef CLANLIB_0_6
   if (offset.z == 1.0)
     {
       sur.draw(int(x_pos + get_x_offset () + center.x),
@@ -238,16 +243,19 @@
                offset.z, offset.z,
                frame);
     }
+#endif
 }
 
 void
 EditorView::draw (CL_Surface& sur, int x_pos, int y_pos,
                   float size_x, float size_y, int frame)
 {
+#ifdef CLANLIB_0_6
   sur.draw(int(x_pos + get_x_offset () + center.x),
            int(y_pos + get_y_offset () + center.y),
            size_x * offset.z,
            size_y * offset.z, frame);
+#endif
 }
 
 void

Index: editor_view.hxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/editor/editor_view.hxx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- editor_view.hxx     18 Oct 2003 23:17:27 -0000      1.10
+++ editor_view.hxx     19 Oct 2003 12:25:47 -0000      1.11
@@ -25,6 +25,7 @@
 
 class CL_Rect;
 class CL_Surface;
+class CL_Sprite;
 
 namespace Pingus {
 
@@ -81,6 +82,8 @@
   Vector screen_to_world (Vector pos);
   Vector world_to_screen (Vector pos);
 
+  void draw (CL_Sprite& sur, const Vector& pos, int frame);
+  void draw (CL_Sprite& sur, const Vector& pos);
   void draw (Sprite& sprite, const Vector& pos);
   void draw (Sprite& sprite, const Vector& pos, int frame);
   void draw (CL_Surface& sur, const Vector& pos);

Index: object_selector.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/editor/object_selector.cxx,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- object_selector.cxx 18 Oct 2003 23:17:27 -0000      1.43
+++ object_selector.cxx 19 Oct 2003 12:25:47 -0000      1.44
@@ -365,7 +365,7 @@
 
            StringReader reader("Input the image name:",
                                System::get_statdir () + "images/");
-           reader.set_strings(&strs);
+           reader.set_strings(strs);
            std::string file = reader.read_string();
            HotspotData data;
            data.pos = pos;
@@ -617,12 +617,12 @@
 
   data.pos = pos;
 
-  std::list<std::string>* liste = res->get_resources_of_type("surface");
+  std::list<std::string> liste = res->get_resources_of_type("surface");
   surface_obj sur_obj;
   std::vector<surface_obj> sur_list;
   int j = 0;
 
-  for(std::list<std::string>::iterator i = liste->begin(); i != liste->end(); 
++i)
+  for(std::list<std::string>::iterator i = liste.begin(); i != liste.end(); 
++i)
     {
       // FIXME: This should be moved to ThumbCache
       ++j;
@@ -634,7 +634,7 @@
 
       if (!datafile_loaded && (j % 25) == 0)
        {
-         loading_screen.draw_progress(i->c_str(), (float)j / liste->size());
+         loading_screen.draw_progress(i->c_str(), (float)j / liste.size());
        }
     }
   data_loaded[resource_file] = true;
@@ -657,7 +657,7 @@
       if (keys.peek_key().type != CL_InputEvent::no_key)
        {
          event = keys.pop_key();
-         return key.id;
+         return event.id;
        }
     }
 }

Index: property_window.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/editor/property_window.cxx,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- property_window.cxx 18 Oct 2003 23:17:27 -0000      1.17
+++ property_window.cxx 19 Oct 2003 12:25:47 -0000      1.18
@@ -66,8 +66,8 @@
       set_title(current_frame->get_title ());
       label.show (false);
       //std::cout << "Got GUI" << std::endl;
-      set_client_size (current_frame->get_width () + 1,
-                       current_frame->get_height () + 40);
+      set_size (current_frame->get_width () + 1,
+                current_frame->get_height () + 40);
       close_button.set_position(110, current_frame->get_height () +  10);
     }
   else // current object doesn't have a GUI or no object is selected
@@ -75,7 +75,7 @@
       label.show (true);
       set_title("Property Dialog");
       //std::cout << "No GUI" << std::endl;
-      set_client_size (200, 50);
+      set_size (200, 50);
       close_button.set_position(110, 20);
     }
 }

Index: string_reader.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/editor/string_reader.cxx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- string_reader.cxx   18 Oct 2003 23:17:27 -0000      1.10
+++ string_reader.cxx   19 Oct 2003 12:25:47 -0000      1.11
@@ -29,13 +29,11 @@
 
 StringReader::StringReader()
 {
-  strings = 0;
   font = Fonts::courier_small;
 }
 
 StringReader::StringReader(const std::string & d, const std::string & def)
 {
-  strings = 0;
   description = d;
   default_string = def;
   font = Fonts::courier_small;
@@ -46,7 +44,7 @@
 }
 
 void
-StringReader::set_strings(std::list<std::string>* s)
+StringReader::set_strings(const std::list<std::string>& s)
 {
   strings = s;
 }
@@ -118,7 +116,7 @@
 
   console << "\nCompletions:\n" <<   "~~~~~~~~~~~~" << std::endl;
 
-  for(std::list<std::string>::iterator i = strings->begin(); i != 
strings->end(); ++i)
+  for(std::list<std::string>::iterator i = strings.begin(); i != 
strings.end(); ++i)
     {
       if (i->find(current_string) == 0)
        {

Index: string_reader.hxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/editor/string_reader.hxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- string_reader.hxx   18 Oct 2003 23:17:27 -0000      1.8
+++ string_reader.hxx   19 Oct 2003 12:25:47 -0000      1.9
@@ -31,7 +31,7 @@
 class StringReader
 {
 private:
-  std::list<std::string>* strings;
+  std::list<std::string> strings;
   std::list<std::string*> completions;
   std::string current_string;
   std::string default_string;
@@ -44,7 +44,7 @@
   StringReader (const std::string &, const std::string &);
   virtual ~StringReader ();
 
-  void   set_strings (std::list<std::string>*);
+  void set_strings (const std::list<std::string>& );
   std::string read_string ();
   void draw ();
   std::string find_uniq ();

Index: thumb_cache.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/editor/thumb_cache.cxx,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- thumb_cache.cxx     18 Oct 2003 23:17:27 -0000      1.15
+++ thumb_cache.cxx     19 Oct 2003 12:25:47 -0000      1.16
@@ -21,10 +21,11 @@
 #include <ClanLib/Core/IOData/outputsource_file.h>
 #include <ClanLib/Core/IOData/inputsource_file.h>
 #include <ClanLib/Core/System/error.h>
-#include <ClanLib/Display/SurfaceProviders/canvas.h>
+#include <ClanLib/Display/pixel_buffer.h>
 #include "../globals.hxx"
 #include "../blitter.hxx"
 #include "../system.hxx"
+#include "../canvas.hxx"
 #include "../debug.hxx"
 #include "../pingus_resource.hxx"
 #include "../math.hxx"
@@ -97,7 +98,7 @@
              return uncached_load (res_ident, datafile);
            }
 
-         CL_Canvas* canvas = new CL_Canvas (width, height);
+         CL_PixelBuffer* canvas = Canvas::create_rgba8888(width, height);
          canvas->lock ();
          void* buffer = canvas->get_data ();
          size_t buffer_size = width * height * 4;
@@ -125,8 +126,11 @@
 }
 
 CL_Surface
-ThumbCache::cache (const CL_Surface& sur, const std::string & res_ident, const 
std::string & datafile)
+ThumbCache::cache (const CL_Surface& sur,
+                   const std::string & res_ident,
+                   const std::string & datafile)
 {
+#ifdef CLANLIB_0_6
   if (sur.get_provider ()->get_height () < 50
       && sur.get_provider ()->get_width () < 50)
     {
@@ -179,7 +183,7 @@
 
       canvas->unlock ();
       // Canvas will get deleted on the end of the lifetime of this surface
-      return CL_Surface (canvas, true);
+      return CL_Surface(canvas, true);
     }
   catch (CL_Error&)
     {
@@ -191,6 +195,8 @@
       unsigned int height = Math::min(50, sur.get_height ());
       return Blitter::scale_surface (sur, width, height);
     }
+#endif
+  return 0;
 }
 
 } // namespace EditorNS





reply via email to

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