Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / have an object on a bitmap

Author
Message
Sonic 91 Software
20
Years of Service
User Offline
Joined: 19th Mar 2005
Location: In a Cryptic Crossworld!
Posted: 7th Jun 2005 19:35
when i want to put a bitmap on the screen and an object on it, it just keeps clearing the bitmap before loading the object, e.g.

sync on
sync rate 100
load image "name.bmp", 1
load image "texture.bmp", 2
paste image 1,0,0 rem this covers the whole screen
sync
make object sphere 1,10
texture object 1,2
sync

(when i run the program, i see the image (name.bmp) for a split second and then the screen clears and puts the textured sphere on the screen. i have tried it with and without sync in all the places above, yet it seems to do the same thing every time!)

sonic91
bibz1st
22
Years of Service
User Offline
Joined: 2nd Jan 2003
Location:
Posted: 7th Jun 2005 20:44
are you wanting the BMP as the background ?
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 8th Jun 2005 00:11
Using the technique you have used, you must PASTE IMAGE between every SYNC. You could do one of 2 things...

Remove the first SYNC, it's not required. You should try to SYNC once per program cycle.

Put the bqckground bitmap on a SPRITE. If the bitmap is the same size as the screen, it will just work. If it isn't, you will have to SCALE SPRITE. Once you have made, positioned and scaled the SPRITE, it will be permanently on-screen until you hide or delete it.

BatVink
Sonic 91 Software
20
Years of Service
User Offline
Joined: 19th Mar 2005
Location: In a Cryptic Crossworld!
Posted: 8th Jun 2005 21:43
i tried doing this, but it doesn't work for some strange reason

sonic91
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 13th Jun 2005 04:06
set the image as your backdrop image:


Immunity and Annihalation makes Immunihalation...
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 15th Jun 2005 09:03 Edited at: 15th Jun 2005 09:03
Sonic The Hedgehog,

It will work if you do exactly as BatVink has stated. Let's start from scratch. Create your objects beforehand. Use the draw to back command, to draw the image behind any 3D objects(note, that you will need to use the draw to front command whenever needing to draw a 2D graphic in front of any 3D objects. Afterwards, the draw to back command will need to be used again. And, this order shall continue in a loop). Now, in the main loop, paste your image before the sync command. Check the code snippet below.




+NanoBrain+
kaymation
20
Years of Service
User Offline
Joined: 30th Mar 2005
Location: up, down, all around
Posted: 15th Jun 2005 11:09 Edited at: 15th Jun 2005 11:43
I think
works just fine. Oh making name.bmp the splash screen to a game that doesnt exist will make it work, but somtimes, no offence, people are trying to use the engin to make the randomist things.
OH its my first time helping some one instead of asking for help!!!

i owe all my wantingness to TBC at [href]www.homestarrunner.com[/href]
blanky
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: ./
Posted: 19th Jun 2005 17:47 Edited at: 19th Jun 2005 17:49
Man, with that code you wouldn't actually be able to exit the splash screen. Maybe if you added an 'if scancode()<>0 then exit' line just before the 'loop', MAYBE. But I personally think he wanted a background picture

My implementation of a background picture, to join the collection:

Quote: "
sync on

`Set everything up
load image "name.bmp",1
load image "texture.bmp",2
make object sphere 1,10.0
texture object 1,2

`The following command makes it so that all picture-drawing and other 2D commands occur behind 3D:
draw to back
`Turn off the 3D backdrop (blueness from beyond), so you can actually SEE the picture.
backdrop off

`Start drawing!
do
`...

paste image 1,0,0
sync
loop
"


Oh yeah, and NanoBrain, doesn't the draw to back command only need to be called once, and so should be outside the main loop?
Although it hardly makes a difference to performance, it does mean that (at least) the darkbasic interpreter ends up setting a variable each loop that it otherwise wouldn't have to.

How's my typing? Phone 0800-GO-TO-HELL

Login to post a reply

Server time is: 2025-05-22 21:29:06
Your offset time is: 2025-05-22 21:29:06