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.19,1.20 editor.hx


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src/editor editor.cxx,1.19,1.20 editor.hxx,1.8,1.9
Date: 4 Aug 2002 15:42:25 -0000

Update of /usr/local/cvsroot/Games/Pingus/src/editor
In directory dark:/tmp/cvs-serv32416/editor

Modified Files:
        editor.cxx editor.hxx 
Log Message:
- turned credit screen into a Screen
- turned editor into a screen (half finished)
- some cleanup

Index: editor.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/editor.cxx,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- editor.cxx  3 Jul 2002 17:14:25 -0000       1.19
+++ editor.cxx  4 Aug 2002 15:42:23 -0000       1.20
@@ -144,7 +144,7 @@
 }
 
 void
-Editor::edit ()
+Editor::on_startup ()
 {
   quit = false;
 
@@ -153,50 +153,41 @@
   Display::show_cursor();
 
   register_event_handler();
+}
 
-  std::vector<EditorObj*> tmp_selection;
+void
+Editor::on_shutdown ()
+{
+  unregister_event_handler();
+  Display::hide_cursor(); 
+}
 
-  while (!quit) 
+void
+Editor::update (const GameDelta& delta)
+{
+  // FIXME: This should be moved to the object manager
+  if (tmp_selection != selection->get_objects ())
     {
-      // FIXME: This busy loop should be replaced by redraw events
-      CL_System::sleep (20);
-      CL_System::keep_alive();
-      move_objects();
-      draw();
-      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);
-      gui->show ();
-      //std::cout << "GUI has Focus: " << (gui->get_focus () !=  gui) << 
std::endl;
-      Display::flip_display(true);
+      std::cout << "Exit: Selection changed" << std::endl;
+      tmp_selection = selection->get_objects ();
 
-      // FIXME: This should be moved to the object manager
-      if (tmp_selection != selection->get_objects ())
+      // FIXME: dirty hack
+      if (selection->size() == 1)
        {
-         std::cout << "Selection changed" << std::endl;
-         tmp_selection = selection->get_objects ();
-
-         // FIXME: dirty hack
-         if (selection->size() == 1)
-           {
-             EditorObj* obj = selection->get_current_obj ();
-             property_window->update_frame (obj);
-             //CL_Component* comp = obj->get_gui_dialog 
(editor->property_window);
-           }
-         else
-           {
-             property_window->update_frame (0);
-             std::cout << "EditorEvent::editor_show_object_properties (): 
error: multiple objects selected" << std::endl;
-           }
+         EditorObj* obj = selection->get_current_obj ();
+         property_window->update_frame (obj);
+         //CL_Component* comp = obj->get_gui_dialog (editor->property_window);
        }
-    }
-
-  unregister_event_handler();
+      else
+       {
+         property_window->update_frame (0);
+         std::cout << "EditorEvent::editor_show_object_properties (): error: 
multiple objects selected" << std::endl;
+       }
+    }  
 
-  Display::hide_cursor();
+  move_objects();
 }
 
-
 void
 Editor::draw ()
 {
@@ -206,24 +197,6 @@
   selection->draw (view);
   panel->draw();
 
-  /*  {
-      int x1_pos = CL_Display::get_width() - 200;
-      int y1_pos = CL_Display::get_height() - 150;
-      int x2_pos = CL_Display::get_width() - 1;
-      int y2_pos = CL_Display::get_height() - 1;
-      int width  = (CL_Display::get_width() - 25) * 200 / object_manager.width;
-      int height = CL_Display::get_height() * 150 / object_manager.height;;
-
-      Display::draw_rect(x1_pos, y1_pos , x2_pos, y2_pos,
-      1.0, 1.0, 1.0, 1.0);
-
-      Display::draw_rect(x1_pos - (object_manager.x_offset * 200 / 
object_manager.width),
-      y1_pos - (object_manager.y_offset * 150 / object_manager.height),
-      x1_pos - (object_manager.x_offset * 200 / object_manager.width) + width, 
 
-      y1_pos - (object_manager.y_offset * 150 / object_manager.height) + 
height,
-      1.0, 1.0, 1.0, 1.0);
-      }*/
-
   status_line->draw(view);
   scroll_map->draw();
     
@@ -231,6 +204,13 @@
     {
       help_screen.draw ();
     }
+
+  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);
+
 }
 
 

Index: editor.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/editor.hxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- editor.hxx  2 Jul 2002 09:14:20 -0000       1.8
+++ editor.hxx  4 Aug 2002 15:42:23 -0000       1.9
@@ -21,12 +21,15 @@
 #define HEADER_PINGUS_EDITOR_EDITOR_HXX
 
 #include <string>
+#include <vector>
 #include <ClanLib/Signals/slot.h>
 
+#include "../screen.hxx"
 #include "editor_help_screen.hxx"
 
 ///
 class EditorView;
+class EditorObj;
 class EditorEvent;
 class Panel;
 class ScrollMap;
@@ -48,7 +51,7 @@
 class CL_StyleManager_Default;
 class CL_GUIManager;
 
-class Editor
+class Editor : public Screen
 {
 private:
   EditorEvent* event;
@@ -92,6 +95,8 @@
 
   static Editor* instance_;
 
+  std::vector<EditorObj*> tmp_selection;
+
   Editor ();
 public:
   ~Editor ();
@@ -99,8 +104,7 @@
   static Editor* instance ();
 
   std::string read_string (const std::string & prefix = "", const std::string 
& default_str = "");
-  void edit ();
-  void draw ();
+
   void draw_noflip();
   void interactive_move_object();
   void move_objects();
@@ -122,6 +126,13 @@
   EditorEvent* get_event() { return event; }
 
   CL_GUIManager* get_gui_manager ();
+
+  // overloaded Screen stuff
+  void draw ();
+  void update (const GameDelta& delta);
+
+  void on_startup ();
+  void on_shutdown ();
 };
 
 #endif




reply via email to

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