rpms/SDLmm/devel SDLmm-0.1.8-asc-fixes.patch, NONE, 1.1 SDLmm.spec, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Hans de Goede (jwrdegoede) fedora-extras-commits at redhat.com
Wed Mar 21 19:48:15 UTC 2007


Author: jwrdegoede

Update of /cvs/extras/rpms/SDLmm/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv7108/devel

Modified Files:
	.cvsignore sources 
Added Files:
	SDLmm-0.1.8-asc-fixes.patch SDLmm.spec 
Log Message:
auto-import SDLmm-0.1.8-3.fc7 on branch devel from SDLmm-0.1.8-3.fc7.src.rpm

SDLmm-0.1.8-asc-fixes.patch:

--- NEW FILE SDLmm-0.1.8-asc-fixes.patch ---
--- SDLmm-0.1.8/src/sdlmm_event.h.asc	2001-08-07 01:30:47.000000000 +0200
+++ SDLmm-0.1.8/src/sdlmm_event.h	2007-03-21 20:10:33.000000000 +0100
@@ -173,10 +173,23 @@
       callbacks for the events you're interested in. See the
       EventHandler documentation for more details.
       \param handler the EventHandler which should handle the events.
-      \sa EventHandler
+      \sa EventHandler, HandleEvent
     */
     static void HandleEvents(EventHandler &handler);
     
+    //! Handle a single event using the specified EventHandler
+    /*!
+      This function calls the event callback methods. To actually
+      handle any events, you need to create a derivate of the
+      EventHandler class reimplementing the callbacks for the events
+      you're interested in. See the EventHandler documentation for more
+      details.
+      \param handler the EventHandler which should handle the events.
+      \param event the event to handle.
+      \sa EventHandler
+    */
+    static void HandleEvent(EventHandler &handler, SDL_Event& event);
+    
     //@}
 
     //! \name Keyboard Methods
--- SDLmm-0.1.8/src/sdlmm_srect.cpp.asc	2001-07-06 22:30:38.000000000 +0200
+++ SDLmm-0.1.8/src/sdlmm_srect.cpp	2007-03-21 20:38:09.000000000 +0100
@@ -25,6 +25,7 @@
 
 #include <SDL.h>
 #include "sdlmm_srect.h"
+#include "sdlmm_misc.h"
 
 namespace SDLmm {
   SRect::SRect() {
@@ -66,5 +67,29 @@
     w = bottom_right_point.x - upper_left_point.x;
     h = bottom_right_point.y - upper_left_point.y;
   }
+  
+  SRect Intersect(const SRect& r1, const SRect& r2) {
+    SRect r;
+    int w,h; /* needed as r.w, r.h are unsigned */
+    r.x = Max(r1.x, r2.x);
+    r.y = Max(r1.y, r2.y);
+    w = Min(r1.x + r1.w, r2.x + r2.w) - r.x;
+    h = Min(r1.y + r1.h, r2.y + r2.h) - r.y;
+    r.w = (w < 0) ? 0 : w;
+    r.h = (h < 0) ? 0 : h;
+    return r;
+  }
+
+  SRect Union(const SRect& r1, const SRect& r2) {
+    SRect r;
+    int w,h; /* signed width, height for the asserts */
+    r.x = Min(r1.x, r2.x);
+    r.y = Min(r1.y, r2.y);
+    r.w = w = Max(r1.x + r1.w, r2.x + r2.w) - r.x;
+    r.h = h = Max(r1.y + r1.h, r2.y + r2.h) - r.y;
+    ASSERT(w >= 0);
+    ASSERT(h >= 0);
+    return r;
+  }
 }
 
--- /dev/null	2007-03-21 19:50:09.971403527 +0100
+++ SDLmm-0.1.8/src/sdlmm_misc.h	2007-03-21 20:10:33.000000000 +0100
@@ -0,0 +1,46 @@
+/*
+ * SDLmm - a C++ wrapper for SDL and related libraries
+ * Copyright © 2001 David Hedbor <david at hedbor.org>
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef SDLMM_MISC_H
+#define SDLMM_MISC_H
+
+namespace SDLmm {
+  //! Find the maximum of two values.
+    template <class T>
+    inline const T& Max(const T& t1, const T& t2)
+    {
+        if (t1 < t2)
+            return t2;
+        else
+            return t1;
+    }
+    
+  //! Find the minimum of two values.
+    template <class T>
+    inline const T& Min(const T& t1, const T& t2)
+    {
+        if (t1 < t2)
+            return t1;
+        else
+            return t2;
+    }
+}
+
+#endif // SDLMM_MISC_H
--- SDLmm-0.1.8/src/sdlmm.h.asc	2001-07-26 22:06:43.000000000 +0200
+++ SDLmm-0.1.8/src/sdlmm.h	2007-03-21 20:10:33.000000000 +0100
@@ -123,6 +123,7 @@
 #undef PACKAGE
 #undef VERSION
 #include "sdlmm_global.h" 
+#include "sdlmm_misc.h" 
 #include "sdlmm_spoint.h"
 #include "sdlmm_srect.h"
 #include "sdlmm_color.h"
--- SDLmm-0.1.8/src/sdlmm_basesurface.cpp.asc	2001-07-17 00:32:43.000000000 +0200
+++ SDLmm-0.1.8/src/sdlmm_basesurface.cpp	2007-03-21 20:10:33.000000000 +0100
@@ -157,7 +157,7 @@
       break;
 
     case 4:
-      return *((const Uint32 *)(pixels()));
+      return *((const Uint32 *)(the_pixel));
       break;
 
     default:
--- SDLmm-0.1.8/src/sdlmm_event.cpp.asc	2001-06-26 03:04:30.000000000 +0200
+++ SDLmm-0.1.8/src/sdlmm_event.cpp	2007-03-21 20:10:33.000000000 +0100
@@ -105,78 +105,82 @@
   void Event::HandleEvents(EventHandler &handler) {
     SDL_Event event;
     while(SDL_PollEvent(&event)) {
-      bool ev_handled = false;
-      switch(event.type) {
-      case SDL_ACTIVEEVENT:
-	ev_handled = handler.HandleActiveEvent(event.active.gain == 1,
-					       event.active.state);
-	break;
-      case SDL_KEYDOWN:
-	ev_handled = handler.HandleKeyPressEvent(event.key.keysym);
-	break;
-      case SDL_KEYUP: 
-	ev_handled = handler.HandleKeyReleaseEvent(event.key.keysym);
-	break;
-      case SDL_MOUSEMOTION: 
-	ev_handled = handler.HandleMouseMotionEvent(event.motion.state,
-						    event.motion.x,
-						    event.motion.y,
-						    event.motion.xrel,
-						    event.motion.yrel);
-	break;
-      case SDL_MOUSEBUTTONDOWN:
-	ev_handled = handler.HandleMouseButtonPressEvent(event.button.button,
-							 event.button.x,
-							 event.button.y);
-	break;
-      case SDL_MOUSEBUTTONUP: 
-	ev_handled = handler.HandleMouseButtonReleaseEvent(event.button.button,
-							   event.button.x,
-							   event.button.y);
-	break;
-      case SDL_JOYAXISMOTION: 
-	ev_handled = handler.HandleJoyAxisEvent(event.jaxis.which,
-						event.jaxis.axis,
-						event.jaxis.value);
-	break;
-      case SDL_JOYBALLMOTION: 
-	ev_handled = handler.HandleJoyBallEvent(event.jball.which,
-						event.jball.ball,
-						event.jball.xrel,
-						event.jball.yrel);
-	break;
-      case SDL_JOYHATMOTION:
-	ev_handled = handler.HandleJoyHatEvent(event.jhat.which,
-					       event.jhat.hat,
-					       event.jhat.value);
-	break;
-      case SDL_JOYBUTTONDOWN:
-	ev_handled = handler.HandleJoyButtonPressEvent(event.jbutton.which,
-						       event.jbutton.button);
-	break;
-      case SDL_JOYBUTTONUP: 
-	ev_handled = handler.HandleJoyButtonReleaseEvent(event.jbutton.which,
-							 event.jbutton.button);
-	break;
-      case SDL_QUIT: 
-	ev_handled = handler.HandleQuitEvent();
-	break;
-      case SDL_SYSWMEVENT: 
-	ev_handled = handler.HandleSysWMEvent();
-	break;
-      case SDL_VIDEORESIZE:
-	ev_handled = handler.HandleResizeEvent(event.resize.w, event.resize.h);
-	break;
-      case SDL_USEREVENT: 
-	ev_handled = handler.HandleUserEvent(event.user.type,
-					     event.user.code,
-					     event.user.data1,
-					     event.user.data2);
-	break;
-      }
-      if(!ev_handled) {
-	handler.HandleEvent(event);
-      }
+      HandleEvent(handler, event);
+    }
+  }
+
+  void Event::HandleEvent(EventHandler &handler, SDL_Event& event) {
+    bool ev_handled = false;
+    switch(event.type) {
+    case SDL_ACTIVEEVENT:
+      ev_handled = handler.HandleActiveEvent(event.active.gain == 1,
+                                             event.active.state);
+      break;
+    case SDL_KEYDOWN:
+      ev_handled = handler.HandleKeyPressEvent(event.key.keysym);
+      break;
+    case SDL_KEYUP: 
+      ev_handled = handler.HandleKeyReleaseEvent(event.key.keysym);
+      break;
+    case SDL_MOUSEMOTION: 
+      ev_handled = handler.HandleMouseMotionEvent(event.motion.state,
+                                                  event.motion.x,
+                                                  event.motion.y,
+                                                  event.motion.xrel,
+                                                  event.motion.yrel);
+      break;
+    case SDL_MOUSEBUTTONDOWN:
+      ev_handled = handler.HandleMouseButtonPressEvent(event.button.button,
+                                                       event.button.x,
+                                                       event.button.y);
+      break;
+    case SDL_MOUSEBUTTONUP: 
+      ev_handled = handler.HandleMouseButtonReleaseEvent(event.button.button,
+                                                         event.button.x,
+                                                         event.button.y);
+      break;
+    case SDL_JOYAXISMOTION: 
+      ev_handled = handler.HandleJoyAxisEvent(event.jaxis.which,
+                                              event.jaxis.axis,
+                                              event.jaxis.value);
+      break;
+    case SDL_JOYBALLMOTION: 
+      ev_handled = handler.HandleJoyBallEvent(event.jball.which,
+                                              event.jball.ball,
+                                              event.jball.xrel,
+                                              event.jball.yrel);
+      break;
+    case SDL_JOYHATMOTION:
+      ev_handled = handler.HandleJoyHatEvent(event.jhat.which,
+                                             event.jhat.hat,
+                                             event.jhat.value);
+      break;
+    case SDL_JOYBUTTONDOWN:
+      ev_handled = handler.HandleJoyButtonPressEvent(event.jbutton.which,
+                                                     event.jbutton.button);
+      break;
+    case SDL_JOYBUTTONUP: 
+      ev_handled = handler.HandleJoyButtonReleaseEvent(event.jbutton.which,
+                                                       event.jbutton.button);
+      break;
+    case SDL_QUIT: 
+      ev_handled = handler.HandleQuitEvent();
+      break;
+    case SDL_SYSWMEVENT: 
+      ev_handled = handler.HandleSysWMEvent();
+      break;
+    case SDL_VIDEORESIZE:
+      ev_handled = handler.HandleResizeEvent(event.resize.w, event.resize.h);
+      break;
+    case SDL_USEREVENT: 
+      ev_handled = handler.HandleUserEvent(event.user.type,
+                                           event.user.code,
+                                           event.user.data1,
+                                           event.user.data2);
+      break;
+    }
+    if(!ev_handled) {
+      handler.HandleEvent(event);
     }
   }
 }
--- SDLmm-0.1.8/src/sdlmm_srect.h.asc	2001-08-07 01:29:58.000000000 +0200
+++ SDLmm-0.1.8/src/sdlmm_srect.h	2007-03-21 20:10:33.000000000 +0100
@@ -113,6 +113,20 @@
 	      (w == rect.w) && (h == rect.h));
     }
 
+    //! Move the position of the rectangle.
+    /*!
+      \param point difference to move by.
+    */
+    void Move(const SPoint& point) {
+        x += point.x; y += point.y;
+    }
+    
+    //! Is the point in the rectangle?
+    bool Contains(const SPoint& point) const {
+        return (x <= point.x) && (y <= point.y) &&
+               ((x+w) > point.x) && ((y+h) > point.y);
+    }
+    
     //! Get the coordinates for the upper left corner of the SRect
     /*! \return SPoint object */
     SPoint GetUpperLeft() const { return SPoint(x, y); }    
@@ -127,6 +141,16 @@
     SPoint GetBottomRight() const { return SPoint(x+w, y+h); }    
     
   };
+  
+  //! Get intersection rectangle of two rectangles
+  /*! The intersection rectangle is the largest rectangle that is
+      contained by both r1 and r2. */
+  SRect Intersect(const SRect& r1, const SRect& r2);
+
+  //! Get union rectangle of two rectangles
+  /*! The union rectangle is the smallest rectangle that is
+      contains both r1 and r2. */
+  SRect Union(const SRect& r1, const SRect& r2);
 }
 
 #endif // SDLMM_SRECT_H


--- NEW FILE SDLmm.spec ---
Name:           SDLmm
Version:        0.1.8
Release:        3%{?dist}
Summary:        C++ interface for the popular SDL library
Group:          System Environment/Libraries
License:        LGPL
URL:            http://sdlmm.sourceforge.net/
Source:         http://downloads.sourceforge.net/sdlmm/%{name}-%{version}.tar.bz2
Patch0:         SDLmm-0.1.8-asc-fixes.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:  SDL-devel

%description
SDLmm is a C++ glue for SDL, or the Simple DirectMedia Layer, which is a
generic API that provides low level access to audio, keyboard, mouse,
joystick, 3D hardware via OpenGL, and 2D framebuffer across multiple
platforms.

SDLmm aims to stay as close as possible to the C API while taking
advantage of native C++ features like object orientation.


%package devel
Summary:        Headers for developing programs that will use SDLmm
Group:          Development/Libraries
Requires:       %{name} = %{version}-%{release}
Requires:       SDL-devel automake

%description devel
This package contains the headers that programmers will need to develop
applications which will use SDLmm, the C++ interface to SDL.


%prep
%setup -q
%patch0 -p1 -z .asc
# configure adds -lm to the LIBS to link in while it isn't used, and doesn't
# add -lstdc++, so we fix those both in one go here.
sed -i 's|  LIBS="-lm $LIBS"|  LIBS="-lstdc++ $LIBS"|' configure
# configure wants to add -O3, however RPM_OPT_FLAGS specifies -O2
sed -i 's|-O3|-O2|g' configure


%build
%configure --disable-static
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
install -p -m 644 src/sdlmm_misc.h $RPM_BUILD_ROOT%{_includedir}/%{name}
rm $RPM_BUILD_ROOT%{_libdir}/lib%{name}.la


%clean
rm -rf $RPM_BUILD_ROOT


%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig


%files
%defattr(-, root, root, -)
%doc AUTHORS COPYING NEWS README
%{_libdir}/lib%{name}-0.1.so.*

%files devel
%defattr(-, root, root, -)
%doc docs/html/*.{html,gif}
%{_bindir}/sdlmm-config
%{_includedir}/%{name}
%{_libdir}/lib%{name}.so
%{_datadir}/aclocal/sdlmm.m4
%{_mandir}/man3/%{name}*.3.gz
%{_mandir}/man3/sdlmm.h.3.gz


%changelog
* Wed Mar 21 2007 Hans de Goede <j.w.r.degoede at hhs.nl> 0.1.8-3
- Advanced Strategic Command (asc), the reason to package this, turns out to
  use its own private copy of SDLmm. This copy contains a few additional
  functions and one bug fix. These additional functions are currently not used
  by asc. Still I have decided to add not only the fix but also the additional
  functions to be future proof (they do not change the ABI). The asc copy also
  made some eventhandler prototype changes to make the passed references const,
  I've not taken over these changes as those do change the API + ABI (and they
  are not needed for asc).
- Fix Source0 URL (bz 233139)

* Tue Mar 20 2007 Hans de Goede <j.w.r.degoede at hhs.nl> 0.1.8-2
- Fix a bunch of undefined non weak symbol warnings (bz 233139)
- Stop configure from passing -O3 to the compiler

* Sun Mar 18 2007 Hans de Goede <j.w.r.degoede at hhs.nl> 0.1.8-1
- Initial Fedora Extras package based on specfile by Che (newrpms)


Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/SDLmm/devel/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	21 Mar 2007 19:25:32 -0000	1.1
+++ .cvsignore	21 Mar 2007 19:47:42 -0000	1.2
@@ -0,0 +1 @@
+SDLmm-0.1.8.tar.bz2


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/SDLmm/devel/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	21 Mar 2007 19:25:32 -0000	1.1
+++ sources	21 Mar 2007 19:47:42 -0000	1.2
@@ -0,0 +1 @@
+0a05d27d1aed72af3c7a37b6378f50e5  SDLmm-0.1.8.tar.bz2




More information about the scm-commits mailing list