GLBasic forum

Main forum => FAQ => Topic started by: Lord_TNK on 2012-Nov-26

Title: Images not showing up when I run the programs
Post by: Lord_TNK on 2012-Nov-26
I'm running the very basic background and sprite programs provided on the tutorials for both this site's main page and the GKBasic SDK (version 10.202), and I'm just getting a blank screen. I've tried using the SETCURRENTDIR command. I've put the image names with and without the "media/" link. I tried running the exe on a different computer (both running on Windows XP SP3).

These are some of the codes I've tried:

//
SETCURRENTDIR("Media") // go to media files
// My game
start:
  LOADBMP "Background.bmp"
  // Load further graphics as sprites...
  // load level, setup (lives=3, time=100...)
maingame:
  //Keyboard input
  //Move and draw player
  //Move and draw enemies
  SHOWSCREEN
GOTO maingame
//

//
SETCURRENTDIR("Media") // go to media files
////////////////
// SPRITES
////////////////
// load sprite image from file "Bubble.bmp" and assign it to ID 0
LOADSPRITE "Bubble.bmp" ,0
// show sprite image with ID 0 at position x=300, y=150
DRAWSPRITE 0, 300, 150
SHOWSCREEN
END
//

//
SETCURRENTDIR("Media") // go to media files
LOADBMP "sky.png"
LOADSPRITE "box.png", 4
DRAWSPRITE 4, 300, 150
SHOWSCREEN
MOUSEWAIT
END
//

Neither shows anything but a black screen.
Title: Re: Images not showing up when I run the programs
Post by: MrTAToad on 2012-Nov-26
You need to make sure the media is actually present in the directory specified (and is based from the executable location).

If you are compiling for a non-Windows environment, check the case of the filename as it is case-sensitive.

If you could make the complete project available, that would be handy to look at too
Title: Re: Images not showing up when I run the programs
Post by: Lord_TNK on 2012-Nov-26
You need to make sure the media is actually present in the directory specified (and is based from the executable location). (1)

If you are compiling for a non-Windows environment, check the case of the filename as it is case-sensitive. (2)

If you could make the complete project available, that would be handy to look at too (3)

1. The images are in the folder with the project files, the folder with the exe, and in the media folder (all of which were auto created by the sdk). Neither of them load.

2. I'm running everything directly in Windows. And as far as I can tell, so is the SDK.

3. How? What good sites are for that? Preferably one I wouldn't have to register to use.
Title: Re: Images not showing up when I run the programs
Post by: spicypixel on 2012-Nov-26
If you renamed your project in the options at any point just check it hasn't made another folder projectnewname.app with a media folder in there. If it has then chances are there are no graphics inside that media folder.
Title: Re: Images not showing up when I run the programs
Post by: Lord_TNK on 2012-Nov-26
If you renamed your project in the options at any point just check it hasn't made another folder projectnewname.app with a media folder in there. If it has then chances are there are no graphics inside that media folder.
Thanks. Somehow there were two sub folders as I was making the project, and putting the pictures on the other one worked. I made a new project with just one sub folder, and it worked as well.
Title: Re: Images not showing up when I run the programs
Post by: spicypixel on 2012-Nov-26
If you renamed your project in the options at any point just check it hasn't made another folder projectnewname.app with a media folder in there. If it has then chances are there are no graphics inside that media folder.
Thanks. Somehow there were two sub folders as I was making the project, and putting the pictures on the other one worked. I made a new project with just one sub folder, and it worked as well.

No problem glad that sorted it out for you :) You can delete the non-working .app folder and contents now too.
Title: Re: Images not showing up when I run the programs
Post by: Lord_TNK on 2012-Nov-26
No problem glad that sorted it out for you :) You can delete the non-working .app folder and contents now too.
I think I might keep it around, just as a reminder of what not to do.

Also, perhaps we should keep this thread open for anyone else who finds their images don't load for some reason.