Quantcast
Channel: Cocos Forums - Latest topics
Viewing all articles
Browse latest Browse all 17076

Save level editor file to be loaded on an android device

$
0
0

@AlphaDeveloper wrote:

Hi everybody.

I'm starting developing in Cocos2dx C++ for Android Platform.
My game is a match squares like Move the Box. So, I made an editor that only runs in Win32 where I build all my levels. When the game starts, these levels must be loaded.

All my levels are being saved as binary file as binary file in the following way:

         char level_file[30];
		        sprintf(level_file,"\\world_%d\\level_%d.gs",currentLevel.world,currentLevel.levelnuber);

		std::vector<std::string> searchPaths;
		searchPaths.push_back("data");
		CCFileUtils::sharedFileUtils()->setSearchPaths(searchPaths);

		std::string path = searchPaths.at(0) + level_file;

		FILE* f = fopen(path.c_str(), "wb");

		if ( f != NULL){

			fwrite(&currentLevel, sizeof(LevelData), 1, f);
			fclose(f);
		}

When I run my game in Desktop, all levels are loaded because the files are inside the folder Resources/data/ . But, when a run the game in my android device I don't have any information about my levels.

So, my questions are the following: How I can get the files that I created in Desktop accessible in my device? what is the correct path that I should use when I save my levels?

I read this but didn't help me
And this help me only in a part.

Thank you very much.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 17076

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>