1
Programs / B+'s Matrix Rain With World Map Backdrop
« on: April 02, 2022, 03:17:31 pm »
Almost all of this code is from B+'s Matrix Rain 4. I tried to find the original post but one link didn't work anymore. Anyhow, for 2 days I've tried to add a world map as the backdrop to it and finally succeeded using GET and PUT from the QB64 Wiki pages. I remembered that back in the 1990's I used to use XOR to make a background image with moving graphics over it. But instead of having to use XOR, DEST works pretty similar, with PUT and GET. Here is the code, photo, and the required world_map.jpg needed in the same folder as the code. I tried to section-off where I added my own code to this. Thank you B+!
Make sure and name this file, it won't work if you don't: Matrix Rain 4 mod by SierraKen.bas
Make sure and name this file, it won't work if you don't: Matrix Rain 4 mod by SierraKen.bas
Code: QB64: [Select]
- ' from Matrix Rain 2019-03-14
- ' or QB64 Purple Rain!
- '>>> Save this file as: Matrix Rain 4 mod by SierraKen.bas, so the program can load the strings from it. <<<
- '2019-03-15 This will attempt to spin the drops as they fall
- '2019-03-16 Don't need no damn Character Set.DAT file!!!
- '2019-03-16 Ijust want to see the vertical code strings dangle and twist.
- '2019-03-19 Matrix Rain 4
- ' + added randWeight to weight the random sizes chosen so many more on small side than large
- ' + draw letters on a transparent background so the background of the letter does not cover
- ' the drops behind it.
- 'Mod by SierraKen - Added World Map as the backdrop. - April 2, 2022.
- Type dropType
- 'SierraKen's World Map code with the array, GET, and DEST ---------------------------------------------
- Screen map&
- _Source map& 'REQUIRED to GET the proper image area!
- _Dest 0
- '-------------------------------------------------------------------------------------------------------
- 'Screen _NewImage(xmax, ymax, 32)
- '_FULLSCREEN 'as screen saver
- 'Changed this name. ----------------------------------------
- '----------------------------------------------------------------
- i = i + 1
- Close #1
- ' check loading
- 'FOR i = 0 TO UBOUND(fileStrings$)
- ' PRINT i, fileStrings$(i)
- 'NEXT
- 'END
- 'setup drops
- newDrop i, 1
- 'SierraKen's PUT statement ----------------------------
- '------------------------------------------------------
- drawDrop (i)
- drop(i).curY = drop(i).curY + 1
- _Limit 25
- drop(i).sz = randWeight(.3, 5, 3) 'set size weighted on small sizes
- 'length of text string can fit on screen
- charLength = ymax \ (drop(i).sz * 16) + 1 'from size determine how many chars fit on screen
- d = drop(i).curY - j
- rot = 1: dir = -1
- rot = rot + drop(i).dxs * dir
- drwChar Mid$(s$(i), j, 1), c~&, drop(i).x + 4 * drop(i).sz, drop(i).sz * 16 * (j - 1) + 8 * drop(i).sz, rot * drop(i).sz, drop(i).sz, 0
- _Dest I&
- _Dest 0
- RotoZoom2 midX, midY, I&, xScale, yScale, Rotation
- _FreeImage I&
- px(0) = -W& / 2: py(0) = -H& / 2: px(1) = -W& / 2: py(1) = H& / 2
- px(2) = W& / 2: py(2) = H& / 2: px(3) = W& / 2: py(3) = -H& / 2
- x2& = (px(i&) * cosr! + sinr! * py(i&)) * xScale + X: y2& = (py(i&) * cosr! - px(i&) * sinr!) * yScale + Y
- px(i&) = x2&: py(i&) = y2&
- _MapTriangle (0, 0)-(0, H& - 1)-(W& - 1, H& - 1), Image& To(px(0), py(0))-(px(1), py(1))-(px(2), py(2))
- _MapTriangle (0, 0)-(W& - 1, 0)-(W& - 1, H& - 1), Image& To(px(0), py(0))-(px(3), py(3))-(px(2), py(2))