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.

Newcomers DBPro Corner / get Image/Sprite & current bitmap

Author
Message
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 3rd Jun 2004 19:29
Alright, since no one in the 2D forum seems able to answer I'll re-post my question here....

I might be missing something here, but am having a problem using get image and sprites for dynamically created images. Here is my code;

(All values listed are constant variables, including RGB colors. ie; assume w=33, h=25, etc.)

create bitmap 1, w, h
set current bitmap 1
ink purple, black
box 0, 0, w, h
get image 1, 0, 0, w, h
create bitmap 2, w, h
set current bitmap 2
ink orange, black
box 0, 0, w, h
get image 2, 0, 0, w, h, 1
set current bitmap 0
sprite 1, 150, 150, 2
...
sprite 1, 150, 150, 1


In every case that I can determine, the image seized is pure black, as though the box or get commands have not been directed to the specified bitmap, or not using the bitmap selected as the source. When I remove the bitmap commands and draw the image directly on the screen, the sprite is built successfully.

What am I doing something wrong? Did I miss-read the manual? I was under the impression that the current bitmap was where functions were directed.

I am using DBC 1.12 un-enhanced by the upgrade.

Thanks.

Any truly great code should be indisguishable from magic.
Mussi
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 3rd Jun 2004 21:41
try syncing after you draw a box



Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 80GB HD 7200rmp U133, Geforce 4 Ti4400 128mb
zenassem
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 4th Jun 2004 08:02
Try this.

Just to note: In DBC the create bitmap command automatically makes it the current bitmap. I went through alot of combinations, but what seemed to give me the problem you were having was creating a bitmap smaller than the screen size. by default DBC is in 640x480. I don't know why the smaller size bitmaps seemed to not allow me to grab it properly. The bitmap is being drawn to as can be witnessed by using a copy bitmap 1,0 (& removing the get image command).


w=40
h=40

ink rgb(244,214,210),1

create bitmap 1,640,480
ink rgb(200,0,200),1
box 0, 0, w, h
get image 1, 0, 0, w, h

create bitmap 2, 640,480
ink rgb(150,100,0),1
box 0, 0, w, h
get image 2, 0, 0, w, h, 1

set current bitmap 0
sprite 1, 150, 150, 2
wait 500
sprite 1, 150, 150, 1

suspend for key
delete bitmap 1
delete bitmap 2
rem End the program
end


SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 5th Jun 2004 09:22
Thank you!

Zenassem,

I tried your code first and saw that it worked, so applied the suggestion to my code and it worked as well. Part of what I wanted to do, as a first project anyway, was to create a display that sized itself to any resolution used, and I couldn't get the sprites working. Now all is good and wonderful...

Thanks again, I'd have never thought of it.

Sandra.

Any truly great code should be indisguishable from magic.
zenassem
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 5th Jun 2004 18:19
@SandraD,

Your Welcome! I'm glad it worked for you.

And thank you for your post. It helped me as well. I'm trying to put together a definitive guide to 2D for DBC/DBpro, due to the number of variations/nuances that I have discovered or learned from others. This is one I wasn't aware of, and now will be included in my guide.


SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 6th Jun 2004 05:04
Yeah, I never would have suspected this little quirk either, but this is how we learn.

Any truly great code should be indisguishable from magic.

Login to post a reply

Server time is: 2024-11-26 20:18:55
Your offset time is: 2024-11-26 20:18:55