Forgive me for my accent) I have problems. I made a preloader. It works fine in the emulator. But the device just does not show it. Help me please.
----------------------------------------------------------------------------------------- -- -- main.lua -- ----------------------------------------------------------------------------------------- -- Подгрузка библиотек composer = require( "composer" ); widget = require( "widget" ); -- Переменные \_W = display.contentWidth; \_H = display.contentHeight; textures = {}; sounds = {}; -- Текстуры local filenames = { "background.jpg", "container.png", "next.png", "prev.png", "premium.png", "screenshot.png", "toy\_1.png", "toy\_2.png", "toy\_3.png", "toy\_4.png", "toy\_5.png", "toy\_6.png", "toy\_7.png", "toy\_8.png", "toy\_9.png", "toy\_10.png", "toy\_11p.png", "toy\_12p.png", "toy\_13p.png", "toy\_14p.png", "toy\_15p.png", "toy\_16p.png", "toy\_17p.png", "toy\_18p.png", "toy\_19p.png", "toy\_20p.png", "tree.png", "vk.png", "web.png" } -- Загрузка текстур в оперативную память local function loadingTextures() for i = 1, #filenames do textures[filenames[i]] = graphics.newTexture( { type="image", filename="img/"..filenames[i] } ); textures[filenames[i]]:preload(); end end -- Звуки local soundnames = { "game.mp3", "del.mp3", "select.mp3", "tree.mp3", "button.mp3", --"stop.mp3", "screen.wav" } -- Загрузка звука local function loadingSounds() for i = 1, #soundnames do sounds[soundnames[i]] = audio.loadSound( "snd/"..soundnames[i] ); end end -- Таймер function getTimer() return system.getTimer(); end -- Окно загрузки local screenLoader = nil; function loaderShow() if(screenLoader)then return false; end screenLoader = display.newGroup(); screenLoader.x = \_W/2; screenLoader.y = \_H/2; local screen = display.newRect( 0, 0, \_W, \_H ); screen:setFillColor( 0, 0, 0 ); screenLoader:insert(screen); local tfLoader = display.newText( "Loading:", 0, 0, "font/AA-Futured", 45 ); tfLoader:setTextColor( 1,1,1); screenLoader:insert(tfLoader); screenLoader.tf = tfLoader; end -- Окончание загрузки function loaderClose() if(screenLoader)then if(screenLoader.removeSelf)then screenLoader:removeSelf(); end end screenLoader = nil; composer.gotoScene( "scenes.game" ); garbage\_collector(); end -- Контроль процесса загрузки local function main() -- Скрываем статус бар display.setStatusBar(display.HiddenStatusBar); -- Создаём шаги для загрузки local loading\_steps = {}; table.insert(loading\_steps, function() loadingTextures(); end); table.insert(loading\_steps, function() loadingSounds(); end); local loading\_steps\_max = #loading\_steps+1; local st=getTimer(); loaderShow(); local function mainHandler(e) if(#loading\_steps\>0)then loading\_steps[1](); table.remove(loading\_steps, 1); if(screenLoader)then local loading\_p = math.floor((loading\_steps\_max - #loading\_steps)\*100/loading\_steps\_max); screenLoader.tf.text = "Loading"..': '..loading\_p..'%'; end return true; end loaderClose(); print('Time load: '..(getTimer()-st)..'ms'); Runtime:removeEventListener("enterFrame", mainHandler); end Runtime:addEventListener("enterFrame", mainHandler); end -- Сборщик мусора function garbage\_collector() for key in pairs(textures) do textures[key]:releaseSelf(); end textures = {}; end main();