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.

Dark GDK / basic programming image displaying problem

Author
Message
Rangion
12
Years of Service
User Offline
Joined: 29th Feb 2012
Location:
Posted: 1st Mar 2012 00:24
I am a student working on an assignment in my gaming programming class but I'm having a problem with the program displaying any images. Even a simple code such as this won't work:



#include "DarkGDK.h"

void DarkGDK()

{

dbLoadBitmap("skyrim.bmp");

dbWaitKey();

}



The image "skyrim.bmp" is already imported into the project and when the project is run, all it displays is a black screen. It does not say any errors occured and the build was successful. I have tried dbLoadBitmap("skyrim.bmp",0) and it didnt work. I have also tried dbLoadImage and dbPasteImage with no avail. I have even tried using another image from the Dark GDK files, with all images having a smaller resolution than the default size of the window. I have been working at this for about 4 hours now and can't find a solution. Do you see anything wrong with the code?

Please help!
Juggalo Memnoch
16
Years of Service
User Offline
Joined: 22nd Apr 2008
Location:
Posted: 1st Mar 2012 06:56 Edited at: 1st Mar 2012 06:57
You don't seem to have a Loop in your code.. That's where you would Display the image. Also you don't give the image an Id number..

Here's an example..


Note.. I didn't test this but it should help

xix psycho xix
15
Years of Service
User Offline
Joined: 15th Sep 2008
Location:
Posted: 2nd Mar 2012 00:10
Make sure that your files are in the correct directory because if they are wrong on the path DGDK will not let you know this, it will just fail to correctly display the image. Most people try to put their content in the project\debug folder. It does not go in the debug folder by default. You can set the project to use this as the working directory but by default the project uses the directory above Debug for the initial working directory. Also, you do not need a game loop to draw the image. You should, however, use the dbSync command like so:



If the image is in the correct working directory this code will display the image at the given location. Most often in my experience it is a path issue.

Login to post a reply

Server time is: 2024-05-03 09:38:24
Your offset time is: 2024-05-03 09:38:24