Example.nsi 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. Name "BgImage.dll test"
  2. OutFile "BgImage Test.exe"
  3. XPStyle on
  4. !define DEBUG
  5. !macro GetReturnValue
  6. !ifdef DEBUG
  7. Pop $R9
  8. StrCmp $R9 success +2
  9. DetailPrint "Error: $R9"
  10. !endif
  11. !macroend
  12. Function .onGUIInit
  13. # the plugins dir is automatically deleted when the installer exits
  14. InitPluginsDir
  15. # lets extract some bitmaps...
  16. File /oname=$PLUGINSDIR\1.bmp "${NSISDIR}\Contrib\Graphics\Wizard\llama.bmp"
  17. File /oname=$PLUGINSDIR\2.bmp "${NSISDIR}\Contrib\Graphics\Checks\modern.bmp"
  18. !ifdef DEBUG
  19. # turn return values on if in debug mode
  20. BgImage::SetReturn on
  21. !endif
  22. # set the initial background for images to be drawn on
  23. # we will use a gradient from drak green to dark red
  24. BgImage::SetBg /GRADIENT 0 0x80 0 0x80 0 0
  25. !insertmacro GetReturnValue
  26. # add an image @ (150,0)
  27. BgImage::AddImage $PLUGINSDIR\2.bmp 150 0
  28. !insertmacro GetReturnValue
  29. # add the same image only transparent (magenta wiped) @ (150,16)
  30. BgImage::AddImage /TRANSPARENT 255 0 255 $PLUGINSDIR\2.bmp 150 16
  31. !insertmacro GetReturnValue
  32. # create the font for the following text
  33. CreateFont $R0 "Comic Sans MS" 50 700
  34. # add a blue shadow for the text
  35. BgImage::AddText "Testing 1... 2... 3..." $R0 0 0 255 48 48 798 198
  36. !insertmacro GetReturnValue
  37. # add a green shadow for the text
  38. BgImage::AddText "Testing 1... 2... 3..." $R0 0 255 0 52 52 802 202
  39. !insertmacro GetReturnValue
  40. # add the text
  41. BgImage::AddText "Testing 1... 2... 3..." $R0 255 0 0 50 50 800 200
  42. !insertmacro GetReturnValue
  43. # show our creation to the world!
  44. BgImage::Redraw
  45. # Refresh doesn't return any value
  46. FunctionEnd
  47. ShowInstDetails show
  48. Section
  49. # play some sounds
  50. FindFirst $0 $1 $WINDIR\Media\*.wav
  51. StrCmp $0 "" skipSound
  52. moreSounds:
  53. StrCmp $1 "" noMoreSounds
  54. BgImage::Sound /WAIT $WINDIR\Media\$1
  55. # Sound doesn't return any value either
  56. MessageBox MB_YESNO "Another sound?" IDNO noMoreSounds
  57. FindNext $0 $1
  58. Goto moreSounds
  59. noMoreSounds:
  60. FindClose $0
  61. skipSound:
  62. # change the background image to Mike, tiled
  63. BgImage::SetBg /TILED $PLUGINSDIR\1.bmp
  64. !insertmacro GetReturnValue
  65. # we have to redraw to reflect the changes
  66. BgImage::Redraw
  67. MessageBox MB_OK "Mike the llama"
  68. # clear everything
  69. BgImage::Clear
  70. # Clear doesn't return any value
  71. # set another gradient
  72. BgImage::SetBg /GRADIENT 0xFF 0xFA 0xBA 0xAA 0xA5 0x65
  73. !insertmacro GetReturnValue
  74. # add some text
  75. BgImage::AddText "A Desert for Mike" $R0 0 0 0 50 50 800 150
  76. !insertmacro GetReturnValue
  77. # add mike as an image
  78. BgImage::AddImage $PLUGINSDIR\1.bmp 50 150
  79. !insertmacro GetReturnValue
  80. # again, we have to call redraw to reflect changes
  81. BgImage::Redraw
  82. SectionEnd
  83. Function .onGUIEnd
  84. BgImage::Destroy
  85. # Destroy doesn't return any value
  86. FunctionEnd