Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pictures in an exe?
#1
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?
Reply
#2
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.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#3
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.
Reply
#4
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 Tongue

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.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#5
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...
Reply
#6
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.
[Image: freebasic.png]
Reply
#7
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.
Reply
#8
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.
Reply
#9
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.
Reply
#10
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/][Image: style4,TheDarkJay.png][/url]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)