aboutsummaryrefslogtreecommitdiff
path: root/src/collision.cpp
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2014-11-18 15:24:51 -0500
committerCraig Robbins <kde.psych@gmail.com>2014-11-19 22:31:57 +1000
commitfeb307029991da07bf22eb42828c6d78cb405a62 (patch)
tree28231bc7886b2c25775a9aef5f45d26c7ddb28dd /src/collision.cpp
parent55e4c35eaf25a2b11192a2f7f011f7dc6d8c32d4 (diff)
downloadminetest-feb307029991da07bf22eb42828c6d78cb405a62.tar.gz
minetest-feb307029991da07bf22eb42828c6d78cb405a62.tar.bz2
minetest-feb307029991da07bf22eb42828c6d78cb405a62.zip
Add gettext to Travis build
Signed-off-by: Craig Robbins <kde.psych@gmail.com>
Diffstat (limited to 'src/collision.cpp')
0 files changed, 0 insertions, 0 deletions
of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "tileanimation.h" #include "util/serialize.h" void TileAnimationParams::serialize(std::ostream &os, u8 tiledef_version) const { writeU8(os, type); if (type == TAT_VERTICAL_FRAMES) { writeU16(os, vertical_frames.aspect_w); writeU16(os, vertical_frames.aspect_h); writeF1000(os, vertical_frames.length); } else if (type == TAT_SHEET_2D) { writeU8(os, sheet_2d.frames_w); writeU8(os, sheet_2d.frames_h); writeF1000(os, sheet_2d.frame_length); } } void TileAnimationParams::deSerialize(std::istream &is, u8 tiledef_version) { type = (TileAnimationType) readU8(is); if (type == TAT_VERTICAL_FRAMES) { vertical_frames.aspect_w = readU16(is); vertical_frames.aspect_h = readU16(is); vertical_frames.length = readF1000(is); } else if (type == TAT_SHEET_2D) { sheet_2d.frames_w = readU8(is); sheet_2d.frames_h = readU8(is); sheet_2d.frame_length = readF1000(is); } } void TileAnimationParams::determineParams(v2u32 texture_size, int *frame_count, int *frame_length_ms, v2u32 *frame_size) const { if (type == TAT_VERTICAL_FRAMES) { int frame_height = (float)texture_size.X / (float)vertical_frames.aspect_w * (float)vertical_frames.aspect_h; int _frame_count = texture_size.Y / frame_height; if (frame_count) *frame_count = _frame_count; if (frame_length_ms) *frame_length_ms = 1000.0 * vertical_frames.length / _frame_count; if (frame_size) *frame_size = v2u32(texture_size.X, frame_height);