Implementation of Stream and branches

Started by aravol, 07 August 2013, 06:53:55

aravol

Greetings!

Currently, I have begun implementation of this library with a personal project I and some friends are working on using SFML. We're using C#, and I have begun using the TGUI library.

In trying to keep some standardization, we're making use of resource files. I am finding that while some aspects have constructor implementations using Stream (ie Font) others simply do not (ie Picture), and thus make the use of Resources much more difficult. I have begun patching my local copy to support this, and was wondering if this was something planned for the final release, or if there was a way we could share these branched modifications?

PS if it might also be relevant, I'm currently building on a Windows machine, and was able to get the library up effortlessly simply by recompiling the source.

texus

No TGUI class has a constructor with a Stream. The Font class, or any other that have it, are part of SFML.

Loading from Stream is not planned in v0.6. It has been requested in the c++ version and this was my answer:
Quote from: texusLoading from memory is just not possible with the current design. The whole texture managment is build on top of the fact that images are loaded from files. So I would have to find a new design for the texture managment and I would have to change the config files to support this. I'm not even sure if I will be able to add this to the next version.

Of course c# is different. The biggest concern in the c++ version was TextureManager, but this class isn't needed in c# (at least not in the same way). But that leaves one issue: ConfigFile.
If you can point me out how I have to adjust my ConfigFile class to support streams then I'd be happy to make the changes. So if you can get the widgets to work that u use (or just for the Button class, that should be enough), then you can send me the modified files and I will make the adjustment to all other widgets.

Quotewas able to get the library up effortlessly simply by recompiling the source.
Did you have to do anything special for the Tao.OpenGL, or was it enought to include the sfml libraries?

aravol

Well, seems my foray into the underlying code wasn't quite complete.

My first thought on getting the Config files working with streams is to set a Stream or Resource in the Texture Manager that opens the base Texture being loaded from. Thus, the config files would point to a Resource key for their sheet, instead of a filename, and otherwise work the same way.

Quote from: texus on 07 August 2013, 12:00:13Did you have to do anything special for the Tao.OpenGL, or was it enought to include the sfml libraries?

I did have to add the Tao.OpenGL and Tao.OpenGL.ExtensionLoader DLLs, but only to the references. Once I did this and then "added existing item" across the TGUI source, it all built without complaint. The test project implementing this local build has no association to OpenGL, though I haven't yet opened a working widget due to the aformentioned streaming concerns.

aravol

Quote from: aravol on 07 August 2013, 14:46:11
My first thought on getting the Config files working with streams is to set a Stream or Resource in the Texture Manager that opens the base Texture being loaded from. Thus, the config files would point to a Resource key for their sheet, instead of a filename, and otherwise work the same way.

Quick test case, make that the passing in of a Resource Manager, which the Texture Manager then calls .GetObject to reference the "filename" - once it has this Byte[] it can make a MemoryStream from it, and then one should be able to start utilizing the other Texture Manager functions as before. As said, I'll poke around with it later tonight.

Also, thanks again for the prompt reply n.n

aravol

Test case has been done. The system works, with surprisingly little modification, as well. However, instead of directly using Streams, I have made the system work with a passed in ResourceManager, which is then checked for when Config files or Textures are loaded. If the filename is found as a valid Key in the resource, the resource is loaded instead. Works for images, config files pending

texus

#5
Good to hear that it doesn't take too many changes.
If images can get to work, then I'm sure ConfigFile shouldn't need more than a few extra modifications.



aravol

Not even a few - basically  I just added a System.Resources.Resource Manager to the Global object, and then GetTexture and he ConfigFile constructor check against it before opening files. Because of how easy it is to open streams, I only had to modify the code that starts up the streams, and none of how those streams are handled. Shoot me an email and I'll be able to send you a working copy n.n

texus

I'd be very interested to see the changes.
You could perhaps put the files on dropbox or something similar. Or if it are only a few source files then you could send them by email.

texus

Thanks for adding this feature and sharing the code.
I'll add it to the next release, which will hopefully have basic documentation and tutorials.

aravol

Let me know if you'd like a hand with those tutorials~

texus

If you would like to make tutorials then that would be very kind.

Maybe the most important one right now would be a tutorial about how to configure visual studio to use the library. So if you want to do something you could perhaps make a few screenshots that fit these instructions.

Other than that, I'll put any helpful tutorial online.

But maybe the tutorials shouldn't be placed on my site, but on the github wiki? That way everybody could just add useful tutorials.