1

I want to use SQLite database to store the scores of the games created with cocos2D framework. I use a singleton class controller called GameManager to control my application. To load the Scores I have a ScoreScene class which inherits CCScene and that class is called from GameManager, then when ScoreScene loads and from ScoreScene ScoreLayer class is called which inherits CCLayer class. I temporarily stored the score variable in GameManager and it is accessed from everywhere.

Now please help me and point out any weaknesses in my design and also help me in how I can implement SQLite database and store the score from GameManager class to the database.

Shahnawaz
  • 646
  • 1
  • 11
  • 25

1 Answers1

1

The GameManager singleton seems to take the responsibility of managing common data and actions globally, right? Just be careful if there are multi-threading cases. I think your design is OK to use.

For SQLite part, you can refer to Apple official documentations if you want to use it via Core Data:

Or you can use it via C interface directly. Some references:

Community
  • 1
  • 1
Hailei
  • 42,163
  • 6
  • 44
  • 69