Advertisement
xerpi

pause menu example

Jul 23rd, 2011
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.22 KB | None | 0 0
  1. function pause()   
  2.     tmp = screen.toimage() --first make a screenshot   
  3.     while true do --start the pause loop
  4.         controls.read() --read the controls
  5.         tmp:blit(0,0) --blit the tmp image
  6.         -----------------Here your stuff
  7.         -------If you want to use your own images, delete tmp = screen.toimage() and tmp:blit(0,0) and tmp:free()
  8.         --if you want to return to the menu pressing triangle for example and the menu is main_menu() function:
  9.             if controls.press("triangle") theen
  10.                 --first free the tmp image
  11.                 main_menu() --return to the main menu
  12.             end
  13.         --------------------------------
  14.         if controls.press("start") or controls.press("circle") then
  15.             break   --breaks this bucle so the game continues
  16.         end    
  17.         screen.flip() --swap buffers
  18.     end --end the puase loop
  19.     tmp:free() --free the tmp image
  20. end
  21.  
  22. --the while true do
  23. while true do
  24. controls.read()
  25.  
  26. if controsls.press("start") then    --when press start
  27.     pause() --  Pause :)
  28. end
  29. if controls.select() then make_error() end-- This make an error so when luadev gets an error, it connects to usb,
  30.                                 --then you can update your code and if you press cross luadev will restart
  31.                                 -- and your code will be updasted without returning to the xmb
  32. screen.flip()
  33. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement