pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src blitter.hxx,1.2,1.3 pingus_resource.c


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src blitter.hxx,1.2,1.3 pingus_resource.cxx,1.4,1.5
Date: 22 Jun 2002 14:29:20 -0000

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

Modified Files:
        blitter.hxx pingus_resource.cxx 
Log Message:
- added mtime checker for the thumbnails
- added version info for the thumbnail

Index: blitter.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/blitter.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- blitter.hxx 13 Jun 2002 19:53:21 -0000      1.2
+++ blitter.hxx 22 Jun 2002 14:29:17 -0000      1.3
@@ -77,7 +77,8 @@
   static CL_Surface scale_surface (const CL_Surface& sur, int width, int 
height);
 
   /** Creates a new canvas with the given width and height and
-      stretches the source surface onto it
+      stretches the source surface onto it, the caller is responsible
+      to delete the returned CL_Canvas.
 
       @param sur The source surface
       @param width The new width of the surface. 

Index: pingus_resource.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingus_resource.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- pingus_resource.cxx 20 Jun 2002 16:48:11 -0000      1.4
+++ pingus_resource.cxx 22 Jun 2002 14:29:17 -0000      1.5
@@ -17,7 +17,11 @@
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
 #include <assert.h>
+
 #include <ClanLib/png.h>
 #include <ClanLib/Display/Font/font.h>
 #include "system.hxx"
@@ -243,6 +247,35 @@
                    << " => " << i->second.get_reference_count () << std::endl;
          surface_map.erase(i);
        }
+    }
+}
+
+unsigned int
+PingusResource::get_mtime (const std::string& res_name,
+                          const std::string& datafile)
+{
+  try 
+    {
+      CL_ResourceManager* res_man = PingusResource::get(datafile);
+      CL_Resource& res = res_man->get_resource(res_name);
+  
+      std::string filename = res.get_full_location();
+
+#ifndef WIN32
+      struct stat stat_buf;
+      if (stat(filename.c_str(), &stat_buf) == 0)
+       return stat_buf.st_mtime;
+      else
+       return 0;
+#else
+      // FIXME: Win32 mtime getter not implemented
+      return 0;
+#endif
+    } 
+  catch (CL_Error& err) 
+    {
+      std::cout << "PingusResource::get_mtime: CL_Error: " << err.message << 
std::endl;
+      return 0;
     }
 }
 




reply via email to

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