[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r2858 - in branches/pingus_sdl/src: . worldmap
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r2858 - in branches/pingus_sdl/src: . worldmap |
Date: |
Sun, 12 Aug 2007 16:24:56 +0200 |
Author: grumbel
Date: 2007-08-12 16:24:55 +0200 (Sun, 12 Aug 2007)
New Revision: 2858
Modified:
branches/pingus_sdl/src/math.hpp
branches/pingus_sdl/src/worldmap/worldmap.cpp
Log:
- renamed Math::mid to Math::clamp
Modified: branches/pingus_sdl/src/math.hpp
===================================================================
--- branches/pingus_sdl/src/math.hpp 2007-08-12 14:17:33 UTC (rev 2857)
+++ branches/pingus_sdl/src/math.hpp 2007-08-12 14:24:55 UTC (rev 2858)
@@ -61,10 +61,10 @@
}
template<class T>
-T mid (const T& a, const T& b, const T& c)
+T clamp (const T& low, const T& v, const T& high)
{
- assert(a <= c);
- return max((a), min((b), (c)));
+ assert(low <= high);
+ return max((low), min((v), (high)));
}
inline
Modified: branches/pingus_sdl/src/worldmap/worldmap.cpp
===================================================================
--- branches/pingus_sdl/src/worldmap/worldmap.cpp 2007-08-12 14:17:33 UTC
(rev 2857)
+++ branches/pingus_sdl/src/worldmap/worldmap.cpp 2007-08-12 14:24:55 UTC
(rev 2858)
@@ -164,7 +164,7 @@
min = float(width - gc.get_width()/2);
max = float(gc.get_width()/2);
}
- pingu_pos.x = Math::mid(min, pingu_pos.x, max);
+ pingu_pos.x = Math::clamp(min, pingu_pos.x, max);
if (height >= gc.get_height())
{
@@ -176,7 +176,7 @@
min = float(height - gc.get_height()/2);
max = float(gc.get_height()/2);
}
- pingu_pos.y = Math::mid(min, pingu_pos.x, max);
+ pingu_pos.y = Math::clamp(min, pingu_pos.x, max);
DrawingContext* display_gc = new DrawingContext();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r2858 - in branches/pingus_sdl/src: . worldmap,
grumbel at BerliOS <=