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 Professional Discussion / Ultra simple question

Author
Message
jerryd
13
Years of Service
User Offline
Joined: 20th Feb 2013
Location:
Posted: 20th Feb 2013 06:38
DarkBasic forum,

Windows XP laptop, DarkBasic 1.071

I've been writing computer code for many years and I've used
Game Maker to make a couple of games but now I would like to
move up to something more professional.

I think DarkBasic might be a good place to start. So far I've
had some success with a couple of tutorials on the internet
but haven't figured out how to do a simple thing like load and
install a simple bitmap background. I'm trying to use the
"wall.bmp" found in the help example file but can't get it to
become my background. I've read and read the index in the
help file but can't figure out what command to use.

Thanks for any reply.

jerryd
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 20th Feb 2013 12:25
There are a few ways to do it. The simplest is here:



This will only remain on the screen until you refresh it again, so maybe you'd prefer to use this:



There are also ways to do it with 3D plains or sprites.

It would be good if you could post the code you already have enclosed in code tags, so we can make a better decision on what to use.

[[/b]code lang=dbp][b]paste your code here[[b][/b]/code]

TheComet

http://blankflankstudios.tumblr.com/
"You're all wrong. You're all idiots." - Fluffy Rabbit
"Bottom line, people are retarded." - Fluffy Rabbit
pcRaider
19
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 20th Feb 2013 12:35
You had better update DBP to the latest edition.

http://www.thegamecreators.com/?m=view_product&id=2000&page=upgrade7-62
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 20th Feb 2013 14:38 Edited at: 20th Feb 2013 14:44
It is also useful to note that there exists a bitmap system which is covered in the help files, and often there is a camera system in action when you run a DBP program.

There is a bitmap under the ID of zero which represents your screen; which also receives 3D rendering from a camera, the default camera being number zero; if there is anything to render.

So as far as DBPRO is concerned; bitmap zero is the screen; so if you use the command; Load Bitmap "File.png", 0, this will load the image on screen


If you run TheComet's example, DBP pastes a seperate image onto bitmap zero much like what happens in photo editing. Bitmap zero which is also by default the -Current Bitmap()- and also the screen is what TheComet is pasting on. His reference to the Sync command is like a refresh call; only necessary if auto refreshing is switched off by calling -Sync On-. If you used -Set Current Bitmap- to change to a different bitmap loaded or created with -Create Bitmap-, his operation would paste the image there, but not on the screen.

It is also useful to note later on in your activities, that images are often used for 3D rendering.

Indeed there is a lot happening; and alot is covered in the help files and various forum threads. You can even texture or apply special shaders to cameras, another way to fill the screen.

jerryd
13
Years of Service
User Offline
Joined: 20th Feb 2013
Location:
Posted: 21st Feb 2013 04:27
DarkBasic forum,

Thanks for the replies and code.
I will upgrade to the latest rev.

I tried both suggestions and am currently using
load bitmap "C:\Program Files\gamePictures\wall.bmp", 0

Since I put command in the main do loop doesn't it take the time
to load the entire screen every time I execute it?

do
load bitmap "C:\Program Files\gamePictures\wall.bmp", 0
sprite 1, xpos, ypos, 1
backdrop on
`Refresh the screen
sync
loop

As you can see I'm struggling to figure out how this code
manipulates the hardware.

Jerryd
jerryd
13
Years of Service
User Offline
Joined: 20th Feb 2013
Location:
Posted: 21st Feb 2013 05:14
DarkBasic forum,

Thanks for the replies and code.
I will upgrade to the latest rev.

I tried both suggestions and am currently using
load bitmap "C:\Program Files\gamePictures\wall.bmp", 0

Since I put command in the main do loop doesn't it take the time
to load the entire screen every time I execute it?

do
load bitmap "C:\Program Files\gamePictures\wall.bmp", 0
sprite 1, xpos, ypos, 1
backdrop on
`Refresh the screen
sync
loop

As you can see I'm struggling to figure out how this code
manipulates the hardware.

Jerryd
Brendy boy
20
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 21st Feb 2013 09:44
Quote: "load bitmap "C:\Program Files\gamePictures\wall.bmp", 0"

bitmap number can't be 0

Quote: "Since I put command in the main do loop doesn't it take the time
to load the entire screen every time I execute it?"

yes, it does. Put it before 'do' command

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 21st Feb 2013 10:22 Edited at: 21st Feb 2013 10:23
Quote: "bitmap number can't be 0"


Yes it can. Test it before posting, or at least read why it works, Chris explains it.

@ jerryd



TheComet

http://blankflankstudios.tumblr.com/
"You're all wrong. You're all idiots." - Fluffy Rabbit
"Bottom line, people are retarded." - Fluffy Rabbit
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 21st Feb 2013 12:06 Edited at: 21st Feb 2013 12:22
Quote: "do
load bitmap "C:\Program Files\gamePictures\wall.bmp", 0
sprite 1, xpos, ypos, 1
backdrop on
`Refresh the screen
sync
loop"


You probably put the loading function in the loop because your backdrop disappears.

This is because of your sprite. During learning stages, only load bitmap zero when you simply need a background image without 3D or sprites; such as for a splash screen, loading screen or painting.

Sprites and 3D activates a camera, which draws on-top of the screen bitmap which causes your background to disappear. The idea is to place the background between the camera background and the sprite.

Use a different method to put the image above the camera rendering; you can use an image and paste it, or why not use another sprite as the background. Or load the screen into bitmap 1 and use -copy bitmap-; or use the -texture backdrop- command, backdrops are camera canvases - that which the camera draws on which is by default a blue screen (IE: -Color Backdrop-). Backdrops such as the default blue one can be switched off with -Backdrop Off- or switched on again with -Backdrop On-. We need backdrops because something needs to erase the previous frame.

Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 22nd Feb 2013 00:54 Edited at: 22nd Feb 2013 00:58
if you just want a fixed unchanging/unmoving background you can texture the backdrop and you wont have to manage the drawing each loop regardless of sprites or 3d



edit oops chris beat me to it, didnt see it first read through

pcRaider
19
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 22nd Feb 2013 08:14 Edited at: 22nd Feb 2013 08:15

Login to post a reply

Server time is: 2026-07-07 05:15:11
Your offset time is: 2026-07-07 05:15:11