O'Reilly logo

Cocos2d-x Cookbook by Akihiro Matsuura

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using SQLite

You can save and load game data easily by using the database in your game. In a smartphone application, the database called SQLite is usually used. SQLite is easy to use. However, you have to set a few things before using it. In this recipe, we will explain how to set up and use SQLite in Cocos2d-x.

Getting ready

Cocos2d-x doesn't have an SQLite library. You have to add SQLite's source code to Cocos2d-x.

You need to download the source code from the site http://sqlite.org/download.html. The latest version at the time of writing this book is version 3.8.10. You can download this version's .zip file and expand it. Then, you can add the resulting files to your project as shown in the following image:

In this recipe, we will create an original ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required