diff options
author | sapier <Sapier at GMX dot net> | 2014-05-30 03:07:48 +0200 |
---|---|---|
committer | sapier <Sapier at GMX dot net> | 2014-06-12 23:15:05 +0200 |
commit | 003634e049d599b8ed5ae3ba6b3250e9eb7741ca (patch) | |
tree | 9212aaf1b1d6bf5384eb54f82a0f986be5c7848f /src/porting.h | |
parent | 763a511ca52db587f18e94757ce9462e4cb3da24 (diff) | |
download | minetest-003634e049d599b8ed5ae3ba6b3250e9eb7741ca.tar.gz minetest-003634e049d599b8ed5ae3ba6b3250e9eb7741ca.tar.bz2 minetest-003634e049d599b8ed5ae3ba6b3250e9eb7741ca.zip |
Add support for exiting formspecs by doubleclicking outside
Diffstat (limited to 'src/porting.h')
-rw-r--r-- | src/porting.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/porting.h b/src/porting.h index 937ca9464..383d4377a 100644 --- a/src/porting.h +++ b/src/porting.h @@ -275,6 +275,21 @@ inline u32 getTime(TimePrecision prec) return 0; } +/** + * Delta calculation function taking two 32bit arguments. + * @param old_time_ms old time for delta calculation (order is relevant!) + * @param new_time_ms new time for delta calculation (order is relevant!) + * @return positive 32bit delta value + */ +inline u32 getDeltaMs(u32 old_time_ms, u32 new_time_ms) +{ + if (new_time_ms >= old_time_ms) { + return (new_time_ms - old_time_ms); + } else { + return (old_time_ms - new_time_ms); + } +} + #if defined(linux) || defined(__linux) #include <sys/prctl.h> |