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();
|
2012-10-18 11:51:02 +08:00
|
|
|
eglView->setFrameSize(2048, 1536);
|
|
|
|
// The resolution of ipad3 is very large. In general, PC's resolution is smaller than it.
|
|
|
|
// So we need to invoke 'setFrameZoom'(only valid on desktop(win32, mac, linux)) to make the window smaller.
|
2012-10-19 17:39:55 +08:00
|
|
|
eglView->setFrameZoomFactor(0.4f);
|
2012-08-21 15:28:43 +08:00
|
|
|
return CCApplication::sharedApplication()->run();
|
2012-08-02 13:02:59 +08:00
|
|
|
}
|