Jump to content
  • Advertisement
Sign in to follow this  
slynk

Making .dat Files without Allegro's Grabber

This topic is 3026 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!