pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src playfield.cxx,1.15,1.16


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src playfield.cxx,1.15,1.16
Date: 17 Aug 2002 00:29:29 -0000

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

Modified Files:
        playfield.cxx 
Log Message:
- added auto_scrolling
- added scroll band

Index: playfield.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/playfield.cxx,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- playfield.cxx       14 Aug 2002 12:45:02 -0000      1.15
+++ playfield.cxx       17 Aug 2002 00:29:27 -0000      1.16
@@ -117,6 +117,29 @@
                                0.0, 0.0, 0.0, 1.0);
        }
     }
+
+  // Draw the scrolling band
+  if (mouse_scrolling)
+    {
+       CL_Display::draw_line (mouse_x, mouse_y,
+                             scroll_center_x, scroll_center_y-15,
+                             0.0f, 1.0f, 0.0f, 1.0f);
+
+       CL_Display::draw_line (mouse_x, mouse_y,
+                             scroll_center_x, scroll_center_y,
+                             1.0f, 0.0f, 0.0f, 1.0f);
+
+       CL_Display::draw_line (mouse_x, mouse_y,
+                             scroll_center_x, scroll_center_y+15,
+                             0.0f, 0.0f, 1.0f, 1.0f);
+
+       CL_Display::draw_line (mouse_x, mouse_y,
+                             scroll_center_x + 15, scroll_center_y,
+                             0.0f, 1.0f, 1.0f, 1.0f);
+       CL_Display::draw_line (mouse_x, mouse_y,
+                             scroll_center_x - 15, scroll_center_y,
+                             1.0f, 1.0f, 0.0f, 1.0f);
+    }
 }
 
 Pingu*
@@ -150,53 +173,54 @@
   world = w;
 }
 
-#if 0
-void 
-Playfield::process_input_interactive()
+void
+Playfield::update(float delta)
 {
-  // FIXME: This should be replaced with something getting relative mouse co's
+  for(unsigned int i=0; i < view.size(); ++i)
+    {
+      view[i]->update (delta);
+
+      if (view[i]->is_current() && !mouse_scrolling)
+       { 
+         current_view = i;
+         current_pingu = current_pingu_find(mouse_x - view[i]->get_x_pos() - 
(view[i]->get_x_offset()),
+                                            mouse_y - view[i]->get_y_pos() - 
(view[i]->get_y_offset())); 
+         view[i]->set_pingu(current_pingu);
+         break;
+       }
+    }
+
+  if (mouse_scrolling)
+    {
+      // FIXME: This should be delta dependant
+      view[current_view]->shift_x_offset((scroll_center_x - mouse_x) / 5);
+      view[current_view]->shift_y_offset((scroll_center_y - mouse_y) / 5);
+    }
+
   if (auto_scrolling)
     {
+      // FIXME: This should be delta dependant
       scroll_speed = 30;
 
-      if (controller->get_x() < 2) 
+      if (mouse_x < 2) 
        {
          view[current_view]->set_x_offset(view[current_view]->get_x_offset() + 
scroll_speed);
        } 
-      else if (controller->get_x() > CL_Display::get_width() - 3) 
+      else if (mouse_x > CL_Display::get_width() - 3) 
        {
          view[current_view]->set_x_offset(view[current_view]->get_x_offset() - 
scroll_speed);
        }
   
-      if (controller->get_y() < 2) 
+      if (mouse_y < 2) 
        {
          view[current_view]->set_y_offset(view[current_view]->get_y_offset() + 
scroll_speed);
        }
-      else if (controller->get_y() > CL_Display::get_height() - 3) 
+      else if (mouse_y > CL_Display::get_height() - 3) 
        {
          view[current_view]->set_y_offset(view[current_view]->get_y_offset() - 
scroll_speed);
        }
     }
 }
-#endif
-
-void
-Playfield::update(float delta)
-{
-  for(unsigned int i=0; i < view.size(); ++i)
-    {
-      view[i]->update (delta);
-
-      if (view[i]->is_current() && !mouse_scrolling)
-       { 
-         current_view = i;
-         current_pingu = current_pingu_find(mouse_x - view[i]->get_x_pos() - 
(view[i]->get_x_offset()),
-                                            mouse_y - view[i]->get_y_pos() - 
(view[i]->get_y_offset())); 
-         view[i]->set_pingu(current_pingu);
-         break;
-       }
-    }
-}
 
 void 
 Playfield::on_primary_button_press(int x, int y)
@@ -222,9 +246,10 @@
 void
 Playfield::on_secondary_button_release (int x, int y)
 {
+  UNUSED_ARG (x);
+  UNUSED_ARG (y);
+
   mouse_scrolling = false;
-  
-  if(x); if(y);
 }
 
 void
@@ -238,12 +263,6 @@
     {
       view[i]->on_pointer_move (x, y);
     }  
-
-  if (mouse_scrolling)
-    {
-      view[current_view]->shift_x_offset((scroll_center_x - mouse_x) / 5);
-      view[current_view]->shift_y_offset((scroll_center_y - mouse_y) / 5);
-    }
 }
 
 void





reply via email to

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