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