November 28, 2020, 11:00:33 AM

Author Topic: [bb] Blitz Resource Compiler Example by superqix [ 1+ years ago ]  (Read 544 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
Title : Blitz Resource Compiler Example
Author : superqix
Posted : 1+ years ago

Description : Updated with a both a graphic and a sound file in a resource, and to BASE64

Code :
Code: BlitzBasic
  1. ; ******************************************
  2. ; * Blltz Resource Compiler Example v0.3
  3. ; ******************************************
  4. ; * BASE64 encode a file into BB source to
  5. ; * add to a Blitz project for retrival
  6. ; *
  7. ; * Perfect for including small graphics or
  8. ; * sounds in your Blitz EXE file
  9. ; ******************************************
  10. ; * Released under the LPGL 8/30/2002 by
  11. ; * Michael Wilson wilson(at)no2games.com
  12. ; ******************************************
  13.  
  14. Graphics 640,480
  15.  
  16. cursor = LoadImage(LoadResource("mouse.png"))
  17. click = LoadSound(LoadResource("beep.wav"))
  18. FreeResources()
  19.  
  20. MaskImage cursor,255,0,255
  21. SetBuffer BackBuffer()
  22.  
  23. While Not KeyHit(1)
  24.         Cls
  25.         DrawImage cursor, MouseX(),MouseY()
  26.         If MouseHit(1) Then PlaySound click
  27.         Flip
  28. Wend
  29.  
  30. ; ******************************************
  31. ; * Code below this point is automatically
  32. ; * generated by the Blltz Resource Compiler
  33. ; ******************************************
  34.  
  35. Type TempResourceFile
  36.   Field FileName$
  37. End Type
  38.  
  39. Function FreeResources()
  40.   For TempFiles.TempResourceFile = Each TempResourceFile
  41.   DeleteFile TempFilesFileName$
  42.   Delete TempFiles
  43.   Next
  44. End Function
  45.  
  46. Function LoadResource$(Resource$)
  47.   Select Upper$(Resource$)
  48.     Case "BEEP.WAV" Restore beep_wav
  49.     Case "MOUSE.PNG" Restore mouse_png
  50.   End Select
  51.   EncodeTable$ = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz{}"
  52.   TempFile$ = Str Int Rnd(11111,99999)
  53.   TempFile$ = SystemProperty ("tempdir")+"~bb"+TempFile$+".tmp"
  54.   OutFile = WriteFile(TempFile$)
  55.    Repeat
  56.      Read Output$
  57.      If Output$ = "!EOF" Then Exit
  58.      ByteCount% = Len(Output$)
  59.      For i = 1 To ByteCount% Step 4
  60.        Word% = ((Instr(EncodeTable$,Mid$(Output$,i,1)) - 1) And 63) Shl 18
  61.        Word = Word + (((Instr(EncodeTable$,Mid$(Output$,i+1,1)) - 1) And 63) Shl 12)
  62.        Word = Word + (((Instr(EncodeTable$,Mid$(Output$,i+2,1)) - 1) And 63) Shl 6)
  63.        Word = Word + ((Instr(EncodeTable$,Mid$(Output$,i+3,1)) - 1) And 63)
  64.        Byte% = Word Shr 16 And 255
  65.        Byte2% = Word Shr 8 And 255
  66.        Byte3% = Word And 255
  67.        WriteByte OutFile, Byte
  68.        WriteByte OutFile, Byte2
  69.        WriteByte OutFile, Byte3
  70.      Next
  71.    Forever
  72.   CloseFile OutFile
  73.   TempFiles.TempResourceFile = New TempResourceFile
  74.   TempFilesFileName$ = TempFile$
  75.   Return TempFile$
  76. End Function
  77.  
  78.  
  79. .beep_wav
  80. Data "Kab6Hdu2001NGLP5Pcrq810000010040T2S007Gd000100W0P65qOLe20024Yuc0TNU3Zv5wNc6MtRzi5Yk0wDHt"
  81. Data "7ZoHyhbM4r{zvOae8OVbhbaJNxpoZZ4na}2kIn5ioUY38J2MxwH74MtKu7KPGQBobpaLUThISHP9h}UMEnbyujTi"
  82. Data "5KkkzPGp6O7aoMSHKRhwaJCWXk}2PXLPlFgMCIEJzRLP4sdIyuCcDfxwgKSHSjNaUXayglkSGnDrtULt6KEf{vmy"
  83. Data "5dtWt7KLHhJxapSSWEZNR1DFj}UCAo2Bxybd3bV4yuGeAu}tmLeEOidmX2Cfb}UoLX5dp}A392wM{AzC3ctIwtyS"
  84. Data "DwRwd3uRUkJSPn5IklU9A2IEyhzS3L}CxNmWD9V}kbGDPipdW20ha}UvMWvUokTy83EP{gn747BOr6qJGw}xbpOP"
  85. Data "XksvL0jVnU{68IYPzQTB2MVLv7aODg7xf4CDTztKSH51jFgJDnQ6xxrV3bh4yeSiA9Vrh4uERzZTV1iqgVYSH1Lw"
  86. Data "vz1j4qQo{fSv6uVjn6eHJC7tZ34ea}YwLmvaqEL}7ZUg{fv35NpgpMOMMSVjXoWedlUgJnDovDnr6pwlzw515N}d"
  87. Data "oMeMJyNjYp0cbk{nKXPgrDXy93oqwvT18OFbmcGUNCNVXp4xfkIVIobzrRzcA5gws8uyDvJNgLemRyI}SZTMgi{M"
  88. Data "Ja6BoQndF6grmO16L9h5d5T3VRgkSJzQei6HLak3kQPfIM{fiNzCLvczbbf6UhorUKHPdyIPMJzykQzrH5oYkOjK"
  89. Data "Hd{tgNH9OPwraLzEVAodVLPYawcCPbnzefzzNcI7gfHqP7UHbe5jSOEFXtToVOc9VtbyWm00"
  90. Data "!EOF"
  91.  
  92. .mouse_png
  93. Data "YL1EHmqA6We0000DIKX4KW0002a0000W20C0002uiQ4C0003051CL4K0003}}}}}0Fy410W20WG10G830mKA2X07"
  94. Data "1miC31820WCC314G41O820iB2myH4HSC31092Gm61WW30mGK51eA2WqO61yL5HiE3X871maP6I0I4XSF3nCR6o8N"
  95. Data "5nqS72CO61uC30y820e410KT7IGP6HyL5HeH4HKQ6Y0M5XiR6o4I4XO92GiS728N5nmE3X4O61qJ4nST7ICU7YGP"
  96. Data "6HuK51WF3n851GOQ6XyL5HaM5XeB2mqH4HGO61mI4XKC30uJ4nOD3GyM5XaF3n4nCJPPMLnrTNTSN5q61WK71mOA"
  97. Data "2WaM5XKR6nfXOM36niN{}lxz}Vtx{}lv{Vdu{FZpy}FoylBlx{}ewEZavEJZu{FUtjxTtTtNrzVMrjRLrTNKrDJJ"
  98. Data "qzFGqD3Fpy}DpStCpCpBoyl7nyV5nSN2miAvkRcukBYtjxUoihAmiB2lhw{khgwjhQsfgQcXeQ6WeA2QcfgMbfQL"
  99. Data "bPMGa92DZOsBYuk6XeQ1WO5zVNruU7XqT7HpStDnSN5hQsjdPsTaP6HXOM5WO61QMbfPMLbOM5XIKb99IKb8I4X7"
  100. Data "HqT5HKL3GqD2Ga8sDZOpCpCmC30lBoyjBIqiB2mgAYed9oSZ8oCX8I4S71mP6HaN5nSJ4nCH4H4G410D3GqC30mB"
  101. Data "2mi92Ga820W71mS30mC20W810G420W820W820W820W820W820W820W820Z820W820W8000820W820W820W820W82"
  102. Data "0W820W8o0W82CY020W820W8000820W820W820W820W820W820W8eCW8aE0K20W820W8000820W820W820W820W82"
  103. Data "0W820W8ZBJ8m2g820W820W8000820W820W820W820W820XO20W9A6J80esa20YG20W8000820W820W820W820W82"
  104. Data "A4G20W9n012aRG4292a20W8000820W820W820W8F0W8234Op0W81Tm1f0G4aAG020W8000820W820W820W8hAW82"
  105. Data "2tGK90810Nu10G4r09e20WBjOFTF00002N18MNC000iJ000B4m1tdQoE00023Kb4GLHud8NJLriJGHG6u6{E1YkY"
  106. Data "WaeKJJGJiqcC8RDgH5GG6s9NB14LkmR4Ni6ElHViqMWKuMSwkqj2TcSXvsBdvdrcptTc1Wt9{3oX2ofPC6f1GkCb"
  107. Data "BUBu}LxY{Qi4Bo5ZoVvp7Kz{0Tv4PDGcm5VW8sDjtHy0JxL}b8r1l1ut6MExpZxR19JNqKWTWqHau4UA6TL{{ojG"
  108. Data "MRF4tOA8Hz7BhDfx{SqWC6qXkNGi9Udb0wTOlixqPe5aAAXOGueWNkyeKBR}Xao7XZ3fFgSaNeDBhAXakdvW{chR"
  109. Data "UPYIV6LVzZ1R7UfvrupaChzJYiNePeuwdv4JNYaSalGPFzjihlF580BLGUNlv8lXGL6VdI{1G4YpvH{InEVyEr6G"
  110. Data "zsJsjTmUlI19BtkrlJ2dMrbKDiQukvH3lM2oL5f{3Z{LKweJRd{Ncqxvr6fcpdMPaTu2Ysfr9RkvA{uQv1go9urr"
  111. Data "vzNFG5pJtUIiNBiK3yUD}txGkYyz6NWQIIYIz35R6TlTLwMFxTjdHJjmlmNUi50aQVNRMAffjfYBvwr3OpZsg1bh"
  112. Data "L2acR6GT2NCEZ}CJEv91L2YI8j6ZLoR9bLVXZWMFVyDINTsJg6BzXibcoo5SDs1w2y9SJMIITPgrJiL5nhh{5g0Y"
  113. Data "8pFpFNjRJgV}34D53gUB1JRd9jQwdf6JQl0iBxea8qlv4FpkDyI5sXxoVrPxOkYwvHCJ000004b5JaIkGc22"
  114. Data "!EOF"


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal