Hey people,
Just spent a while trying to find a way to map 2D objects displayed onscreen to an image, the same way that
set camera to image maps a 3d display to an image. It looked to me like the simplest way to do that was to use
set camera to image on camera zero, then use
draw to camera to redirect all 2D to that image - apparently it doesn't work in practice though
Rem Project: Dark Basic Pro Project
Rem Created: Tuesday, July 21, 2015
Rem ***** Main Source File *****
sync on : autocam off : open console : print to console
mode as boolean
width = screen width() : height = screen height()
draw to front : draw sprites last
make memblock 1, 12 + ((50 * 4) * 50) : write memblock dword 1, 0, 50 : write memblock dword 1, 4, 50 : write memblock dword 1, 8, 32 : for y = 0 to 49 : for x = 0 to 49 : write memblock dword 1, 12 + (x * 4) + ((50 * 4) * y), rgb(255, 0, 0) : next x : next y : make image from memblock 2, 1 : delete memblock 1
make object cube 1, 100 : position camera 0, 0, 0, -130 : set camera to image 0, 1, width, height
make camera 1 : position camera 1, 0, 10000, -50 : make object plain 2, 40, 40 : position object 2, 0, 10000, 0 : texture object 2, 1
do
text 0, 0, "I wish this text would show up :("
sprite 2, 200, 200, 2 : rotate sprite 2, sprite angle(2) + 0.5
if controlkey() = 1
mode = 1 - mode
if mode = 0 : draw to screen : else : draw to camera : endif
while controlkey() = 1 : endwhile
endif
yrotate object 1, object angle y(1) + 0.1
sync
loop
Maybe I'm totally misunderstanding how the command works here, but shouldn't the red sprite show up on the plain when you press control? :/
Thanks for any help
The code never bothered me anyway...