aboutsummaryrefslogtreecommitdiff
path: root/games/minimal/mods/give_initial_stuff/init.lua
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2020-04-16 20:43:49 +0200
committerGitHub <noreply@github.com>2020-04-16 20:43:49 +0200
commit7539267d370ae9a1b547008a937bd7f57bece541 (patch)
treef4a04951d7d6e5a4000e0c9bd606e457679e0374 /games/minimal/mods/give_initial_stuff/init.lua
parent093e79ea78c872293386bf10b76416ff284ac5b6 (diff)
downloadminetest-7539267d370ae9a1b547008a937bd7f57bece541.tar.gz
minetest-7539267d370ae9a1b547008a937bd7f57bece541.tar.bz2
minetest-7539267d370ae9a1b547008a937bd7f57bece541.zip
Add an option to disable unittest build, & disable them on Docker build (#9677)
Diffstat (limited to 'games/minimal/mods/give_initial_stuff/init.lua')
0 files changed, 0 insertions, 0 deletions
s="hl opt">::EGUIET_ELEMENT, env, parent, id, rectangle), m_tsrc(tsrc) { m_texture = m_tsrc->getTexture(texture_name); m_frame_count = std::max(frame_count, 1); m_frame_duration = std::max(frame_duration, 0); if (m_texture != nullptr) { core::dimension2d<u32> size = m_texture->getOriginalSize(); if (size.Height < (u64)m_frame_count) m_frame_count = size.Height; } else { // No need to step an animation if we have nothing to draw m_frame_count = 1; } } void GUIAnimatedImage::draw() { // Render the current frame if (m_texture != nullptr) { video::IVideoDriver *driver = Environment->getVideoDriver(); const video::SColor color(255, 255, 255, 255); const video::SColor colors[] = {color, color, color, color}; core::dimension2d<u32> size = m_texture->getOriginalSize(); size.Height /= m_frame_count; draw2DImageFilterScaled(driver, m_texture, AbsoluteRect, core::rect<s32>(core::position2d<s32>(0, size.Height * m_frame_idx), size), NoClip ? nullptr : &AbsoluteClippingRect, colors, true); } // Step the animation if (m_frame_count > 1 && m_frame_duration > 0) { // Determine the delta time to step u64 new_global_time = porting::getTimeMs(); if (m_global_time > 0) m_frame_time += new_global_time - m_global_time; m_global_time = new_global_time; // Advance by the number of elapsed frames, looping if necessary m_frame_idx += u32(m_frame_time / m_frame_duration); m_frame_idx %= m_frame_count; // If 1 or more frames have elapsed, reset the frame time counter with // the remainder m_frame_time %= m_frame_duration; } } void GUIAnimatedImage::setFrameIndex(s32 frame) { s32 idx = std::max(frame, 0); if (idx > 0 && idx < m_frame_count) m_frame_idx = idx; }