pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/contrib/clanlib README,NONE,1.1 clanlib_g


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/contrib/clanlib README,NONE,1.1 clanlib_gui.diff,NONE,1.1 clanlib_x11_mousewheel.diff,NONE,1.1
Date: 30 Mar 2003 13:12:37 -0000

Update of /var/lib/cvs/Games/Pingus/contrib/clanlib
In directory dark:/tmp/cvs-serv7109/contrib/clanlib

Added Files:
        README clanlib_gui.diff clanlib_x11_mousewheel.diff 
Log Message:
- show editor help screen at startup, but only for the first time
- added solid-tutorial level
- added descriptions for all levels
- removed some more useless std::cout's
- added scrollwheel support, doesn't use the input/ stuff, since it was
  easier this way
- added some keyboard shortcuts for result/start screen
- added clanlib patches

--- NEW FILE: README ---
ClanLib Patches
===============

This directory contains a few ClanLib patches, they are not required to
compile Pingus, but strongly recomment.


Patches:
========

clanlib_gui.diff
================

 - Removes the close button of clanGUI windows, pressing them will render
   parts of the GUI unusable and might lead to a crash. Only the Editor is
   affected by this, not the game


clanlib_x11_mousewheel.diff
===========================

 - adds support for the mouse wheel in X11 (aka. button 4/5)


How to Patch:
=============

$ cd wherever/your/ClanLib/is/
$ patch -p1 < $PATCHFILE

Where $PATCHFILE is one of the above files.


# EOF #

--- NEW FILE: clanlib_gui.diff ---
Index: Sources/GUI/window_default.cpp
===================================================================
RCS file: /usr/local/cvsroot/Libs/ClanLib-0.6/Sources/GUI/window_default.cpp,v
retrieving revision 1.31
diff -u -r1.31 window_default.cpp
--- Sources/GUI/window_default.cpp      16 Jan 2002 19:50:41 -0000      1.31
+++ Sources/GUI/window_default.cpp      24 Oct 2002 13:03:10 -0000
@@ -42,15 +42,15 @@
 */
        // Create a close button on the titlebar
        CL_Rect rect(window->get_width() - 19, 3, window->get_width() - 3, 19);
-       button_close = new CL_Button(rect, "X", window, style);
+       //      button_close = new CL_Button(rect, "X", window, style);
 
-       slot_close = button_close->sig_clicked().connect(this, 
&CL_Window_Default::on_close);
+       //slot_close = button_close->sig_clicked().connect(this, 
&CL_Window_Default::on_close);
        slot_paint = window->sig_paint().connect(this, 
&CL_Window_Default::on_paint);
        slot_resize = window->sig_resize().connect(this, 
&CL_Window_Default::on_resize);
 
        // Move close button on window resize
-       layout.add_resize_position(button_close, CL_LayoutManager::x1, window, 
CL_LayoutManager::x2);
-       layout.add_resize_position(button_close, CL_LayoutManager::x2, window, 
CL_LayoutManager::x2);
+       //      layout.add_resize_position(button_close, CL_LayoutManager::x1, 
window, CL_LayoutManager::x2);
+       //      layout.add_resize_position(button_close, CL_LayoutManager::x2, 
window, CL_LayoutManager::x2);
 
        // Resize client area on window resize
        CL_Component *client_area = window->get_client_area();
@@ -65,7 +65,7 @@
        delete font_disabled;
 //     delete resize_handler;
        delete move_handler;
-       delete button_close;
+       //      delete button_close;
 }
 
 void CL_Window_Default::on_paint()
Index: Sources/GUI/window_default.h
===================================================================
RCS file: /usr/local/cvsroot/Libs/ClanLib-0.6/Sources/GUI/window_default.h,v
retrieving revision 1.14
diff -u -r1.14 window_default.h
--- Sources/GUI/window_default.h        28 Dec 2001 22:41:50 -0000      1.14
+++ Sources/GUI/window_default.h        24 Oct 2002 13:03:11 -0000
@@ -40,7 +40,7 @@
        void on_resize(int old_width, int old_height);
 
        CL_Window *window;
-       CL_Button *button_close;
+       //      CL_Button *button_close;
 
        CL_ComponentMoveHandler *move_handler;
        CL_ComponentResizeHandler *resize_handler;

--- NEW FILE: clanlib_x11_mousewheel.diff ---
Index: Sources/Display/Input/X11/mouse_x11.cpp
===================================================================
RCS file: 
/var/lib/cvs/Libs/ClanLib-0.6/Sources/Display/Input/X11/mouse_x11.cpp,v
retrieving revision 1.11
diff -u -r1.11 mouse_x11.cpp
--- Sources/Display/Input/X11/mouse_x11.cpp     17 May 2002 08:47:58 -0000      
1.11
+++ Sources/Display/Input/X11/mouse_x11.cpp     30 Mar 2003 13:09:11 -0000
@@ -54,6 +54,8 @@
        for (int i=0; i<NUM_MOUSE_BUTTONS; i++)
                buttons[i] = new CL_InputButton_Mouse_XWin();
        have_focus = false;
+
+        on_xevent_slot = CL_XWindow_CompatibleCard::sig_xevent.connect(this, 
&CL_Mouse_XWin::on_xevent);
 }
 
 CL_Mouse_XWin::~CL_Mouse_XWin()
@@ -63,6 +65,28 @@
 
        for (int i=0; i<NUM_MOUSE_BUTTONS; i++) delete buttons[i];
        delete[] buttons;
+}
+
+void
+CL_Mouse_XWin::on_xevent(XEvent& event)
+{
+  switch (event.type)
+    {
+    case ButtonPress:
+      {
+        if (event.xbutton.button == 4)
+          CL_Mouse::sig_button_press()(CL_Key(CL_MOUSE_WHEELUP, 
CL_Key::Pressed, -1, cursor->x, cursor->y));
+        else if (event.xbutton.button == 5)
+          CL_Mouse::sig_button_press()(CL_Key(CL_MOUSE_WHEELDOWN, 
CL_Key::Pressed, -1, cursor->x, cursor->y));
+      }
+      break;
+    case ButtonRelease:
+        if (event.xbutton.button == 4)
+          CL_Mouse::sig_button_release()(CL_Key(CL_MOUSE_WHEELUP, 
CL_Key::Released, -1, cursor->x, cursor->y));
+        else if (event.xbutton.button == 5)
+          CL_Mouse::sig_button_release()(CL_Key(CL_MOUSE_WHEELDOWN, 
CL_Key::Released, -1, cursor->x, cursor->y));
+      break;
+    }
 }
 
 CL_InputDevice::InputDeviceType CL_Mouse_XWin::get_type() const
Index: Sources/Display/Input/X11/mouse_x11.h
===================================================================
RCS file: /var/lib/cvs/Libs/ClanLib-0.6/Sources/Display/Input/X11/mouse_x11.h,v
retrieving revision 1.3
diff -u -r1.3 mouse_x11.h
--- Sources/Display/Input/X11/mouse_x11.h       17 May 2002 08:47:59 -0000      
1.3
+++ Sources/Display/Input/X11/mouse_x11.h       30 Mar 2003 13:09:12 -0000
@@ -78,6 +78,7 @@
        CL_InputButton_Mouse_XWin **buttons;
        CL_InputCursor_Mouse_XWin *cursor;
        CL_InputAxis_Mouse_XWin *axes;
+        CL_Slot on_xevent_slot;
 
 public:
        CL_Mouse_XWin(CL_XWindow_CompatibleCard *card);
@@ -100,6 +101,8 @@
        virtual CL_InputCursor *get_cursor(int cursor_num);
 
        virtual void keep_alive();
+
+        void on_xevent(XEvent&);
 };
 
 #endif /* USE_X11 */





reply via email to

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