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 / Load Image Problem

Author
Message
M squared
14
Years of Service
User Offline
Joined: 20th Oct 2010
Location:
Posted: 25th Oct 2010 03:37
It's me again with another one of my code db pro problems. I'm looking at this tutorial here http://www.dcforeman.co.uk/index.php?title=Game_Menu part 2 is where i have the problem

Heres a code snippet


Whenever i compile it just displays a black screen. I did save the file to the folder called "Images". I think the problem might be with adding media. I used the import function but i'm not sure if thats what i'm supposed to do. I'm useing windows 7 if it helps. Thanks in advance.

details....
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 25th Oct 2010 12:32
Have you got to the second iteration of your loop? The very first SYNC of the program doesn't work for certain things, such as PRINT and possibly PASTE.

TheCodeHasEyes
14
Years of Service
User Offline
Joined: 21st Oct 2010
Location:
Posted: 25th Oct 2010 12:42
make sure your image is in your project folder as well as your media

thats where i slipped up, may work for you?
M squared
14
Years of Service
User Offline
Joined: 20th Oct 2010
Location:
Posted: 25th Oct 2010 17:12
I tried loading one of the sample media files from the Media/Bitmaps folder that came with db pro. It loaded fine. This makes me pretty sure it's something with the file. I don't think it's the file type because i typed in .bmp when saving the file. Plus, when i add a 1 to the very end of the load image line it displays a runtime error (accoring to the tutorial this is supposed to increase resolution of the image).
"Runtime Error 506-Could not load image at line 4.
CWD:C\Program Files (x86)\The Game Creators\ Dark Basic Professional\Projects\Menu
LOAD IMAGE Media\backround.bmp,1,1,0"

I'm lost........

details....
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 25th Oct 2010 18:31
Yeah it's probably what BatVink mentioned. You can avoid this by making it SYNC right after the program starts. What also doesn't help is you have a WAIT KEY in your DO/LOOP. WAIT KEY stops all action till the user hits a key... which really isn't needed since you have a DO/LOOP that will repeat all code within it forever unless you EXIT the DO/LOOP. If the first time SYNC is seen it doesn't quite work and you keep the WAIT KEY you probably won't see anything until you hit a key... it'll then loop again and see SYNC the second time and actually SYNC.

Try this:


M squared
14
Years of Service
User Offline
Joined: 20th Oct 2010
Location:
Posted: 25th Oct 2010 19:17 Edited at: 25th Oct 2010 19:21
@Grog Grueslayer
I don't know why there is a wait key there. It's not there in the original code. And i tried the code you provided and unfortunatly that didn't work either.

So, currently, I have this and another image (one that came with db pro), in a folder called "Media". I can load image "metal" but i can't load image "backround". I've checked, they have the same properties except for the file size and dimensions. In essance, this works


and this doesn't


So it's not the code, it must be something with the image. It must be somehting with the image. I just can't figure out what.

details....
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 25th Oct 2010 21:27
Zip up and attach your media directory to your next message.

Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 25th Oct 2010 22:32
You don't really need the sync commands or a loop to see a pasted image.

Load it

Paste it

pause the program so you can view it



M squared
14
Years of Service
User Offline
Joined: 20th Oct 2010
Location:
Posted: 26th Oct 2010 19:42
@ grog grueslayer, hope this is what you mean, it's probably not but here it is anyways.

details....

Attachments

Login to view attachments
M squared
14
Years of Service
User Offline
Joined: 20th Oct 2010
Location:
Posted: 26th Oct 2010 20:58
here are the names of the media files
media\backround.bmp
media\MenuText 2 (2).png
media\Menu text2.png
media\metal.bmp

details....
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 26th Oct 2010 22:43 Edited at: 26th Oct 2010 22:44
Is it really backround.bmp, or should it be background.bmp?

also try this...



M squared
14
Years of Service
User Offline
Joined: 20th Oct 2010
Location:
Posted: 27th Oct 2010 01:12
....(wince).... (wince)...... i.....fail... SO MUCH!!.... thanks batvink for pointing that out. Thanks for you patience, and sorry for the bothe... heh heh... oops....

details....
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 27th Oct 2010 21:31
It's very easy to miss the obvious

Login to post a reply

Server time is: 2024-11-24 09:45:00
Your offset time is: 2024-11-24 09:45:00