Posts: 488
Threads: 19
Joined: Sep 2005
I've seen it done before alot where the pictures used by the program are embeded in the exe, can this be done with a FreeBASIC compiled program, and if so, how would you load the pictures with BLOAD, what would be the directory?
Posts: 6,419
Threads: 74
Joined: Mar 2002
You have to work it out yourself. There are several ways, even there are several libraries which help you do it.
It somewhat consists on appending the data to the EXE file and then reading it from there using a normal OPEN "myprog.exe" FOR BINARY AS #fileHandle. Definitely, this is not newbie stuff at all.
If you are concerned about having to use many files, just pack them all into a big one which you read with OPEN or use any archiving library.
Posts: 488
Threads: 19
Joined: Sep 2005
Well for my next project I intend to make a 2D p*p scroller, so I need a way of storing the backgrounds, monsters, objects and misc. sprites without just making setting their properties to hidden. I'd prefer to combine them into the exe itself, but I have no clue where to start.
Posts: 6,419
Threads: 74
Joined: Mar 2002
Trust me, it's very hard and it's not worth unless you are using a library which has packing capabilities such as Allegro.
You can always save whole arrays of sprites in files. That way you get less files. Store them in a "data" folder and you just have your exe and your data folder, and nothing to disturb
If you were thinking of this as a way to avoid people loading your graphics, well... an EXE file with embedded graphics can be ripped as easily as you wink.
Posts: 488
Threads: 19
Joined: Sep 2005
Well is there a way to make the image uneditible, or else how would I combine them, could I just make them one big file, and just GET and PUT the different parts of the image??? But what about protection...
Posts: 1,025
Threads: 44
Joined: May 2005
You really don't have to worry that much about people stealing your images....if nothing else they can just do a screencaputre during the game anyhow and get them that way.
Posts: 488
Threads: 19
Joined: Sep 2005
It's more of the fact of editing and messing it up, even making them unopeneable in photo editing programs by adding seomthing to the file.
Posts: 979
Threads: 27
Joined: Aug 2001
What? Just use a resource:
http://www.freebasic.net/forum/viewtopic...t=resource
Or use bin2bas to create code with the image itself embedded:
http://www.freebasic.net/forum/viewtopic...ht=bin2bas
Both of these don't create a file, but they load the information into memory where you can access it for whatever purpose.
Posts: 488
Threads: 19
Joined: Sep 2005
Thanks alot man, very helpful, if I understood them, I'm not sure about how I would implement those examples. Maybe saving the files in a different format, but how would that be done. Like maybe a .pcr extension.
Posts: 677
Threads: 57
Joined: Jan 2005
Simple
BLOAD the image
get the colour co--ordinates for the different areas
Encrypt it
Save the Encrypted Image
and to load
Decrypt the colour co-ordinates into a array. Then use a for loop to draw the individual pixels in the array.
url=http://www.sloganizer.net/en/]
[/url]