pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src/gui surface_button.cxx,1.5,1.6 surfac


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src/gui surface_button.cxx,1.5,1.6 surface_button.hxx,1.4,1.5
Date: 10 Mar 2003 11:29:53 -0000

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

Modified Files:
        surface_button.cxx surface_button.hxx 
Log Message:
added framework for result screen


Index: surface_button.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/gui/surface_button.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- surface_button.cxx  14 Oct 2002 11:15:15 -0000      1.5
+++ surface_button.cxx  10 Mar 2003 11:29:50 -0000      1.6
@@ -18,6 +18,7 @@
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include "../pingus_resource.hxx"
+#include "graphic_context.hxx"
 #include "surface_button.hxx"
 
 using namespace GUI;
@@ -38,14 +39,14 @@
 }
 
 void
-SurfaceButton::draw ()
+SurfaceButton::draw (GraphicContext& gc)
 {
   if (pressed && mouse_over)
-    button_pressed_surface.put_screen (x_pos, y_pos);
+    gc.draw(button_pressed_surface, x_pos, y_pos);
   else if (!pressed && mouse_over)
-    button_mouse_over_surface.put_screen (x_pos, y_pos);
+    gc.draw(button_mouse_over_surface, x_pos, y_pos);
   else
-    button_surface.put_screen (x_pos, y_pos);
+    gc.draw(button_surface, x_pos, y_pos);
 }
 
 bool
@@ -97,7 +98,8 @@
 SurfaceButton::on_primary_button_click (int x, int y)
 {
   std::cout << "Surfacebutton got click" << std::endl;
-  
+
+  on_click();
   UNUSED_ARG(x);
   UNUSED_ARG(y);
 }

Index: surface_button.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/gui/surface_button.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- surface_button.hxx  27 Sep 2002 11:26:46 -0000      1.4
+++ surface_button.hxx  10 Mar 2003 11:29:50 -0000      1.5
@@ -27,40 +27,41 @@
 
 namespace GUI
 {
-  /** A simple surface button, which different surfaces for pressed,
-      released and mouse over */
-  class SurfaceButton : public Component
-  {
-  private:
-    int x_pos;
-    int y_pos;
-    CL_Surface button_surface;
-    CL_Surface button_pressed_surface;
-    CL_Surface button_mouse_over_surface;
+/** A simple surface button, which different surfaces for pressed,
+    released and mouse over */
+class SurfaceButton : public Component
+{
+private:
+  int x_pos;
+  int y_pos;
+  CL_Surface button_surface;
+  CL_Surface button_pressed_surface;
+  CL_Surface button_mouse_over_surface;
 
-    bool pressed;
-    bool mouse_over;
-  public:
-    SurfaceButton (int x_pos, int y_pos,
-                  const ResDescriptor& button_surface,
-                  const ResDescriptor& button_pressed_surface,
-                  const ResDescriptor& button_mouse_over_surface);
-    virtual ~SurfaceButton ();
+  bool pressed;
+  bool mouse_over;
+public:
+  SurfaceButton (int x_pos, int y_pos,
+                 const ResDescriptor& button_surface,
+                 const ResDescriptor& button_pressed_surface,
+                 const ResDescriptor& button_mouse_over_surface);
+  virtual ~SurfaceButton ();
 
-    void draw ();
-    bool is_at (int x, int y);
+  void draw (GraphicContext& gc);
+  bool is_at (int x, int y);
 
-    void on_primary_button_press (int x, int y);
-    void on_primary_button_release (int x, int y);
-    void on_primary_button_click (int x, int y);
+  void on_primary_button_press (int x, int y);
+  void on_primary_button_release (int x, int y);
+  void on_primary_button_click (int x, int y);
 
-    void on_pointer_enter ();
-    void on_pointer_leave ();
+  void on_pointer_enter ();
+  void on_pointer_leave ();
     
-  private:
-    SurfaceButton (const SurfaceButton&);
-    SurfaceButton& operator= (const SurfaceButton&);
-  };
+  virtual void on_click() =0;
+private:
+  SurfaceButton (const SurfaceButton&);
+  SurfaceButton& operator= (const SurfaceButton&);
+};
 }
 
 #endif






reply via email to

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