Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / Serialize Gosu::Image Without...
- By ell Date 2010-03-05 19:46
Hello all, I would like to serialize some information about an image in the same file as it but I can't because that would mean serializing the window attribute as well. Its hard to explain... but my game loads files and serializes them rather than loading a .png. I was wondering If I could create a Gosu::Image object without specifying a window variable so that the serialized Gosu::Image could be used in any window, understand? Sorry if I am not clarifying the concept clearly enough, thanks in advance, ell.
- By lol_o2 Date 2010-03-05 20:22
"Unserialization" is impossible. You can only make script which will load this image for all windows at once.
- By ? Date 2010-03-07 12:52
Oh, okay then. Well, is there a bitmap class for ruby gosu? I know there is one for c++.
- By jlnr (dev) Date 2010-03-07 14:42
The bitmap class wouldn't help I think. Even in C++ Gosu, there is no way to get the content of an image back because there is no way to change the content anyway after loading from a file.

Since there is only one Window instance anyway, I guess you could just use Ruby's ObjectSpace to look for it until Gosu gets rid of the "window" parameter.
- By ? Date 2010-03-12 14:25
Hey again guys, sorry for the late reply, went to Conway on a school trip :) Thanks, that cleared things up a bit! I think I'l just go with it loading .png files on there own, or if needs be it can load any extra information from a file with the same name but a different extension so I can have an image file and an image info file. Thanks again, you'v been great, ell.
Up Topic Gosu / Gosu Exchange / Serialize Gosu::Image Without...

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill