Sign in to follow this  

Making .dat Files without Allegro's Grabber

This topic is 2660 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a tile editor that I want to improve on. Right now it loads up a master tile set .dat file and you can build a map with it. I want it to, on save, create a per level .dat file with just the tiles used. But I can't seem to find any libraries to help me do this. I've looked at the datafile routines in the allegro api and there doesn't seem to be one. Can anyone point me to something? Is it not possible?

Datafile Routines

Share this post


Link to post
Share on other sites
Quote:
Original post by slynk
I have a tile editor that I want to improve on. Right now it loads up a master tile set .dat file and you can build a map with it. I want it to, on save, create a per level .dat file with just the tiles used. But I can't seem to find any libraries to help me do this. I've looked at the datafile routines in the allegro api and there doesn't seem to be one. Can anyone point me to something? Is it not possible?

Datafile Routines


For saving and loading games in Allegro I never used those datafile routines..
I think you should look into fstream, it's very simple and easy to use.

a very simple program how to save something:


#include <iostream>
#include <fstream.h>

using namespace std;

int main()
{
ofstream file;
// ofstream -> output and ifstream -> input or use fstream to get both

file.open("file.dat"); //open a file

file<<"This is written to the file\n"<<75; //write to it

file.close(); //close it

return 0;
}




If you wish to use this in a tile based system, just make a few loops, and it should be fairly easy to load in all this data.

If you wish to have one .dat file for every level, simply input an other name in the file.open() function (strings perhaps if you want the user to be able to input the name himself).

I hope it helped!

Share this post


Link to post
Share on other sites

This topic is 2660 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this