SFML community forums
Help => General => Topic started by: Rimdeker on February 21, 2012, 10:25:41 am
-
[REDACTED]
-
I know that this is possible with Visual Studio, I don't know about Code::Blocks.
What you need is called resources, so if you google something like "codeblocks resources" then you might find out more.
-
It can be done in a standard way. All you have to do is to convert your media files to C++ files (using an external tool) that define the data as char arrays, include them into your app and use LoadFromMemory rather than LoadFromFile.
-
Can you recommend a converter?
I don't know them, sorry. But writing one is a straight-forward task.
Why LoadFromMemory?
Because the file contents are now in RAM (it is loaded when you run your exe), not on your hard drive anymore.
-
You can also use a program like Molebox, which I use all the time.
You just pack your resources into the final exe. It's great :)
http://www.molebox.com/
Ed
-
Use QT with qrc. If you need a colorful interface, use qtcreator. This is a cross-platform way.
-
Using Qt (not QT, which is QuickTime) only for their resource system would really be crazy.
-
Er why? It's not like there aren't other nice things in Qt worth using. Also, most popular distros already have Qt installed anyway. Windows users usually don't worry about a few extra dlls and neither do Mac folks.
There's lots of good stuff in Qt and the tools are great as well. Throw away Codeblocks and use Qtcreator.
-
Er why? It's not like there aren't other nice things in Qt worth using.
That's why I said "only for their resource system".
- Qt is a big dependency -- Windows users do worry about it, since DLLs are usually very badly managed.
- It requires pre-build steps to create the resource files, which are difficult to integrate into your preferred IDE if you don't have a dedicated plugin. And switching from your preferred IDE to QtCreator just because you use Qt to embed resources into your executable, doesn't seem like a reasonable choice.
- You must learn the Qt's basics before using it. Even if it's just for resources, there are a few tricks to understand.
- Then you have to use their IO classes if you want to be able to load your resources, but you must then convert them to something else so that you can use SFML's loading functions.
- And... well it's a huge multi-purpose C++ framework, it's insane to use it when the required feature can be written with 10 lines of code.
Let's focus on the requested feature, and not into a "Qt / QtCreator is better than X / Y" discussion please ;)
-
I know that this is possible with Visual Studio, I don't know about Code::Blocks.
What you need is called resources, so if you google something like "codeblocks resources" then you might find out more.
How would you do it in Visual Studio? (I'm using VS 2012)
-
How would you do it in Visual Studio? (I'm using VS 2012)
Maybe this (http://lmgtfy.com/?q=resources+visual+studio+2012) helps. ;)
-
404 Not Found ;D
You forgot a question mark before q.
-
I got the hint. :P
Thanks eXpl0it3r.