Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How can I serialize my world/level data into and out of a file?  (Read 2042 times)

0 Members and 1 Guest are viewing this topic.

hipsterdufus

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • Email
Hi everyone, I decided to use boost::serialize to input or output my level data into a file. My level data basically just consists of a few std::vectors that contain the tiles in the level. Each tile contains sf::sprites and sf::textures along with a position. I can serialize everything in the tile class with the exception of the sf::sprite and sf::texture data. These are sfml types that boost doesn't know how to output or read in. Does anyone have any ideas on how to do this? I feel like there should be a simple solution that I'm overlooking here.

cpolymeris

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
    • Email
Re: How can I serialize my world/level data into and out of a file?
« Reply #1 on: August 05, 2013, 05:04:12 am »
I am not familiar with boost::serialize, but remember Textures reside in video memory, so you can't really serialize their contents. You would have to serialize the identifiers you use to load the textures (filenames or strings or whatever). I am sure boost allows you to define your own serialization routines for a class. Or probably easier: just use the string serialization that boost provides.

 

anything