function OnSceneLoad(screen)
    LoadData(screen)

    game_state = {}
    custom_cursors = {}
    locked_objects = {}
    
    local movie = CreateMovieEntity()
    movie:SetZ(200)
    movie:AttachTo(screen)
	movie:SetXY(512,384)
	movie:SetScale(1.6)
	movie:SetRepeat(false)
    movie:PlayMovie('data/video/intro.ogg', 'data/Music/intro_music.ogg')
    game_state.movie = movie
    
    create_button(screen, "button_skip_intro_up", "button_skip_intro_over", "button_skip_intro_down", "SkipIntro", 936, 31, 800)
    
    GetGameApp():SetDontSuspend(false)
end

function CreateTextIntro(screen, text, start_time, end_time)
    local text_width    = 920
    local text_height   = 200

    local text_title = CreateTextEntity('Schoolbook20', GetString(text))
    text_title:AttachTo( screen )
	text_title:SetScale(1.0)
	text_title:SetZ(500)
	text_title:SetXY(70, 580)
	text_title:SetBorderSize(text_width, text_height)
	text_title:SetTextAlignment(HGETEXT_TOP + HGETEXT_CENTER)
	
	local af = CreateAnimationEffector()
    af:AttachTo(text_title)
    af:SetKey(_TRACK_O, 0.0,                    0)
    af:SetKey(_TRACK_O, start_time - 0.3,       0)
    af:SetKey(_TRACK_O, start_time,             1)
    af:SetKey(_TRACK_O, end_time - 0.3,         1)
    af:SetKey(_TRACK_O, end_time,               0)
    af:Play()
	
	return text_title;
end

function OnSceneFree()
    FreeData()
end

function OnScreenShown(fade_out)
end

function OnHiddenComics()
end

function OnMinigameCompleted(mini_game)
end

function OnUpdate(dt)
    DefaultOnUpdate(dt)
    
    if game_state.movie:IsPlaying() == false then
        StartFirstLevel()   
    end
    
end

function OnLose()
end

function OnExit()
end

function OnButtonMouseEnter(title)
end

function OnButtonMouseLeave(title)
end

function OnObjectMouseEnter(object)
    DefaultOnObjectMouseEnter(object)
end

function OnObjectMouseLeave(object)
    DefaultOnObjectMouseLeave(object)
end

function OnObjectMouseDown(object)
end

function OnObjectMouseUp(object)
end

function OnObjectRightMouseDown(object)
end

function OnObjectRightMouseUp(object)
end

function OnObjectFound(object)
    DefaultOnObjectFound(object)
end

function OnToolFound(tool)
end

function OnToolApply(tool, object)
    DefaultOnToolApply(tool, object);
end

function OnButtonPress(title)
    DefaultOnButtonPress(title)
    
    if title == 'SkipIntro' then
        StartFirstLevel()
    end
end

function StartFirstLevel()
    local current_screen = GetGameManager():GetCurrentScreen()
    current_screen:ScreenDestroy()
    
    StartLevelById(1)
end

function OnMouseMove(previous_pos, current_pos)
end

function OnSetTool(tool)
end

function OnLostFocus()
end

function OnGainFocus()
end

-- CLEAR_ON_SAVE_BEGIN
-- Do not edit code listed below (generated by the editor on each save)
function LoadData(screen)
	local anim = CreateAnimation('data/Texture/Scenes/Common/pixel.jpg',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('pixel_maska',anim,512,384,110,0,128,96)
	local anim = CreateAnimation('data/Texture/GUI/Button/button_skip_intro.png',0,0,201,74,1,0)
	anim:SetHotSpot(100,37)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('button_skip_intro_up',anim,936,31,150,0,1,1)
	local anim = CreateAnimation('data/Texture/GUI/Button/button_skip_intro.png',0,74,201,74,1,0)
	anim:SetHotSpot(100,37)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('button_skip_intro_over',anim,927,366,150,0,1,1)
	local anim = CreateAnimation('data/Texture/GUI/Button/button_skip_intro.png',0,148,201,74,1,0)
	anim:SetHotSpot(100,37)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('button_skip_intro_down',anim,929,418,150,0,1,1)
end

function FreeData(screen)
end
-- CLEAR_ON_SAVE_END
