Page 1 of 1

Release problem ( SOLVED )

Posted: December 17th, 2014, 11:10 pm
by StarPirate
Hi guys. This is kind of a strange situation i got here. This project here, "Gravity Simulator", has no problem whatsoever building and running in debug mode or not. But when i try to open the release or debug executable the program triggers an assertion and i can't figure why because it works like a charm when i debug it.
Please guys, I really need some help on this one.

Re: Release problem

Posted: December 18th, 2014, 4:05 am
by albinopapa
The font bitmap has to be in the same folder as the executable or the string to load the file must point to it. The default directory is the directory of the exe file. Subfolders can be accessed by adding the name of the subfolder before the name separated by two back slashes...

same folder as exe
"Consolas13x24.bmp"

subfolder
"FontSheets\\Consolas13x24.bmp"

Re: Release problem

Posted: December 18th, 2014, 9:13 am
by StarPirate
Thanks, I did not know that. Once the project is done i will post it with some instructions :)

Re: Release problem ( SOLVED )

Posted: December 18th, 2014, 5:34 pm
by StarPirate
One more question: is there something I can do to hide the bmp files i am using? I don't want the user to be able to see them.

Re: Release problem ( SOLVED )

Posted: December 18th, 2014, 11:34 pm
by albinopapa
I'm sure there are other ways, but one way is to make your own file format that stores the data in succession.

For instance, if all the files were the same size, you would just copy the pixels to a file one after another and you would be able to read them back in by offsetting the starting position of each read to be the start of the next bitmap data. If the files are of different sizes, you can create a struct that holds the width, the height of the bitmap and a data pointer that when you read in the data, you offset the read by the (sizeof(bitmapStructHeader) + (width * height * bitsPerPixel) of the current read position.

So for the first one you would have to read in the data for the struct, and that will leave the read pointer at sizeof(bitmapStructHeader) which would be about 12 bytes. This would give you the width and height of the first bitmap which would start at byte position 8 if the only data members in your struct are (int width, int height, D3DCOLOR* pData). If declared in that order, the first 4 bytes are width, the second 4 bytes are height, then on byte 8 ( 0 - 7 are width and height) your data would start and at the end of it your read pointer would be at the beginning of the next struct.

Make sure to use sizeof(int) because apparently the size of ints can be between 32 and 64 bits (4 - 8 bytes ) long.