Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Datafile Questions

Credits go to Michael Faerber and Thomas Fjellstrom for helping out!
This thread is locked; no one can reply to it. rss feed Print
Datafile Questions
Jeff Bernard
Member #6,698
December 2005
avatar

1. Is it possible to store bitmaps into a datafile that have different pallettes? It'd be cool if I could store all my images in one file, but my variety has caused me to use different pallettes for them.

2. Is is possible to load a datafile object as a FILE*, or should I just go ahead and define a custom type?

--
I thought I was wrong once, but I was mistaken.

Michael Faerber
Member #4,800
July 2004
avatar

1. Yes.
2. Not entirely sure, but probably yes too.

--
"The basic of informatics is Microsoft Office." - An informatics teacher in our school
"Do you know Linux?" "Linux? Isn't that something for visually impaired people?"

Thomas Fjellstrom
Member #476
June 2000
avatar

Quote:

2. Is is possible to load a datafile object as a FILE*, or should I just go ahead and define a custom type?

Yes, but you'd have to parse the data file yourself to get anything out of it.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Jeff Bernard
Member #6,698
December 2005
avatar

Ha, maybe I should've elaborated a bit on the questions, but thanks for answering them. Ok, so let's go into a little more detail:

1. Maybe I'm just doing something wrong, but I try loading a bitmap into a datafile using grabber.exe. I do 'Read Bitmap' and then grab it. I create another bitmap in the datafile, 'Read Bitmap' and grab it. However, it changes what the first bitmap looked like (the colors and such). Did the first one actually not change, or what's going on with that?

2. Ok, I'm satisfied with this. I'll just write my custom routine then.

--
I thought I was wrong once, but I was mistaken.

Thomas Fjellstrom
Member #476
June 2000
avatar

You need to import the images as a PALETTE entry as well as a BITMAP, bitmaps arnt stored with their palette's in a datafile.

Quote:

2. Ok, I'm satisfied with this. I'll just write my custom routine then.

Why bother?

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Jeff Bernard
Member #6,698
December 2005
avatar

Quote:

Why bother?

Because I read your answer wrong.:P

Thanks a lot guys, this is all I need.

--
I thought I was wrong once, but I was mistaken.

Thomas Fjellstrom
Member #476
June 2000
avatar

I'm sorry, what did you mean by "datafile object"? the entire datafile? or just a single item in the datafile? Because the latter is possible, pack_fopen("datafile.dat#objectname", "r");

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Jeff Bernard
Member #6,698
December 2005
avatar

Yes, that's exactly what I meant.

--
I thought I was wrong once, but I was mistaken.

Go to: