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 / issue getting some images to show?

Author
Message
kynian
13
Years of Service
User Offline
Joined: 1st Sep 2011
Location:
Posted: 4th Sep 2011 09:14 Edited at: 4th Sep 2011 09:29
Hello, I've been following the tutorial from Helpfullprogrammer on youtube and I was working on the simple pong game. I followed his instructions and when I got to the point where I had loaded and displayed all of the images I wanted to debug to test and see if I got what he showed we were supposed to get. I only get a blue screen and nothing else, even though the BG image I use is black. now I figured maybe there was something wrong with the program that wouldn't let it load any images so I tried to load a previously used image, the player.bmp that was just for testing, and that worked and loaded just fine. I'm completely stumped as to why its not working, and any help would be much appreciated.

EDIT: attachment is the everything I've made for the pong game so far.

Attachments

Login to view attachments
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 4th Sep 2011 13:07 Edited at: 4th Sep 2011 13:09
The problem is the format how your images are saved. They are all palette-based, and it seems that in this case, one of the colours in the palette is treated as transparent colour, and the colour key that you set in the program is not used. In the background and line images, the palette contains only black and nothing else, so black will be the transparent colour and nothing of the image will show, because all of it will be transparent.

Your player sprite has the same problem. The colour key you set in the program is 255,0,255, but the pink colour in the player image is actually 255,30,191, so it doesn't match. It's transparent only because the pink is accidentally set in the palette as transparent colour. (I haven't worked much with palette-based images, so I don't know how the transparent colour is selected in them.)

If I change the format of the background and line images in an image editor so that they will be 8 bits/channel RGB colour and not palette-based (increase colour depth command), and re-save the images, then the black colour will correctly appear. In this format, the colour key will be used, so if I re-save the player sprite in this format as well, then the pink won't be transparent any more, since it doesn't match the colour key.

A request: next time when you post a program, please do not pack the huge ncb file and the Debug directory into the zip file. These are files generated by the compiler that are not needed to open and run the project, or to analyse the source code, but they increase the download size by several megabytes.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 4th Sep 2011 13:30
Instead of changing the image format, there is also another way to solve the problem: tell Dark GDK that the sprite is not transparent. You can achive this with:


The first zero flag says that the background does not need to be restored when the sprite is re-drawn, the second says that it is not transparent.
kynian
13
Years of Service
User Offline
Joined: 1st Sep 2011
Location:
Posted: 4th Sep 2011 19:11
thank you for the quick response! Im sorry for packing the large files with it, I wasn't sure exactly what you would need to see the issue I was having.

In regards to the issue with the images I never even knew that would happen, I made them exactly the same way I made my other images and they all seemed to show up fine. I dont suppose there is a simple way to change it from palette-based so they will work?

Login to post a reply

Server time is: 2024-11-19 08:38:58
Your offset time is: 2024-11-19 08:38:58