Advertisement
Qivex

QFormat-Example Countdown

Apr 4th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.89 KB | None | 0 0
  1. os.loadAPI("apis/qmain")
  2. os.loadAPI("apis/qformat")
  3.  
  4. mon = qmain.setDefaultScreen("top")
  5. mon.setTextScale(0.5)
  6.  
  7. image = {}      --möglichst kompakte Speicherung -> keine ansprechende Formattierung
  8. image[0] = {{" ggg","g   g","g   g","g   g","g   g","g   g"," ggg"}}    --nur Hintergrundfarbe gesetzt
  9. image[1] = {{"  g"," gg","g g","  g","  g","  g"," ggg"}}
  10. image[2] = {{" ggg","g   g","    g","  gg"," g","g","ggggg"}}
  11. image[3] = {{" ggg","g   g","    g","  gg","    g","g   g"," ggg"}}
  12.  
  13. function startCountdown()
  14.     for remaining_time = 3, 0, -1 do
  15.         mon.setBackgroundColor(qmain.convertColor("c"))         --Grauer Hintergrund
  16.         mon.clear()
  17.         local number = image[remaining_time]                    --Zahl als Bild
  18.         local number_loaded = qformat.loadImage(number)
  19.         qformat.drawImage(number_loaded, {16, 9})               --Diese 3 Zeilen kann man auch in Eine schachteln
  20.         sleep(1)
  21.     end
  22. end
  23.  
  24. startCountdown()
  25. qmain.clear()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement