Facebook
From navidjz, 1 Month ago, written in Lua.
Embed
Download Paste or View Raw
Hits: 151
  1.  
  2. local screensize = vec2(ac.getSim().windowWidth,ac.getSim().windowHeight)
  3. local timer = 5
  4.  
  5. --image_0 is used as the rules splash screen
  6. local image_0 = {
  7.     ['src'] = 'https://s8.uupload.ir/files/redd_sskf.png',
  8.     ['sizeX'] = 512, --size of your image in pixels
  9.     ['sizeY'] = 256, --size of your image in pixels
  10.     ['paddingX'] = screensize.x/2-512/2, --this makes it sit in the centre of the screen
  11.     ['paddingY'] = -50 --this moves it up 50 pixels
  12. }
  13.  
  14. --image_1 is used as the icon
  15. local image_1 = {
  16.     ['src'] = 'https://s8.uupload.ir/files/redd_sskf.png',
  17.     ['sizeX'] = 256,
  18.     ['sizeY'] = 256,
  19.     ['paddingX'] = 50, --use this to align it, currently 50 pixels from top right
  20.     ['paddingY'] = 50 --use this to align it, currently 50 pixels from top right
  21. }
  22.  
  23. --this waits for the driver to not be in the setup screen, then starts the timer for the rule splash image
  24. function script.update(dt)
  25.     ac.debug('isInMainMenu', ac.getSim().isInMainMenu)
  26.     if not ac.getSim().isInMainMenu then
  27.         if timer >= 0 then
  28.             timer = timer - dt
  29.         end        
  30.     end
  31. end
  32.  
  33. --this draws the splash screen then after draws the icon
  34. function script.drawUI()
  35.     if timer >= 0 and not ac.getSim().isInMainMenu then
  36.         ui.drawImage(image_0.src, vec2(image_0.paddingX, screensize.y-image_0.sizeY-image_0.paddingY), vec2(image_0.sizeX+image_0.paddingX, screensize.y-image_0.paddingY), true)
  37.     end
  38.     if timer <= 0 then
  39.         ui.drawImage(image_1.src, vec2(image_1.paddingX, image_1.paddingY), vec2(image_1.sizeX+image_1.paddingX, image_1.sizeY+image_1.paddingY), true)
  40.     end
  41. end
  42.