[SOLVED]Saving Game Possibiliy in Qt question
-
Hi everyone... Is it possible to have my game a saving option? and load it afterwards? I'm working on my game right now and the idea of saving the game if not finished comes on my mind... SO is it possible? How?? Can you please give me a link or teach me how to do that?
I use javascript and QML for my game. ..
Thanks guys
-
Have a look at QSettings
edit : oops, didn't see javascript
-
It is not possible from JS AFAIK, but you always can use C++ backend.
-
Hmmn.. so do i have to rewrite my codes in c++???
-
Maybe this will help:
http://doc.qt.nokia.com/4.7-snapshot/declarative-sqllocalstorage.html -
thank you loladiro.. I'll look at it :D thanks
-
If you don't have any further questions, could you add [Solved] in front of the title (by editing the first post)?
-
Not sure that sqlstorage is something needed for saving. In this case I'll add couple of methods in C++ part and will invoke them from QML. Not hard, really.
-
What do you exactly mean by that Sir Denis Kormalev?
Can you please tell me how to do it? or maybe a link will do.. -
Look "here":http://doc.qt.nokia.com/4.7/qml-extending.html and maybe "here":http://doc.qt.nokia.com/4.7/qml-extending-tutorial-index.html .
In couple of words. The easiest solution for you will be to add QObject subclass to your project, add couple of slots (or Q_INVOKABLE methods) there and set its instance as context property for your declarative engine.
-
Is it fine if he make a XML file for saving his game? That's my plan for mine, by the way.
-
Format choise is up to you :) If you need to store some tree data or you want to edit it in your text editor later or you just need non-binary format then xml is ok.