2012-08-02 13:02:59 +08:00
|
|
|
#include "main.h"
|
2012-08-24 17:55:29 +08:00
|
|
|
|
2012-08-02 16:23:31 +08:00
|
|
|
#include "../Classes/AppDelegate.h"
|
2012-08-24 17:55:29 +08:00
|
|
|
#include "cocos2d.h"
|
|
|
|
#include "CCEGLView.h"
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
// 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-08-27 16:43:02 +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(480, 320);
|
|
|
|
return CCApplication::sharedApplication()->run();
|
2012-08-02 13:02:59 +08:00
|
|
|
}
|