function ItemSetOpacity(item_name, opacity)
    cpp_item_set_opacity(item_name, opacity);
end

function ItemRemove(win_name, item_name, time)
    if(time) then
        ItemChangeOpacity(item_name, 0.0, time)
        DelayedExec(time, function()
            cpp_item_remove(win_name, item_name);
        end)
    else
        cpp_item_remove(win_name, item_name);
    end
end

function ItemSetAngle(item_name, angle)
    cpp_item_set_angle(item_name, angle)
end

function ItemGetAngle(item_name)
    return cpp_item_get_angle(item_name)
end

function ItemSetEnable(item_name, _enable)
    cpp_item_set_enabled(item_name, _enable);
end

function ItemGetX(item_name)
    return cpp_item_get_X(item_name);
end

function ItemGetY(item_name)
    return cpp_item_get_Y(item_name);
end

function ItemGetHotSpotX(item_name)
    return cpp_item_get_hot_spot_X(item_name);
end

function ItemGetHotSpotY(item_name)
    return cpp_item_get_hot_spot_Y(item_name);
end


function ItemGetScrX(item_name)
    return cpp_item_get_scr_X(item_name);
end

function ItemGetScrY(item_name)
    return cpp_item_get_scr_Y(item_name);
end

function ItemGetWidth(item_name)  
    return cpp_item_get_width(item_name);
end

function ItemGetHeight(item_name)  
    return cpp_item_get_height(item_name);
end

function ItemSetPosition(item_name, pos_x, pos_y)
    cpp_item_set_position(item_name, pos_x, pos_y)
end

function ItemSetHotSpot(item_name, hot_spot_x , hot_spot_y)
    cpp_item_set_hot_spot(item_name, hot_spot_x , hot_spot_y)
end

function ItemSetSize(item_name, width, height)
    cpp_item_set_size(item_name, width, height)
end

function ItemSetScale(item_name, scale)
    cpp_item_set_scale(item_name, scale)
end

function ItemSetScaleX(item_name, scale)
    cpp_item_set_scale_X(item_name, scale)
end

function ItemSetScaleY(item_name, scale)
    cpp_item_set_scale_Y(item_name, scale)
end

function ItemSetColor(item_name, r, g, b)
    cpp_item_set_color(item_name, r, g, b)
end

function ItemSetDepth(item_name, depth)
    cpp_item_set_depth(item_name, depth)
end

function ItemSetDepthByOther(item_name, item_name2)
    cpp_item_set_depth_by_other(item_name, item_name2)
end

function ItemSetType(item_name, type)
    cpp_item_set_type(item_name, type)
end

function CreateLabelShadow(item_name, dx, dy)
    cpp_create_label_shadow(item_name, dx, dy)
end

function SetLabelAlign(item_name, aling)
    cpp_set_label_align(item_name, aling)
end

function SetLabelText(label_name, string)
    cpp_set_label_text(label_name, string)
end

function ItemAttachChild(parent_name, child_name)
    cpp_item_attach_child(parent_name, child_name);
end

function AnimationStop(win_name, anim_name)
    cpp_animation_stop(win_name, anim_name)
end

function AnimationPlay(win_name, anim_name)
    cpp_animation_play(win_name, anim_name)
end

function AnimationSetFrame(win_name, anim_name, frame)
    cpp_animation_set_frame(win_name, anim_name, frame)
end

function ItemAttachChildInCurPos(parent_name, child_name)
    cpp_item_set_position(child_name, cpp_item_get_scr_X(child_name) - cpp_item_get_scr_X(parent_name), cpp_item_get_scr_Y(child_name) - cpp_item_get_scr_Y(parent_name))
    cpp_item_attach_child(parent_name, child_name)
end

function ItemFadeInOut(item_name, fade_time, opacity_start, opacity_end, dt)
    if(dt == nil) then dt = 0 end    
     
    local fade_in_out_eff = {
	    {key=EFFECTOR_MODIFIER.KEY_OPACITY, start_time = dt, time = fade_time, start_value = opacity_start, end_value = opacity_end},
	    {key=EFFECTOR_MODIFIER.KEY_OPACITY, start_time = dt + fade_time, time = fade_time, end_value = opacity_start},
    }
    EffectorPlay(fade_in_out_eff, item_name, true)
end

function ItemMove(item_name, dx, dy, moving_time, dt)
    if(dt == nil) then dt = 0 end    

    local moving_eff = {
	    {key=EFFECTOR_MODIFIER.KEY_MOVE_X, start_time = dt, time = moving_time, delta_value = dx},
	    {key=EFFECTOR_MODIFIER.KEY_MOVE_Y, start_time = dt, time = moving_time, delta_value = dy},
    }
    EffectorPlay(moving_eff, item_name, false)
end

function ItemChangeOpacity(item_name, new_opacity, change_time, dt)
    if(dt == nil) then dt = 0 end    

    local moving_eff = {
	    {key=EFFECTOR_MODIFIER.KEY_OPACITY, start_time = dt, time = change_time, end_value = new_opacity},
    }
    EffectorPlay(moving_eff, item_name, false)
end


function ItemMoveTo(item_name, new_x, new_y, moving_time, dt)
    if(dt == nil) then dt = 0 end   
    
    local moving_eff = {
	    {key=EFFECTOR_MODIFIER.KEY_MOVE_X, start_time = dt, time = moving_time, end_value = new_x},
	    {key=EFFECTOR_MODIFIER.KEY_MOVE_Y, start_time = dt, time = moving_time, end_value = new_y},
    }
    EffectorPlay(moving_eff, item_name, false)
end

function ItemRotate(item_name, angle, rotating_time, dt)
    if(dt == nil) then dt = 0 end   
    
    local rotating_eff = {
	    {key=EFFECTOR_MODIFIER.KEY_ROTATE, start_time = dt, time = rotating_time, delta_value = angle},
    }
    EffectorPlay(rotating_eff, item_name, false)
end

function ItemChangeSize(item_name, new_size_x, new_size_y, change_time, dt)
    if(dt == nil) then dt = 0 end   
    
    local rotating_eff = {
	    {key=EFFECTOR_MODIFIER.KEY_SCALE_X, start_time = dt, time = change_time, end_value = new_size_x},
	    {key=EFFECTOR_MODIFIER.KEY_SCALE_Y, start_time = dt, time = change_time, end_value = new_size_y},
    }
    EffectorPlay(rotating_eff, item_name, false)
end