Dear JDForce,
The code you require is given below, use the Bitmap_To_Printer function in the DPIncludes.dba module attached to this message. Include the DPIncludes.dba file in your project.
If you place the code below in your main game loop when you press the "P" key this will dump the screens bitmap to the printer.
if Upper$(Inkey$())="P"
qpw = Get Printer Page Width() / 2
qph = Get Printer Page Height() / 2
Bitmap_To_Printer(0,0,0, qpw, qph)
Printer Go
endif
If you want to create a snap shot from a camera then try following function also included in the new DPIncludes.dba module
Note if you use camera 0 you will lose the output to the screen. I suggest you set up a duplicate camera.
function SnapImage(CameraNo As Integer)
sw as integer
sh as integer
r as integer
cb as integer
sw = screen Width()
sh = screen height()
assigned as integer
nfreeimage as integer
r = -1
if camera exist(CameraNo) = true
nfreeimage = 1
repeat
assigned = Image Exist(nfreeimage)
inc nfreeimage,1
until assigned = false or mem_no = max_int
if assigned = false
dec nfreeimage,1
Set Camera To Image cameraNo,nfreeimage,sw,sh
sync
cb = Current Bitmap()
create bitmap 31,sw,sh
set current bitmap 31
paste image nfreeimage,0,0
delete image nfreeimage
set current bitmap cb
endif
endif
endfunction r
The insert the following again into your main game loop. Create a second camera
if Upper$(Inkey$())="P"
qpw = Get Printer Page Width() / 2
qph = Get Printer Page Height() / 2
SnapImage(1)
Bitmap_To_Printer(31,0,0, qpw, qph)
Printer Go
endif
The snap image function will create a screen sized image from the named camera. If you don't want to print the image straight away it is stored in bitmap 31.
I tested this code with the SphereMapping demo program. Note I have scaled my screen dump to save ink.
Rem modifed SphereMapping with screen dump to printer
Rem Project: SphereMapping
Rem Created: 01/08/2002 22:33:07
rem Tested for: U6.0
rem Init for best performance
sync on : sync rate 60 : backdrop off : hide mouse
if check display mode(1024,768,32)=1 then set display mode 1024,768,32
rem Loading screen
load bitmap "mediagfxbackdrop.jpg",1
copy bitmap 1,0,0,640,480,0,0,0,screen width(),screen height()
sync : delete bitmap 1
rem Load model
load object "mediascoutscout2.x",1
load image "mediaskyspace.jpg",1
set sphere mapping on 1,1
set object specular 1,0
rem Make sky
make object box 2,1100,1000,1000
texture object 2,1
set object cull 2,0
set object light 2,0
rem Set camera
position camera 0,0,-120
rotate camera 0,0,0
rem Setup ship for cruise
x#=0 : y#=-100 : z#=0
position object 1,x#,y#,z#
rem Setup prompt
load image "mediagfxprompt.bmp",2
load image "mediagfxstrapblank.bmp",3
strapx1=0 : sprite 1,strapx1,480-63,2
strapx2=1024 : sprite 2,strapx2,480-63,2
set sprite alpha 1,196 : set sprite alpha 2,196
rem Set particle effect
load image "mediagfxfire.bmp",4
make particles 1,4,40,100.0
position particles 1,0,-500,0
set particle velocity 1,0.2
set particle speed 1,0.004
set particle gravity 1,-3
set particle life 1,2
rem Load and loop space sound
load sound "mediasoundsspace.wav",1 : set sound volume 1,80 : loop sound 1
load 3dsound "mediasoundsjet.wav",2 : set sound volume 2,0
rem Main loop
do
rem Rotate and move ship
roll#=wrapvalue(roll#+0.5)
turn#=wrapvalue(turn#+0.1)
y#=0-(cos(roll#)*100)
x#=cos(turn#)*50
z#=50+(sin(roll#)*100)
position object 1,x#,115+y#,z#
xrotate object 1,wrapvalue(90+roll#)
yrotate object 1,wrapvalue(180)
zrotate object 1,0
rem Move strap line
dec strapx1 : if strapx1<=-1024 then strapx1=strapx2+1023
dec strapx2 : if strapx2<=-1023 then strapx2=strapx1+1024
sprite 1,strapx1,screen height()-63,2
sprite 2,strapx2,screen height()-63,3
rem Move camera with ship slightly
position camera 0,135+(y#/1.1),-100
zrotate camera wrapvalue(((cos(turn#)*5)))
rem Set emission position of particles
position particles 1,x#,(115+y#)-(sin(roll#)*58),z#-(cos(roll#)*58)
rotate particles 1,wrapvalue((0-roll#)-90),0,0
rem Position sound of engine
position sound 2,x#,115+y#,z#
position listener 0,115,-100
scale listener 0.5
rem Then play engine sound
if sound playing(2)=0 then loop sound 2
vol=sound volume(2) : if vol<100 then set sound volume 2,vol+1
rem Update screen
sync
rem *** My code inserted here ***
if Upper$(Inkey$())="P"
qpw = Get Printer Page Width() / 2
qph = Get Printer Page Height() / 2
Bitmap_To_Printer(0,0,0, qpw, qph)
Printer Go
endif
rem Endloop
loop
With regards to my samples being simple, it is best if they are kept simple. What people normally want to know is how to use the commands in question quickly. Most people would not want to trawl through several thousand lines of code in order to learn how one or two commands work.
Best Regards,
Jack Taylor
Jack Taylor