2012-08-02 13:02:59 +08:00
|
|
|
#include "main.h"
|
|
|
|
#include "../Classes/AppDelegate.h"
|
|
|
|
#include "cocos2d.h"
|
2012-09-26 15:23:10 +08:00
|
|
|
|
2012-08-02 13:02:59 +08:00
|
|
|
|
2012-08-24 17:55:29 +08:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <string>
|
|
|
|
|
2012-08-02 13:02:59 +08:00
|
|
|
USING_NS_CC;
|
2012-08-24 17:55:29 +08:00
|
|
|
|
|
|
|
// 500 is enough?
|
|
|
|
#define MAXPATHLEN 500
|
|
|
|
|
2012-08-03 13:56:18 +08:00
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
2012-08-24 17:55:29 +08:00
|
|
|
// get application path
|
|
|
|
int length;
|
|
|
|
char fullpath[MAXPATHLEN];
|
|
|
|
length = readlink("/proc/self/exe", fullpath, sizeof(fullpath));
|
|
|
|
fullpath[length] = '\0';
|
|
|
|
|
|
|
|
std::string resourcePath = fullpath;
|
|
|
|
resourcePath = resourcePath.substr(0, resourcePath.find_last_of("/"));
|
2012-09-21 14:35:41 +08:00
|
|
|
resourcePath += "/../../../Resources/";
|
2012-08-24 17:55:29 +08:00
|
|
|
|
2012-08-02 13:02:59 +08:00
|
|
|
// create the application instance
|
2012-08-03 13:56:18 +08:00
|
|
|
AppDelegate app;
|
2012-08-24 17:55:29 +08:00
|
|
|
CCApplication::sharedApplication()->setResourceRootPath(resourcePath.c_str());
|
2012-08-21 15:28:43 +08:00
|
|
|
CCEGLView* eglView = CCEGLView::sharedOpenGLView();
|
|
|
|
eglView->setFrameSize(960, 640);
|
|
|
|
return CCApplication::sharedApplication()->run();
|
2012-08-02 13:02:59 +08:00
|
|
|
}
|