function GameScreen:InitScreen()
    self:LoadScreen()
    
    self:FadeOut();
    self.disable = false
    self.no_sound = nil
    ItemSetDepth("menu_button_screen", LAYERS.FRONT_MOST)
    
    self.old_game_mode = HUDScreen:GetHUDMode();
    HUDScreen:SetMenuOnlyMode()
end

function GameScreen:OnClick(item_name)
    if(clApplication.game_pause) then return end
    
    if(item_name == "wp_back_trigger" and not self.disable) then
        HUDScreen:SetHUDMode(self.old_game_mode);
        
        self.disable = true;
        self:FadeIn(0.5);
        if(self.end_fun) then
            self:end_fun()
            self.end_fun = nil
        end
        DelayedExec(0.7, function() 
            clScreenManager:remove_screen(self); 
        end)
    end
end

function GameScreen:ShowWallpaper(_resource, _pos_x, _pos_y)
    if(not self.no_sound) then
        SoundPlay("sound/note.ogg")
    end
    
    self:CreateObj(OBJ_TYPE.NO_ACTIVE, "letter", _resource, _pos_x, _pos_y);
end

function GameScreen:LoadScreen()
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "wp_back_trigger", "graphics/trigger", 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT);
    ItemSetOpacity("wp_back_trigger", 0.5)
end

function GameScreen:UnLoadScreen()
    
    cpp_application_remove_window(self.name);
	self.win = false;
end