Removes unused templates.

This commit is contained in:
James Chen 2014-03-04 09:46:32 +08:00
parent 62ffb8e995
commit 33a5be526c
183 changed files with 0 additions and 12258 deletions

View File

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -1,35 +0,0 @@
// boot code needed for cocos2d + JS bindings.
// Not needed by cocos2d-html5
require("jsb.js");
var appFiles = [
'src/resource.js',
'src/app.js'
];
cc.dumpConfig();
for( var i=0; i < appFiles.length; i++) {
require( appFiles[i] );
}
var director = cc.Director.getInstance();
director.setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
director.setAnimationInterval(1.0 / 60);
// create a scene. it's an autorelease object
var myScene = new MyScene();
// run
if (director.getRunningScene())
{
director.replaceScene(myScene);
}
else
{
director.runWithScene(myScene);
}

View File

@ -1,72 +0,0 @@
#include "AppDelegate.h"
#include "cocosbuilder/js_bindings_ccbreader.h"
#include "SimpleAudioEngine.h"
#include "jsb_cocos2dx_auto.hpp"
#include "jsb_cocos2dx_extension_auto.hpp"
#include "jsb_cocos2dx_builder_auto.hpp"
#include "extension/jsb_cocos2dx_extension_manual.h"
#include "localstorage/js_bindings_system_registration.h"
#include "chipmunk/js_bindings_chipmunk_registration.h"
#include "jsb_opengl_registration.h"
#include "Runtime.h"
USING_NS_CC;
using namespace CocosDenshion;
AppDelegate::AppDelegate()
{
}
AppDelegate::~AppDelegate()
{
ScriptEngineManager::destroyInstance();
}
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLView::createWithRect("Test Lua", Rect(0,0,900,640));
director->setOpenGLView(glview);
}
// turn on display FPS
director->setDisplayStats(true);
auto designSize = Size(480, 320);
glview->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::EXACT_FIT);
// set FPS. the default value is 1.0/60 if you don't call this
director->setAnimationInterval(1.0 / 60);
ScriptingCore* sc = ScriptingCore::getInstance();
sc->addRegisterCallback(register_all_cocos2dx);
sc->addRegisterCallback(register_all_cocos2dx_extension);
sc->addRegisterCallback(register_cocos2dx_js_extensions);
sc->addRegisterCallback(register_all_cocos2dx_extension_manual);
sc->addRegisterCallback(register_all_cocos2dx_builder);
sc->addRegisterCallback(register_CCBuilderReader);
sc->addRegisterCallback(jsb_register_system);
sc->addRegisterCallback(JSB_register_opengl);
sc->addRegisterCallback(jsb_register_chipmunk);
startRuntime();
return true;
}
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
void AppDelegate::applicationDidEnterBackground()
{
Director::getInstance()->stopAnimation();
SimpleAudioEngine::getInstance()->pauseBackgroundMusic();
SimpleAudioEngine::getInstance()->pauseAllEffects();
}
// this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground()
{
Director::getInstance()->startAnimation();
SimpleAudioEngine::getInstance()->resumeBackgroundMusic();
SimpleAudioEngine::getInstance()->resumeAllEffects();
}

View File

@ -1,45 +0,0 @@
//
// GCTestAppDelegate.h
// GCTest
//
// Created by Rohan Kuruvilla on 06/08/2012.
// Copyright __MyCompanyName__ 2012. All rights reserved.
//
#ifndef _APP_DELEGATE_H_
#define _APP_DELEGATE_H_
#include "CCApplication.h"
/**
@brief The cocos2d Application.
The reason for implement as private inheritance is to hide some interface call by Director.
*/
class AppDelegate : private cocos2d::Application
{
public:
AppDelegate();
virtual ~AppDelegate();
/**
@brief Implement Director and Scene init code here.
@return true Initialize success, app continue.
@return false Initialize failed, app terminate.
*/
virtual bool applicationDidFinishLaunching();
/**
@brief The function be called when the application enter background
@param the pointer of the application
*/
virtual void applicationDidEnterBackground();
/**
@brief The function be called when the application enter foreground
@param the pointer of the application
*/
virtual void applicationWillEnterForeground();
};
#endif // _APP_DELEGATE_H_

View File

@ -1,347 +0,0 @@
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "Runtime.h"
#include "SimpleAudioEngine.h"
#include "jsb_cocos2dx_auto.hpp"
#include "jsb_cocos2dx_extension_auto.hpp"
#include "jsb_cocos2dx_builder_auto.hpp"
#include "extension/jsb_cocos2dx_extension_manual.h"
#include "cocosbuilder/js_bindings_ccbreader.h"
#include "localstorage/js_bindings_system_registration.h"
#include "chipmunk/js_bindings_chipmunk_registration.h"
#include "jsb_opengl_registration.h"
#include "CCScheduler.h"
#ifdef _WIN32
#define realpath(dir,fuldir) _fullpath(fuldir,dir,_MAX_PATH_)
#else
#include <unistd.h>
#include <limits.h>
#include <dirent.h>
#include <unistd.h>
#include <sys/stat.h>
#include <stdio.h>
#endif
#include <vector>
#include <string>
using namespace std;
using namespace cocos2d;
extern string getDotWaitFilePath();
extern string getProjSearchPath();
extern vector<string> getSearchPath();
extern bool browseDir(const char *dir,const char *filespec,vector<string> &filterArray,vector<std::string> &fileList);
/*@brief use "|" splite string */
vector<string> splitFilter(const char *str)
{
vector<string> filterArray;
if (str)
{
char *token=NULL;
char szFilterFile[_MAX_PATH_]={0};
strcpy(szFilterFile,str);
token = strtok(szFilterFile, "|" );
while( token != NULL )
{
filterArray.push_back(token);
token = strtok( NULL, "|");
}
}
return filterArray;
}
/*@brief wildcard funciton*/
bool wildcardMatches(const char *wildcard, const char *str)
{
while (1) {
if (*wildcard == '\0')
{
return *str == '\0';
}
if (*wildcard == '?')
{
++wildcard; ++str;
}
else if (*wildcard == '*')
{
for (++wildcard; *str; ++str)
{
if (wildcardMatches(wildcard, str))
{
return true;
}
}
return *wildcard == '\0';
}
else
{
if (*wildcard != *str)
{
return false;
}
++wildcard; ++str;
}
}
}
#ifndef _WIN32
/*
*@brief iterator directory and process file.
*/
bool browseDir(const char *dir,const char *filespec,vector<string> &filterArray,vector<std::string> &fileList)
{
DIR *dp=NULL;
struct dirent *entry=NULL;
struct stat statbuf;
if((dp = opendir(dir)) == NULL)
{
return false;
}
if (chdir(dir) != 0)
{
return false;
}
while((entry = readdir(dp)) != NULL)
{
lstat(entry->d_name,&statbuf);
if(S_ISDIR(statbuf.st_mode))
{
if(strcmp(".",entry->d_name) == 0 ||strcmp("..",entry->d_name) == 0)
{
continue;
}
if (find(filterArray.begin(),filterArray.end(),entry->d_name) != filterArray.end())
{
continue;
}
char subdir[_MAX_PATH_]={0};
sprintf(subdir,"%s%s/",dir,entry->d_name);
if (!browseDir(subdir,filespec,filterArray,fileList))
{
closedir(dp);
return false;
}
}
else
{
if (!wildcardMatches(filespec,entry->d_name))
{
continue;
}
char *pszexten=strrchr(entry->d_name,'.');
char szextension[_MAX_PATH_]={0};
if (pszexten)
{
strcpy(szextension,"*");
strcat(szextension,pszexten);
if (find(filterArray.begin(),filterArray.end(),szextension) != filterArray.end())
{
continue;
}
}
strcpy(szextension,entry->d_name);
if (find(filterArray.begin(),filterArray.end(),szextension) != filterArray.end())
{
continue;
}
char fullFileName[_MAX_PATH_] ={0};
sprintf(fullFileName,"%s%s",dir,entry->d_name);
fileList.push_back(fullFileName);
}
}
chdir("..");
closedir(dp);
return true;
}
#endif
/************************
* Get file list from specified directory.
*
*@param dir search directory
*@param filespec search specified type file
*@param filterfile filter file or folder
*
*Like this:
* searchFileList("/home","*.*",".svn|.jpg|");
*********************************/
vector<std::string> searchFileList(string &dir,const char *filespec="*.*",const char *filterfile=NULL)
{
char fulldir[_MAX_PATH_]={0};
vector<string> _filterArray;
vector<std::string> _lfileList;
_filterArray = splitFilter(filterfile);
if (realpath(dir.c_str(), fulldir)== NULL)
{
return _lfileList;
}
int len=strlen(fulldir);
if (fulldir[len-1] != '/')
{
strcat(fulldir,"/");
}
browseDir(fulldir,filespec,_filterArray,_lfileList);
dir =fulldir;
return _lfileList;
}
void startScript()
{
ScriptEngineProtocol *engine = ScriptingCore::getInstance();
ScriptEngineManager::getInstance()->setScriptEngine(engine);
ScriptingCore::getInstance()->runScript("cocos2d-jsb.js");
}
void reloadScript()
{
}
class ConnectWaiter: public Ref
{
public:
static ConnectWaiter& getInstance()
{
static ConnectWaiter instance;
return instance;
}
void updateConnect(float delta)
{
FileUtils::getInstance()->purgeCachedEntries();
if (!FileUtils::getInstance()->isFileExist(_dotwaitFile))
{
_scheduler->unscheduleSelector(SEL_SCHEDULE(&ConnectWaiter::updateConnect),this);
startScript();
}
}
void waitDebugConnect(void)
{
_dotwaitFile = getDotWaitFilePath();
_jsSearchPath = getProjSearchPath();
vector<std::string> fileInfoList = searchFileList(_jsSearchPath,"*.js","runtime|framework|");
for (unsigned i = 0; i < fileInfoList.size(); i++)
{
ScriptingCore::getInstance()->compileScript(fileInfoList[i].substr(_jsSearchPath.length(),-1).c_str());
}
if (!FileUtils::getInstance()->isFileExist(_dotwaitFile))
{
startScript();
return;
}
if (_scheduler)
{
_scheduler->scheduleSelector(SEL_SCHEDULE(&ConnectWaiter::updateConnect), this,0.5f, false);
}
}
private:
ConnectWaiter()
{
_scheduler = CCDirector::sharedDirector()->getScheduler();
}
cocos2d::Scheduler *_scheduler;
string _dotwaitFile;
string _jsSearchPath;
};
void startRuntime()
{
vector<string> searchPathArray;
searchPathArray = getSearchPath();
for (unsigned i = 0; i < searchPathArray.size(); i++)
{
FileUtils::getInstance()->addSearchPath(searchPathArray[i]);
}
#ifdef COCOS2D_DEBUG
ScriptingCore::getInstance()->start();
ScriptingCore::getInstance()->enableDebugger();
ScriptEngineProtocol *engine = ScriptingCore::getInstance();
ScriptEngineManager::getInstance()->setScriptEngine(engine);
ScriptingCore::getInstance()->runScript("jsb.js");
ConnectWaiter::getInstance().waitDebugConnect();
#else
ScriptingCore::getInstance()->start();
startScript();
#endif
}
// SimulatorConfig
SimulatorConfig *SimulatorConfig::s_sharedInstance = NULL;
SimulatorConfig *SimulatorConfig::getInstance(void)
{
if (!s_sharedInstance)
{
s_sharedInstance = new SimulatorConfig();
}
return s_sharedInstance;
}
SimulatorConfig::SimulatorConfig(void)
{
m_screenSizeArray.push_back(SimulatorScreenSize("iPhone 3Gs (480x320)", 480, 320));
m_screenSizeArray.push_back(SimulatorScreenSize("iPhone 4 (960x640)", 960, 640));
m_screenSizeArray.push_back(SimulatorScreenSize("iPhone 5 (1136x640)", 1136, 640));
m_screenSizeArray.push_back(SimulatorScreenSize("iPad (1024x768)", 1024, 768));
m_screenSizeArray.push_back(SimulatorScreenSize("iPad Retina (2048x1536)", 2048, 1536));
m_screenSizeArray.push_back(SimulatorScreenSize("Android (800x480)", 800, 480));
m_screenSizeArray.push_back(SimulatorScreenSize("Android (854x480)", 854, 480));
m_screenSizeArray.push_back(SimulatorScreenSize("Android (960x540)", 960, 540));
m_screenSizeArray.push_back(SimulatorScreenSize("Android (1024x600)", 1024, 600));
m_screenSizeArray.push_back(SimulatorScreenSize("Android (1280x720)", 1280, 720));
m_screenSizeArray.push_back(SimulatorScreenSize("Android (1280x800)", 1280, 800));
m_screenSizeArray.push_back(SimulatorScreenSize("Android (1920x1080)", 1920, 1080));
}
int SimulatorConfig::getScreenSizeCount(void)
{
return (int)m_screenSizeArray.size();
}
const SimulatorScreenSize SimulatorConfig::getScreenSize(int index)
{
return m_screenSizeArray.at(index);
}

View File

@ -1,69 +0,0 @@
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef _RUNTIME__H_
#define _RUNTIME__H_
#include <string>
#include <vector>
using namespace std;
#define _MAX_PATH_ 512
void startRuntime();
void reloadScript();
// SimulatorConfig
typedef struct _SimulatorScreenSize {
string title;
int width;
int height;
_SimulatorScreenSize(const string title_, int width_, int height_)
{
title = title_;
width = width_;
height = height_;
}
} SimulatorScreenSize;
typedef vector<SimulatorScreenSize> ScreenSizeArray;
class SimulatorConfig
{
public:
static SimulatorConfig *getInstance(void);
// predefined screen size
int getScreenSizeCount(void);
const SimulatorScreenSize getScreenSize(int index);
private:
SimulatorConfig(void);
static SimulatorConfig *s_sharedInstance;
ScreenSizeArray m_screenSizeArray;
};
#endif // _RUNTIME__H_

View File

@ -1,419 +0,0 @@
#! /usr/bin/env python
# coding=utf-8
# filename=build_runtime.py
import os
import re
import sys
import shutil
import platform
import subprocess
if platform.system() == 'Windows':
import _winreg
def checkParams():
"""Custom and check param list.
"""
from optparse import OptionParser
# set the parser to parse input params
# the correspond variable name of "-x, --xxx" is parser.xxx
if platform.system() == "Darwin":
parser = OptionParser(
usage="Usage: %prog -p <android|ios|mac>\n\
Sample: %prog -p ios"
)
parser.add_option(
"-p",
"--platform",
metavar="PLATFORM",
type="choice",
choices=["android", "ios", "mac"],
help="Set build runtime's platform"
)
elif platform.system() == "Windows":
parser = OptionParser(
usage="Usage: %prog -p <win32|android>\n\
Sample: %prog -p win32"
)
parser.add_option(
"-p",
"--platform",
metavar="PLATFORM",
type="choice",
choices=["win32", "android"],
help="Set build runtime's platform"
)
parser.add_option(
"-u",
"--pure",
dest="pure",
action="store_true",
help="parameter for copy resource"
)
# parse the params
(opts, args) = parser.parse_args()
if not opts.platform:
parser.error("-p or --platform is not specified")
if not opts.pure:
return opts.platform, None
return opts.platform, opts.pure
class BuildRuntime:
def __init__(self, platform, pure):
self.projectPath = None
self.projectName = None
self.runtimePlatform = platform
self.pure = pure
scriptPath = os.path.abspath(os.path.dirname(__file__))
if platform == 'win32':
self.projectPath = os.path.join(scriptPath, "proj.win32")
elif platform == 'android':
self.projectPath = os.path.join(scriptPath, "proj.android")
elif platform == 'ios':
self.projectPath = os.path.join(scriptPath, "proj.ios_mac")
elif platform == 'mac':
self.projectPath = os.path.join(scriptPath, "proj.ios_mac")
def buildRuntime(self):
if self.runtimePlatform == 'win32':
self.win32Runtime()
elif self.runtimePlatform == 'android':
self.androidRuntime()
if self.runtimePlatform == 'ios':
self.iosRuntime()
if self.runtimePlatform == 'mac':
self.macRuntime()
def macRuntime(self):
commands = [
"xcodebuild",
"-version"
]
child = subprocess.Popen(commands, stdout=subprocess.PIPE)
xcode = None
version = None
for line in child.stdout:
if 'Xcode' in line:
xcode, version = str.split(line, ' ')
child.wait()
if xcode is None:
print ("Xcode wasn't installed")
return False
if version <= '5':
print ("Update xcode please")
return False
res = self.checkFileByExtention(".xcodeproj")
if not res:
print ("Can't find the \".xcodeproj\" file")
return False
projectPath = os.path.join(self.projectPath, self.projectName)
pbxprojectPath = os.path.join(projectPath, "project.pbxproj")
print(pbxprojectPath)
f = file(pbxprojectPath)
contents = f.read()
section = re.search(
r"Begin PBXProject section.*End PBXProject section",
contents,
re.S
)
if section is None:
print ("Can't find Mac target")
return False
targets = re.search(r"targets = (.*);", section.group(), re.S)
if targets is None:
print ("Can't find Mac target")
return False
targetName = None
names = re.split("\*", targets.group())
for name in names:
if "Mac" in name:
targetName = str.strip(name)
if targetName is None:
print ("Can't find Mac target")
return False
macFolder = os.path.join(self.projectPath, "..", "..", "runtime", "mac")
if os.path.isdir(macFolder):
shutil.rmtree(macFolder)
commands = [
"xcodebuild",
"-project",
projectPath,
"-configuration",
"Debug",
"-target",
targetName,
"CONFIGURATION_BUILD_DIR=%s" % (macFolder)
]
child = subprocess.Popen(commands, stdout=subprocess.PIPE)
for line in child.stdout:
print (line)
child.wait()
filelist = os.listdir(macFolder)
for filename in filelist:
name, extention = os.path.splitext(filename)
if extention == '.a':
filename = os.path.join(macFolder, filename)
os.remove(filename)
if extention == '.app':
filename = os.path.join(macFolder, filename)
if ' ' in name:
newname = os.path.join(macFolder, name[:name.find(' ')]+extention)
os.rename(filename, newname)
def iosRuntime(self):
commands = [
"xcodebuild",
"-version"
]
child = subprocess.Popen(commands, stdout=subprocess.PIPE)
xcode = None
version = None
for line in child.stdout:
if 'Xcode' in line:
xcode, version = str.split(line, ' ')
child.wait()
if xcode is None:
print ("Xcode wasn't installed")
return False
if version <= '5':
print ("Update xcode please")
return False
res = self.checkFileByExtention(".xcodeproj")
if not res:
print ("Can't find the \".xcodeproj\" file")
return False
projectPath = os.path.join(self.projectPath, self.projectName)
pbxprojectPath = os.path.join(projectPath, "project.pbxproj")
print(pbxprojectPath)
f = file(pbxprojectPath)
contents = f.read()
section = re.search(r"Begin PBXProject section.*End PBXProject section", contents, re.S)
if section is None:
print ("Can't find iOS target")
return False
targets = re.search(r"targets = (.*);", section.group(), re.S)
if targets is None:
print ("Can't find iOS target")
return False
targetName = None
names = re.split("\*", targets.group())
for name in names:
if "iOS" in name:
targetName = str.strip(name)
if targetName is None:
print ("Can't find iOS target")
return False
iosFolder = os.path.join(self.projectPath, "..", "..", "runtime", "ios")
if os.path.isdir(iosFolder):
filelist = os.listdir(iosFolder)
for filename in filelist:
if ".app" in filename:
f = os.path.join(iosFolder, filename)
shutil.rmtree(f)
commands = [
"xcodebuild",
"-project",
projectPath,
"-configuration",
"Debug",
"-target",
targetName,
"-sdk",
"iphonesimulator",
"CONFIGURATION_BUILD_DIR=%s" % (iosFolder)
]
child = subprocess.Popen(commands, stdout=subprocess.PIPE)
for line in child.stdout:
print (line)
child.wait()
filelist = os.listdir(iosFolder)
for filename in filelist:
name, extention = os.path.splitext(filename)
if extention == '.a':
filename = os.path.join(iosFolder, filename)
os.remove(filename)
if extention == '.app':
filename = os.path.join(iosFolder, filename)
newname = os.path.join(iosFolder, name[:name.find(' ')]+extention)
os.rename(filename, newname)
def androidRuntime(self):
try:
SDK_ROOT = os.environ['ANDROID_SDK_ROOT']
except Exception:
print ("ANDROID_SDK_ROOT not defined.\
Please define ANDROID_SDK_ROOT in your environment")
return False
try:
NDK_ROOT = os.environ['NDK_ROOT']
except Exception:
print ("NDK_ROOT not defined.\
Please define NDK_ROOT in your environment")
return False
platformsPath = os.path.join(SDK_ROOT,"platforms")
if not os.path.isdir(platformsPath):
print ("Can't find android platforms")
return False
platforms = os.listdir(platformsPath)
versions = []
for platform in platforms:
if "android-" in platform:
version = platform[platform.find('-')+1:]
versions.append(version)
maxVersion = max(map(float, versions))
if maxVersion <= 10.0:
print ("Update android sdk please")
return False
buildNative = os.path.join(self.projectPath, "build_native.py")
if not os.path.isdir(self.projectPath) or not os.path.isfile(buildNative):
print ("Can't find the build_native.py")
return False
sys.path.append(self.projectPath)
from build_native import build
build(None, str(int(maxVersion)), None, self.pure)
def win32Runtime(self):
try:
vs = _winreg.OpenKey(
_winreg.HKEY_LOCAL_MACHINE,
r"SOFTWARE\Microsoft\VisualStudio"
)
msbuild = _winreg.OpenKey(
_winreg.HKEY_LOCAL_MACHINE,
r"SOFTWARE\Microsoft\MSBuild\ToolsVersions"
)
except WindowsError:
print ("Visual Studio wasn't installed")
return False
vsPath = None
i = 0
try:
while True:
version = _winreg.EnumKey(vs, i)
try:
if float(version) >= 11.0:
key = _winreg.OpenKey(vs, r"SxS\VS7")
vsPath,type = _winreg.QueryValueEx(key, version)
except:
pass
i += 1
except WindowsError:
pass
if vsPath is None:
print("Can't find the Visual Studio's path in the regedit")
return False
msbuildPath = None
i = 0
try:
while True:
version = _winreg.EnumKey(msbuild,i)
try:
if float(version) >= 4.0:
key = _winreg.OpenKey(msbuild, version)
msbuildPath, type = _winreg.QueryValueEx(
key,
"MSBuildToolsPath"
)
except:
pass
i += 1
except WindowsError:
pass
if msbuildPath is None:
print ("Can't find the MSBuildTools' path in the regedit")
return False
res = self.checkFileByExtention(".sln")
if not res:
print ("Can't find the \".sln\" file")
return False
msbuildPath = os.path.join(msbuildPath, "MSBuild.exe")
projectPath = os.path.join(self.projectPath, self.projectName)
commands = [
msbuildPath,
projectPath,
"/maxcpucount:4",
"/t:build",
"/p:configuration=Debug"
]
child = subprocess.Popen(commands, stdout=subprocess.PIPE)
for line in child.stdout:
print (line)
child.wait()
return True
def checkFileByExtention(self, ext, path=None):
filelist = ""
if path is None:
filelist = os.listdir(self.projectPath)
else:
filelist = os.listdir(path)
for file in filelist:
name, extention = os.path.splitext(file)
if extention == ext:
self.projectName = file
return True
return False
if __name__ == '__main__':
platform, pure = checkParams();
buildRuntime = BuildRuntime(platform, pure)
buildRuntime.buildRuntime()

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

View File

@ -1,65 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>HelloJavascript</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
<linkedResources>
<link>
<name>Classes</name>
<type>2</type>
<locationURI>COCOS2DX/projects/HelloJavascript/Classes</locationURI>
</link>
<link>
<name>cocos2dx</name>
<type>2</type>
<locationURI>COCOS2DX/cocos2dx</locationURI>
</link>
<link>
<name>extensions</name>
<type>2</type>
<locationURI>COCOS2DX/extensions</locationURI>
</link>
<link>
<name>scripting</name>
<type>2</type>
<locationURI>COCOS2DX/scripting</locationURI>
</link>
</linkedResources>
</projectDescription>

View File

@ -1,37 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.cocos2dx.hellojavascript"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="9"/>
<uses-feature android:glEsVersion="0x00020000" />
<application android:label="@string/app_name"
android:icon="@drawable/icon">
<activity android:name="org.cocos2dx.javascript.Cocos2dxActivity"
android:label="@string/app_name"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:configChanges="orientation|screenSize|smallestScreenSize">
<!-- Tell NativeActivity the name of our .so -->
<meta-data android:name="android.app.lib_name"
android:value="cocos2djs" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<supports-screens android:anyDensity="true"
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"/>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>

View File

@ -1,87 +0,0 @@
## Prerequisites:
* Android NDK
* Android SDK **OR** Eclipse ADT Bundle
* Android AVD target installed
## Building project
There are two ways of building Android projects.
1. Eclipse
2. Command Line
### Import Project in Eclipse
#### Features:
1. Complete workflow from Eclipse, including:
* Build C++.
* Clean C++.
* Build and Run whole project.
* Logcat view.
* Debug Java code.
* Javascript editor.
* Project management.
2. True C++ editing, including:
* Code completion.
* Jump to definition.
* Refactoring tools etc.
* Quick open C++ files.
#### Setup Eclipse Environment (only once)
**NOTE:** This step needs to be done only once to setup the Eclipse environment for cocos2d-x projects. Skip this section if you've done this before.
1. Download Eclipse ADT bundle from [Google ADT homepage](http://developer.android.com/sdk/index.html)
**OR**
Install Eclipse with Java. Add ADT and CDT plugins.
2. Only for Windows
1. Install [Cygwin](http://www.cygwin.com/) with make (select make package from the list during the install).
2. Add `Cygwin\bin` directory to system PATH variable.
3. Add this line `none /cygdrive cygdrive binary,noacl,posix=0,user 0 0` to `Cygwin\etc\fstab` file.
3. Set up Variables:
1. Path Variable `COCOS2DX`:
* Eclipse->Preferences->General->Workspace->**Linked Resources**
* Click **New** button to add a Path Variable `COCOS2DX` pointing to the root cocos2d-x directory.
![Example](https://lh5.googleusercontent.com/-oPpk9kg3e5w/UUOYlq8n7aI/AAAAAAAAsdQ/zLA4eghBH9U/s400/cocos2d-x-eclipse-vars.png)
2. C/C++ Environment Variable `NDK_ROOT`:
* Eclipse->Preferences->C/C++->Build->**Environment**.
* Click **Add** button and add a new variable `NDK_ROOT` pointing to the root NDK directory.
![Example](https://lh3.googleusercontent.com/-AVcY8IAT0_g/UUOYltoRobI/AAAAAAAAsdM/22D2J9u3sig/s400/cocos2d-x-eclipse-ndk.png)
* Only for Windows: Add new variables **CYGWIN** with value `nodosfilewarning` and **SHELLOPTS** with value `igncr`
4. Import libcocos2dx library project:
1. File->New->Project->Android Project From Existing Code.
2. Click **Browse** button and open `cocos2d-x/cocos2dx/platform/android/java` directory.
3. Click **Finish** to add project.
#### Adding and running from Eclipse
![Example](https://lh3.googleusercontent.com/-SLBOu6e3QbE/UUOcOXYaGqI/AAAAAAAAsdo/tYBY2SylOSM/s288/cocos2d-x-eclipse-project-from-code.png) ![Import](https://lh5.googleusercontent.com/-XzC9Pn65USc/UUOcOTAwizI/AAAAAAAAsdk/4b6YM-oim9Y/s400/cocos2d-x-eclipse-import-project.png)
1. File->New->Project->Android Project From Existing Code
2. **Browse** to your project directory. eg: `cocos2d-x/cocos2dx/samples/Cpp/TestCpp/proj.android/`
3. Add the project
4. Click **Run** or **Debug** to compile C++ followed by Java and to run on connected device or emulator.
### Running project from Command Line
$ cd cocos2d-x/samples/Cpp/TestCpp/proj.android/
$ export NDK_ROOT=/path/to/ndk
$ ./build_native.sh
$ ant debug install
If the last command results in sdk.dir missing error then do:
$ android list target
$ android update project -p . -t (id from step 6)
$ android update project -p cocos2d-x/cocos2dx/platform/android/java/ -t (id from step 6)

View File

@ -1 +0,0 @@
aapt.ignore.assets="!*.pvr.gz:!*.gz:!.svn:!.git:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~"

View File

@ -1,92 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="HelloJavascript" default="debug">
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<property file="local.properties" />
<!-- The ant.properties file can be created by you. It is only edited by the
'android' tool to add properties to it.
This is the place to change some Ant specific build properties.
Here are some properties you may want to change/update:
source.dir
The name of the source directory. Default is 'src'.
out.dir
The name of the output directory. Default is 'bin'.
For other overridable properties, look at the beginning of the rules
files in the SDK, at tools/ant/build.xml
Properties related to the SDK location or the project target should
be updated using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your
application and should be checked into Version Control Systems.
-->
<property file="ant.properties" />
<!-- if sdk.dir was not set from one of the property file, then
get it from the ANDROID_HOME env var.
This must be done before we load project.properties since
the proguard config can use sdk.dir -->
<property environment="env" />
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
<isset property="env.ANDROID_HOME" />
</condition>
<!-- The project.properties file is created and updated by the 'android'
tool, as well as ADT.
This contains project specific properties such as project target, and library
dependencies. Lower level build properties are stored in ant.properties
(or in .classpath for Eclipse projects).
This file is an integral part of the build system for your
application and should be checked into Version Control Systems. -->
<loadproperties srcFile="project.properties" />
<!-- quick check on sdk.dir -->
<fail
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
unless="sdk.dir"
/>
<!--
Import per project custom build rules if present at the root of the project.
This is the place to put custom intermediary targets such as:
-pre-build
-pre-compile
-post-compile (This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir})
-post-package
-post-build
-pre-clean
-->
<import file="custom_rules.xml" optional="true" />
<!-- Import the actual build file.
To customize existing targets, there are two options:
- Customize only one target:
- copy/paste the target into this file, *before* the
<import> task.
- customize it to your needs.
- Customize the whole content of build.xml
- copy/paste the content of the rules files (minus the top node)
into this file, replacing the <import> task.
- customize to your needs.
***********************
****** IMPORTANT ******
***********************
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
in order to avoid having your file be overridden by tools such as "android update project"
-->
<!-- version-tag: 1 -->
<import file="${sdk.dir}/tools/ant/build.xml" />
</project>

View File

@ -1,200 +0,0 @@
#!/usr/bin/python
# build_native.py
# Build native codes
import sys
import os, os.path
import shutil
from optparse import OptionParser
def get_num_of_cpu():
''' The build process can be accelerated by running multiple concurrent job processes using the -j-option.
'''
try:
platform = sys.platform
if platform == 'win32':
if 'NUMBER_OF_PROCESSORS' in os.environ:
return int(os.environ['NUMBER_OF_PROCESSORS'])
else:
return 1
else:
from numpy.distutils import cpuinfo
return cpuinfo.cpu._getNCPUs()
except Exception:
print "Can't know cpuinfo, use default 1 cpu"
return 1
def check_environment_variables_sdk():
''' Checking the environment ANDROID_SDK_ROOT, which will be used for building
'''
try:
SDK_ROOT = os.environ['ANDROID_SDK_ROOT']
except Exception:
print "ANDROID_SDK_ROOT not defined. Please define ANDROID_SDK_ROOT in your environment"
sys.exit(1)
return SDK_ROOT
def check_environment_variables():
''' Checking the environment NDK_ROOT, which will be used for building
'''
try:
NDK_ROOT = os.environ['NDK_ROOT']
except Exception:
print "NDK_ROOT not defined. Please define NDK_ROOT in your environment"
sys.exit(1)
return NDK_ROOT
def select_toolchain_version():
'''Because ndk-r8e uses gcc4.6 as default. gcc4.6 doesn't support c++11. So we should select gcc4.7 when
using ndk-r8e. But gcc4.7 is removed in ndk-r9, so we should determine whether gcc4.7 exist.
Conclution:
ndk-r8e -> use gcc4.7
ndk-r9 -> use gcc4.8
'''
ndk_root = check_environment_variables()
if os.path.isdir(os.path.join(ndk_root,"toolchains/arm-linux-androideabi-4.8")):
os.environ['NDK_TOOLCHAIN_VERSION'] = '4.8'
print "The Selected NDK toolchain version was 4.8 !"
elif os.path.isdir(os.path.join(ndk_root,"toolchains/arm-linux-androideabi-4.7")):
os.environ['NDK_TOOLCHAIN_VERSION'] = '4.7'
print "The Selected NDK toolchain version was 4.7 !"
else:
print "Couldn't find the gcc toolchain."
exit(1)
def check_ant_variables():
''' Checking the environment ANT, which will be used for package
'''
try:
ANT_PATH = os.environ['ANT_PATH']
except Exception:
print "ANT_PATH not defined. Please define ANT_PATH in your environment"
sys.exit(1)
return ANT_PATH
def do_build(cocos_root, ndk_root, app_android_root,ndk_build_param,sdk_root,android_platform,build_mode):
ndk_path = os.path.join(ndk_root, "ndk-build")
# windows should use ";" to seperate module paths
platform = sys.platform
if platform == 'win32':
ndk_module_path = 'NDK_MODULE_PATH=%s;%s/external;%s/cocos' % (cocos_root, cocos_root, cocos_root)
else:
ndk_module_path = 'NDK_MODULE_PATH=%s:%s/external:%s/cocos' % (cocos_root, cocos_root, cocos_root)
num_of_cpu = get_num_of_cpu()
if ndk_build_param == None:
command = '%s -j%d -C %s %s' % (ndk_path, num_of_cpu, app_android_root, ndk_module_path)
else:
command = '%s -j%d -C %s %s %s' % (ndk_path, num_of_cpu, app_android_root, ''.join(str(e) for e in ndk_build_param), ndk_module_path)
if os.system(command) != 0:
raise Exception("Build dynamic library for project [ " + app_android_root + " ] fails!")
elif android_platform is not None:
sdk_tool_path = os.path.join(sdk_root, "tools/android")
cocoslib_path = os.path.join(cocos_root, "cocos/2d/platform/android/java")
command = '%s update lib-project -t %s -p %s' % (sdk_tool_path,android_platform,cocoslib_path)
if os.system(command) != 0:
raise Exception("update cocos lib-project [ " + cocoslib_path + " ] fails!")
command = '%s update project -t %s -p %s -s' % (sdk_tool_path,android_platform,app_android_root)
if os.system(command) != 0:
raise Exception("update project [ " + app_android_root + " ] fails!")
ant_path=check_ant_variables()
ant_path = os.path.join(ant_path, "ant")
buildfile_path = os.path.join(app_android_root, "build.xml")
command = '%s clean %s -f %s -Dsdk.dir=%s' % (ant_path,build_mode,buildfile_path,sdk_root)
os.system(command)
def copy_files(src, dst):
for item in os.listdir(src):
path = os.path.join(src, item)
# Android can not package the file that ends with ".gz"
if not item.startswith('.') and not item.endswith('.gz') and os.path.isfile(path):
shutil.copy(path, dst)
if os.path.isdir(path):
new_dst = os.path.join(dst, item)
os.makedirs(new_dst)
copy_files(path, new_dst)
def copy_resources(app_android_root, build_mode, pure):
# remove app_android_root/assets if it exists
assets_dir = os.path.join(app_android_root, "assets")
if os.path.isdir(assets_dir):
shutil.rmtree(assets_dir)
#"""
os.makedirs(assets_dir)
if pure is None:
jsResource = os.path.join(app_android_root, "../../")
dirlist = os.listdir(jsResource)
for line in dirlist:
if line == "framework" or line == "runtime" or line == ".project":
continue
fullpath = os.path.join(jsResource, line)
if os.path.isfile(fullpath):
shutil.copy(fullpath, assets_dir)
else:
dstDir = "%s/%s" %(assets_dir,line)
os.makedirs(dstDir)
copy_files(fullpath, dstDir)
#"""
# copy resources
"""
os.mkdir(assets_dir)
resources_dir = os.path.join(app_android_root, "../Resources")
if os.path.isdir(resources_dir):
copy_files(resources_dir, assets_dir)
"""
# jsb project should copy javascript files and resources(shared with cocos2d-html5)
resources_dir = os.path.join(app_android_root, "../cocos2d/cocos/scripting/javascript/script")
copy_files(resources_dir, assets_dir)
def build(ndk_build_param,android_platform,build_mode,pure):
ndk_root = check_environment_variables()
sdk_root = None
select_toolchain_version()
current_dir = os.path.dirname(os.path.realpath(__file__))
cocos_root = os.path.join(current_dir, "../cocos2d")
app_android_root = current_dir
copy_resources(app_android_root, build_mode, pure)
if android_platform is not None:
sdk_root = check_environment_variables_sdk()
if android_platform.isdigit():
android_platform = 'android-'+android_platform
else:
print 'please use vaild android platform'
exit(1)
if build_mode is None:
build_mode = 'debug'
elif build_mode != 'release':
build_mode = 'debug'
do_build(cocos_root, ndk_root, app_android_root,ndk_build_param,sdk_root,android_platform,build_mode)
# -------------- main --------------
if __name__ == '__main__':
parser = OptionParser()
parser.add_option("-n", "--ndk", dest="ndk_build_param", help='parameter for ndk-build')
parser.add_option("-p", "--platform", dest="android_platform",
help='parameter for android-update.Without the parameter,the script just build dynamic library for project. Valid android-platform are:[10|11|12|13|14|15|16|17|18|19]')
parser.add_option("-b", "--build", dest="build_mode",
help='the build mode for java project,debug[default] or release.Get more information,please refer to http://developer.android.com/tools/building/building-cmdline.html')
parser.add_option("-u", "--pure", dest="pure", help='parameter for copy resource')
(opts, args) = parser.parse_args()
build(opts.ndk_build_param,opts.android_platform,opts.build_mode,opts.pure)

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="custom_rules">
<target name="-post-build">
<!-- delete temp files -->
<delete>
<fileset dir="${out.absolute.dir}" includes="build.prop resources.ap_ ${dex.file.name}* ${resource.package.file.name}* ${ant.project.name}-release-unaligned.apk ${ant.project.name}-release-unsigned.apk*"/>
</delete>
<!-- rename final apk file -->
<property name="apk.final.name" value="${out.absolute.dir}/../../../runtime/${ant.project.name}/android/${ant.project.name}" />
<move file="${out.final.file}" tofile="${apk.final.name}.apk" />
</target>
</project>

View File

@ -1,33 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := cocos2djs_shared
LOCAL_MODULE_FILENAME := libcocos2djs
LOCAL_SRC_FILES := hellojavascript/main.cpp \
hellojavascript/Runtime_android.cpp \
../../Classes/AppDelegate.cpp \
../../Classes/Runtime.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes
LOCAL_WHOLE_STATIC_LIBRARIES := cocos_jsb_static
LOCAL_WHOLE_STATIC_LIBRARIES += jsb_extension_static
LOCAL_WHOLE_STATIC_LIBRARIES += jsb_chipmunk_static
LOCAL_WHOLE_STATIC_LIBRARIES += jsb_localstorage_static
LOCAL_WHOLE_STATIC_LIBRARIES += jsb_network_static
LOCAL_WHOLE_STATIC_LIBRARIES += jsb_builder_static
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_DEBUG=2 -DCOCOS2D_JAVASCRIPT
include $(BUILD_SHARED_LIBRARY)
$(call import-module,scripting/javascript/bindings)
$(call import-module,scripting/javascript/bindings/extension)
$(call import-module,scripting/javascript/bindings/chipmunk)
$(call import-module,scripting/javascript/bindings/localstorage)
$(call import-module,scripting/javascript/bindings/network)
$(call import-module,scripting/javascript/bindings/cocosbuilder)

View File

@ -1,4 +0,0 @@
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char

View File

@ -1,29 +0,0 @@
#include <string>
#include <vector>
using namespace std;
string getProjSearchPath()
{
extern std::string getPackageNameJNI();
string searchPath = "/mnt/sdcard/";
searchPath += getPackageNameJNI();
return searchPath;
}
vector<string> getSearchPath()
{
extern std::string getPackageNameJNI();
vector<string> searchPathArray;
searchPathArray.push_back(getProjSearchPath());
return searchPathArray;
}
string getDotWaitFilePath()
{
extern std::string getPackageNameJNI();
string searchPath = getPackageNameJNI();
string dotwaitFile = "/mnt/sdcard/";
dotwaitFile += searchPath;
dotwaitFile += "/.wait";
return dotwaitFile;
}

View File

@ -1,16 +0,0 @@
#include "AppDelegate.h"
#include "cocos2d.h"
#include "platform/android/jni/JniHelper.h"
#include "CCEventType.h"
#include <jni.h>
#include <android/log.h>
#define LOG_TAG "main"
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
using namespace cocos2d;
void cocos_android_app_init (struct android_app* app) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
}

View File

@ -1,20 +0,0 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

View File

@ -1,13 +0,0 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.
# Project target.
target=android-19
android.library.reference.1=../cocos2d/cocos/2d/platform/android/java

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">HelloJavascript</string>
</resources>

View File

@ -1,32 +0,0 @@
package org.cocos2dx.javascript;
import android.app.NativeActivity;
import android.os.Bundle;
public class Cocos2dxActivity extends NativeActivity{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
//For supports translucency
//1.change "attribs" in cocos\2d\platform\android\nativeactivity.cpp
/*const EGLint attribs[] = {
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
//EGL_BLUE_SIZE, 5, -->delete
//EGL_GREEN_SIZE, 6, -->delete
//EGL_RED_SIZE, 5, -->delete
EGL_BUFFER_SIZE, 32, //-->new field
EGL_DEPTH_SIZE, 16,
EGL_STENCIL_SIZE, 8,
EGL_NONE
};*/
//2.Set the format of window
// getWindow().setFormat(PixelFormat.TRANSLUCENT);
}
}

View File

@ -1,28 +0,0 @@
#include <string>
#include <vector>
using namespace std;
string getProjSearchPath()
{
NSString *bundlePath = [[NSBundle mainBundle] resourcePath];
if (bundlePath != nil) {
return [bundlePath UTF8String];
}
return "";
}
vector<string> getSearchPath()
{
vector<string> searchPathArray;
return searchPathArray;
}
string getDotWaitFilePath()
{
string dotwaitFile;
dotwaitFile = getProjSearchPath();
dotwaitFile += "/.wait";
return dotwaitFile;
}

View File

@ -1,35 +0,0 @@
/****************************************************************************
Copyright (c) 2010-2013 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
@class RootViewController;
@interface AppController : NSObject <UIAccelerometerDelegate, UIAlertViewDelegate, UITextFieldDelegate,UIApplicationDelegate>
{
UIWindow *window;
RootViewController *viewController;
}
@end

View File

@ -1,146 +0,0 @@
/****************************************************************************
Copyright (c) 2010-2013 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#import <UIKit/UIKit.h>
#import "cocos2d.h"
#import "AppController.h"
#import "AppDelegate.h"
#import "RootViewController.h"
#import "CCEAGLView.h"
@implementation AppController
#pragma mark -
#pragma mark Application lifecycle
// cocos2d application instance
static AppDelegate s_sharedApplication;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
// Add the view controller's view to the window and display.
window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
CCEAGLView *eaglView = [CCEAGLView viewWithFrame: [window bounds]
pixelFormat: kEAGLColorFormatRGBA8
depthFormat: GL_DEPTH24_STENCIL8_OES
preserveBackbuffer: NO
sharegroup: nil
multiSampling: NO
numberOfSamples: 0 ];
[eaglView setMultipleTouchEnabled:YES];
// Use RootViewController manage CCEAGLView
viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil];
viewController.wantsFullScreenLayout = YES;
viewController.view = eaglView;
// Set RootViewController to window
if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0)
{
// warning: addSubView doesn't work on iOS6
[window addSubview: viewController.view];
}
else
{
// use this method on ios6
[window setRootViewController:viewController];
}
[window makeKeyAndVisible];
[[UIApplication sharedApplication] setStatusBarHidden: YES];
// IMPORTANT: Setting the GLView should be done after creating the RootViewController
cocos2d::GLView *glview = cocos2d::GLView::createWithEAGLView(eaglView);
cocos2d::Director::getInstance()->setOpenGLView(glview);
cocos2d::Application::getInstance()->run();
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application {
/*
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
*/
//We don't need to call this method any more. It will interupt user defined game pause&resume logic
/* cocos2d::Director::getInstance()->pause(); */
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
/*
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
*/
//We don't need to call this method any more. It will interupt user defined game pause&resume logic
/* cocos2d::Director::getInstance()->resume(); */
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
/*
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
*/
cocos2d::Application::getInstance()->applicationDidEnterBackground();
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
/*
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
*/
cocos2d::Application::getInstance()->applicationWillEnterForeground();
}
- (void)applicationWillTerminate:(UIApplication *)application {
/*
Called when the application is about to terminate.
See also applicationDidEnterBackground:.
*/
}
#pragma mark -
#pragma mark Memory management
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
/*
Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.
*/
cocos2d::Director::getInstance()->purgeCachedData();
}
- (void)dealloc {
[super dealloc];
}
@end

View File

@ -1 +0,0 @@
66c6d1cead373b45218424f6a82f370897e443e4

View File

@ -1 +0,0 @@
84689888a14a2123d2b39f7f2f61be8c15207479

View File

@ -1,8 +0,0 @@
//
// Prefix header for all source files of the 'HelloJavascript' target in the 'HelloJavascript' project
//
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#endif

View File

@ -1,33 +0,0 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010 Ricardo Quesada
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#import <UIKit/UIKit.h>
@interface RootViewController : UIViewController {
}
- (BOOL)prefersStatusBarHidden;
@end

View File

@ -1,105 +0,0 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010 Ricardo Quesada
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#import "RootViewController.h"
#import "cocos2d.h"
#import "CCEAGLView.h"
@implementation RootViewController
/*
// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
// Custom initialization
}
return self;
}
*/
/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
}
*/
// Override to allow orientations other than the default portrait orientation.
// This method is deprecated on ios6
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return UIInterfaceOrientationIsLandscape( interfaceOrientation );
}
// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
- (NSUInteger) supportedInterfaceOrientations{
#ifdef __IPHONE_6_0
return UIInterfaceOrientationMaskAllButUpsideDown;
#endif
}
- (BOOL) shouldAutorotate {
return YES;
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
[super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
CGSize s = CGSizeMake([[CCEAGLView sharedEGLView] getWidth], [[CCEAGLView sharedEGLView] getHeight]);
cocos2d::Application::getInstance()->applicationScreenSizeChanged((int) s.width, (int) s.height);
}
//fix not hide status on ios7
- (BOOL)prefersStatusBarHidden
{
return YES;
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
}
@end

View File

@ -1,11 +0,0 @@
#import <UIKit/UIKit.h>
int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, @"AppController");
[pool release];
return retVal;
}

View File

@ -1 +0,0 @@
2040fc6fe624353ae1d3db50cd3d450f4fda5afc

View File

@ -1,140 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4514" systemVersion="13B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment version="1060" defaultVersion="1090" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="AppController">
<connections>
<outlet property="delegate" destination="536" id="537"/>
<outlet property="menu" destination="29" id="650"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<menu title="AMainMenu" systemMenu="main" id="29">
<items>
<menuItem title="Cocos-player" id="GS6-Lb-ftA">
<menu key="submenu" title="Cocos-player" systemMenu="apple" id="YN2-V8-ty0">
<items>
<menuItem title="About Cocos-player" id="HhF-Es-coQ">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontStandardAboutPanel:" target="-1" id="tSA-7z-LPk"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="OzD-Nm-tPt">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Services" id="TOj-vg-cDm">
<menu key="submenu" title="Services" systemMenu="services" id="e98-We-UX5"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="muN-Hw-eeZ">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Hide Cocos-player" keyEquivalent="h" id="sH6-na-PTL">
<connections>
<action selector="hide:" target="-3" id="SGN-0p-7lH"/>
</connections>
</menuItem>
<menuItem title="Hide Others" keyEquivalent="h" id="XG8-CE-veT">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="hideOtherApplications:" target="-3" id="iJd-Ba-eXG"/>
</connections>
</menuItem>
<menuItem title="Show All" id="IqD-3v-zQT">
<connections>
<action selector="unhideAllApplications:" target="-3" id="DR8-By-ymv"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="GU5-eI-OTq">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Quit Cocos-player" keyEquivalent="q" id="7Z7-ot-jqY">
<connections>
<action selector="terminate:" target="-3" id="DyL-yF-GYq"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="File" id="83">
<menu key="submenu" title="File" id="81">
<items>
<menuItem title="Close" keyEquivalent="w" id="611">
<connections>
<action selector="onFileClose:" target="-1" id="661"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="View" id="295" userLabel="Menu Item - View">
<menu key="submenu" title="View" id="296" userLabel="Menu - View">
<items>
<menuItem isSeparatorItem="YES" id="579"/>
<menuItem title="Portait" state="on" id="592">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="onScreenPortait:" target="-1" id="667"/>
</connections>
</menuItem>
<menuItem title="Landscape" id="593">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="onScreenLandscape:" target="-1" id="647"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="594"/>
<menuItem title="Actual (100%)" state="on" tag="100" keyEquivalent="0" id="595">
<connections>
<action selector="onScreenZoomOut:" target="-1" id="yUj-fN-Rh7"/>
</connections>
</menuItem>
<menuItem title="Zoom Out (75%)" tag="75" keyEquivalent="6" id="pqR-xy-5ip">
<connections>
<action selector="onScreenZoomOut:" target="-1" id="yps-LZ-egB"/>
</connections>
</menuItem>
<menuItem title="Zoom Out (50%)" tag="50" keyEquivalent="5" id="596">
<connections>
<action selector="onScreenZoomOut:" target="-1" id="654"/>
</connections>
</menuItem>
<menuItem title="Zoom Out (25%)" tag="25" keyEquivalent="4" id="QB8-6D-hAr">
<connections>
<action selector="onScreenZoomOut:" target="-1" id="DSu-if-D2T"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Control" id="Heh-SD-KHE">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Control" id="ysx-9J-ekz">
<items>
<menuItem title="Reload" id="hfu-OP-8X3">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="onReloadScript:" target="-1" id="ar6-Pq-fmZ"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Help" id="490">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Help" systemMenu="help" id="491"/>
</menuItem>
</items>
</menu>
<customObject id="420" customClass="NSFontManager"/>
<customObject id="536" customClass="AppController">
<connections>
<outlet property="menu" destination="29" id="550"/>
</connections>
</customObject>
</objects>
</document>

View File

@ -1,7 +0,0 @@
//
// Prefix header for all source files of the 'Paralaxer' target in the 'Paralaxer' project
//
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif

View File

@ -1,50 +0,0 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include <string>
#include "AppDelegate.h"
@interface AppController : NSObject <NSApplicationDelegate, NSWindowDelegate>
{
NSWindow *window;
NSMenu *menu;
NSFileHandle *fileHandle;
//console pipe
NSPipe *pipe;
NSFileHandle *pipeReadHandle;
}
@property (nonatomic, assign) IBOutlet NSMenu* menu;
- (IBAction) onFileClose:(id)sender;
- (IBAction) onScreenPortait:(id)sender;
- (IBAction) onScreenLandscape:(id)sender;
- (IBAction) onScreenZoomOut:(id)sender;
- (IBAction) onReloadScript:(id)sender;
@end

View File

@ -1,271 +0,0 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#import "SimulatorApp.h"
#include <sys/stat.h>
#include <stdio.h>
#include <fcntl.h>
#include <string>
#include <vector>
#include "AppDelegate.h"
#include "glfw3.h"
#include "glfw3native.h"
#include "Runtime.h"
#include "cocos2d.h"
using namespace cocos2d;
bool g_landscape=false;
CCSize g_screenSize;
GLView* g_eglView=NULL;
using namespace std;
using namespace cocos2d;
@implementation AppController
@synthesize menu;
-(void) dealloc
{
CCDirector::sharedDirector()->end();
[super dealloc];
}
#pragma mark -
#pragma delegates
- (void) applicationDidFinishLaunching:(NSNotification *)aNotification
{
AppDelegate app;
[self createSimulator:[NSString stringWithUTF8String:"HelloJavascript"] viewWidth:960 viewHeight:640 factor:1.0];
int ret = Application::getInstance()->run();
}
#pragma mark -
#pragma mark functions
- (void) createSimulator:(NSString*)viewName viewWidth:(float)width viewHeight:(float)height factor:(float)frameZoomFactor
{
if (g_eglView)
{
return;
}
g_eglView = GLView::createWithRect([viewName cStringUsingEncoding:NSUTF8StringEncoding],cocos2d::Rect(0.0f,0.0f,width,height),frameZoomFactor);
auto director = Director::getInstance();
director->setOpenGLView(g_eglView);
g_landscape = false;
g_screenSize.width = width;
g_screenSize.height = height;
if (width > height)
{
g_landscape = true;
}
window = glfwGetCocoaWindow(g_eglView->getWindow());
window.delegate = self;
[NSApp setDelegate: self];
[self createViewMenu];
[self updateMenu];
[window center];
[window becomeFirstResponder];
[window makeKeyAndOrderFront:self];
[window setAcceptsMouseMovedEvents:NO];
}
- (void) createViewMenu
{
NSMenu *submenu = [[[window menu] itemWithTitle:@"View"] submenu];
for (int i = SimulatorConfig::getInstance()->getScreenSizeCount() - 1; i >= 0; --i)
{
SimulatorScreenSize size = SimulatorConfig::getInstance()->getScreenSize(i);
NSMenuItem *item = [[[NSMenuItem alloc] initWithTitle:[NSString stringWithCString:size.title.c_str() encoding:NSUTF8StringEncoding]
action:@selector(onViewChangeFrameSize:)
keyEquivalent:@""] autorelease];
[item setTag:i];
[submenu insertItem:item atIndex:0];
}
}
- (void) updateMenu
{
NSMenu *menuScreen = [[[window menu] itemWithTitle:@"View"] submenu];
NSMenuItem *itemPortait = [menuScreen itemWithTitle:@"Portait"];
NSMenuItem *itemLandscape = [menuScreen itemWithTitle:@"Landscape"];
if (g_landscape)
{
[itemPortait setState:NSOffState];
[itemLandscape setState:NSOnState];
}
else
{
[itemPortait setState:NSOnState];
[itemLandscape setState:NSOffState];
}
int scale = 100;
NSMenuItem *itemZoom100 = [menuScreen itemWithTitle:@"Actual (100%)"];
NSMenuItem *itemZoom75 = [menuScreen itemWithTitle:@"Zoom Out (75%)"];
NSMenuItem *itemZoom50 = [menuScreen itemWithTitle:@"Zoom Out (50%)"];
NSMenuItem *itemZoom25 = [menuScreen itemWithTitle:@"Zoom Out (25%)"];
[itemZoom100 setState:NSOffState];
[itemZoom75 setState:NSOffState];
[itemZoom50 setState:NSOffState];
[itemZoom25 setState:NSOffState];
if (scale == 100)
{
[itemZoom100 setState:NSOnState];
}
else if (scale == 75)
{
[itemZoom75 setState:NSOnState];
}
else if (scale == 50)
{
[itemZoom50 setState:NSOnState];
}
else if (scale == 25)
{
[itemZoom25 setState:NSOnState];
}
int width = g_screenSize.width;
int height = g_screenSize.height;
if (height > width)
{
int w = width;
width = height;
height = w;
}
int count = SimulatorConfig::getInstance()->getScreenSizeCount();
for (int i = 0; i < count; ++i)
{
bool bSel = false;
SimulatorScreenSize size = SimulatorConfig::getInstance()->getScreenSize(i);
if (size.width == width && size.height == height)
{
bSel = true;
}
NSMenuItem *itemView = [menuScreen itemWithTitle:[NSString stringWithUTF8String:size.title.c_str()]];
[itemView setState:(bSel? NSOnState : NSOffState)];
}
//[window setTitle:[NSString stringWithFormat:@"quick-x-player (%0.0f%%)", projectConfig.getFrameScale() * 100]];
}
- (void) updateView
{
if (g_landscape)
{
glfwSetWindowSize(g_eglView->getWindow(),g_screenSize.width,g_screenSize.height);
}
else
{
glfwSetWindowSize(g_eglView->getWindow(),g_screenSize.height,g_screenSize.width);
}
[self updateMenu];
}
- (BOOL) applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)theApplication
{
return YES;
}
- (BOOL) applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)flag
{
return NO;
}
- (void) windowWillClose:(NSNotification *)notification
{
[[NSRunningApplication currentApplication] terminate];
}
- (IBAction) onFileClose:(id)sender
{
[[NSApplication sharedApplication] terminate:self];
}
- (IBAction) onScreenPortait:(id)sender
{
g_landscape = false;
[self updateView];
}
- (IBAction) onScreenLandscape:(id)sender
{
g_landscape = true;
[self updateView];
}
- (IBAction) onReloadScript:(id)sender
{
reloadScript();
}
- (IBAction) onViewChangeFrameSize:(id)sender
{
NSInteger index = [sender tag];
if (index >= 0 && index < SimulatorConfig::getInstance()->getScreenSizeCount())
{
SimulatorScreenSize size = SimulatorConfig::getInstance()->getScreenSize(index);
g_screenSize.width = size.width;
g_screenSize.height = size.height;
[self updateView];
}
}
- (IBAction) onScreenZoomOut:(id)sender
{
if ([sender state] == NSOnState) return;
float scale = (float)[sender tag] / 100.0f;
[self setZoom:scale];
}
@end

View File

@ -1,7 +0,0 @@
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[])
{
return NSApplicationMain(argc, (const char **)argv);
}

View File

@ -1,110 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloJavascript", "HelloJavascript.vcxproj", "{3B0B58B1-2734-488E-A542-ECEC11EB2455}"
ProjectSection(ProjectDependencies) = postProject
{21B2C324-891F-48EA-AD1A-5AE13DE12E28} = {21B2C324-891F-48EA-AD1A-5AE13DE12E28}
{B57CF53F-2E49-4031-9822-047CC0E6BDE2} = {B57CF53F-2E49-4031-9822-047CC0E6BDE2}
{39379840-825A-45A0-B363-C09FFEF864BD} = {39379840-825A-45A0-B363-C09FFEF864BD}
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25} = {207BC7A9-CCF1-4F2F-A04D-45F72242AE25}
{811C0DAB-7B96-4BD3-A154-B7572B58E4AB} = {811C0DAB-7B96-4BD3-A154-B7572B58E4AB}
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} = {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "..\cocos2d\cocos\2d\cocos2d.vcxproj", "{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libchipmunk", "..\cocos2d\external\chipmunk\proj.win32\chipmunk.vcxproj", "{207BC7A9-CCF1-4F2F-A04D-45F72242AE25}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libAudio", "..\cocos2d\cocos\audio\proj.win32\CocosDenshion.vcxproj", "{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}"
ProjectSection(ProjectDependencies) = postProject
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libJSBinding", "..\cocos2d\cocos\scripting\javascript\bindings\proj.win32\libJSBinding.vcxproj", "{39379840-825A-45A0-B363-C09FFEF864BD}"
ProjectSection(ProjectDependencies) = postProject
{21B2C324-891F-48EA-AD1A-5AE13DE12E28} = {21B2C324-891F-48EA-AD1A-5AE13DE12E28}
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25} = {207BC7A9-CCF1-4F2F-A04D-45F72242AE25}
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} = {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libJSBindingForChipmunk", "..\cocos2d\cocos\scripting\javascript\bindings\chipmunk\libJSBindingForChipmunk.vcxproj", "{21070E58-EEC6-4E16-8B4F-6D083DF55790}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libLocalStorage", "..\cocos2d\cocos\storage\local-storage\proj.win32\libLocalStorage.vcxproj", "{632A8F38-D0F0-4D22-86B3-D69F5E6BF63A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libJSBindingForLocalStorage", "..\cocos2d\cocos\scripting\javascript\bindings\localstorage\libJSBindingForLocalStorage.vcxproj", "{68F5F371-BD7B-4C30-AE5B-0B08F22E0CDE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libJSBindingForExtension", "..\cocos2d\cocos\scripting\javascript\bindings\extension\libJSBindingForExtension.vcxproj", "{625F7391-9A91-48A1-8CFC-79508C822637}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libExtensions", "..\cocos2d\extensions\proj.win32\libExtensions.vcxproj", "{21B2C324-891F-48EA-AD1A-5AE13DE12E28}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCocosStudio", "..\cocos2d\cocos\editor-support\cocostudio\proj.win32\libCocosStudio.vcxproj", "{B57CF53F-2E49-4031-9822-047CC0E6BDE2}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCocosBuilder", "..\cocos2d\cocos\editor-support\cocosbuilder\proj.win32\libCocosBuilder.vcxproj", "{811C0DAB-7B96-4BD3-A154-B7572B58E4AB}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libJSBindingForBuilder", "..\cocos2d\cocos\scripting\javascript\bindings\cocosbuilder\libJSBindingForBuilder.vcxproj", "{F9DA0FC1-651B-457B-962E-A4D61CEBF5FD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3B0B58B1-2734-488E-A542-ECEC11EB2455}.Debug|Win32.ActiveCfg = Debug|Win32
{3B0B58B1-2734-488E-A542-ECEC11EB2455}.Debug|Win32.Build.0 = Debug|Win32
{3B0B58B1-2734-488E-A542-ECEC11EB2455}.Release|Win32.ActiveCfg = Release|Win32
{3B0B58B1-2734-488E-A542-ECEC11EB2455}.Release|Win32.Build.0 = Release|Win32
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|Win32.ActiveCfg = Debug|Win32
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|Win32.Build.0 = Debug|Win32
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.ActiveCfg = Release|Win32
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.Build.0 = Release|Win32
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25}.Debug|Win32.ActiveCfg = Debug|Win32
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25}.Debug|Win32.Build.0 = Debug|Win32
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25}.Release|Win32.ActiveCfg = Release|Win32
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25}.Release|Win32.Build.0 = Release|Win32
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}.Debug|Win32.ActiveCfg = Debug|Win32
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}.Debug|Win32.Build.0 = Debug|Win32
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}.Release|Win32.ActiveCfg = Release|Win32
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}.Release|Win32.Build.0 = Release|Win32
{39379840-825A-45A0-B363-C09FFEF864BD}.Debug|Win32.ActiveCfg = Debug|Win32
{39379840-825A-45A0-B363-C09FFEF864BD}.Debug|Win32.Build.0 = Debug|Win32
{39379840-825A-45A0-B363-C09FFEF864BD}.Release|Win32.ActiveCfg = Release|Win32
{39379840-825A-45A0-B363-C09FFEF864BD}.Release|Win32.Build.0 = Release|Win32
{21070E58-EEC6-4E16-8B4F-6D083DF55790}.Debug|Win32.ActiveCfg = Debug|Win32
{21070E58-EEC6-4E16-8B4F-6D083DF55790}.Debug|Win32.Build.0 = Debug|Win32
{21070E58-EEC6-4E16-8B4F-6D083DF55790}.Release|Win32.ActiveCfg = Release|Win32
{21070E58-EEC6-4E16-8B4F-6D083DF55790}.Release|Win32.Build.0 = Release|Win32
{632A8F38-D0F0-4D22-86B3-D69F5E6BF63A}.Debug|Win32.ActiveCfg = Debug|Win32
{632A8F38-D0F0-4D22-86B3-D69F5E6BF63A}.Debug|Win32.Build.0 = Debug|Win32
{632A8F38-D0F0-4D22-86B3-D69F5E6BF63A}.Release|Win32.ActiveCfg = Release|Win32
{632A8F38-D0F0-4D22-86B3-D69F5E6BF63A}.Release|Win32.Build.0 = Release|Win32
{68F5F371-BD7B-4C30-AE5B-0B08F22E0CDE}.Debug|Win32.ActiveCfg = Debug|Win32
{68F5F371-BD7B-4C30-AE5B-0B08F22E0CDE}.Debug|Win32.Build.0 = Debug|Win32
{68F5F371-BD7B-4C30-AE5B-0B08F22E0CDE}.Release|Win32.ActiveCfg = Release|Win32
{68F5F371-BD7B-4C30-AE5B-0B08F22E0CDE}.Release|Win32.Build.0 = Release|Win32
{625F7391-9A91-48A1-8CFC-79508C822637}.Debug|Win32.ActiveCfg = Debug|Win32
{625F7391-9A91-48A1-8CFC-79508C822637}.Debug|Win32.Build.0 = Debug|Win32
{625F7391-9A91-48A1-8CFC-79508C822637}.Release|Win32.ActiveCfg = Release|Win32
{625F7391-9A91-48A1-8CFC-79508C822637}.Release|Win32.Build.0 = Release|Win32
{21B2C324-891F-48EA-AD1A-5AE13DE12E28}.Debug|Win32.ActiveCfg = Debug|Win32
{21B2C324-891F-48EA-AD1A-5AE13DE12E28}.Debug|Win32.Build.0 = Debug|Win32
{21B2C324-891F-48EA-AD1A-5AE13DE12E28}.Release|Win32.ActiveCfg = Release|Win32
{21B2C324-891F-48EA-AD1A-5AE13DE12E28}.Release|Win32.Build.0 = Release|Win32
{B57CF53F-2E49-4031-9822-047CC0E6BDE2}.Debug|Win32.ActiveCfg = Debug|Win32
{B57CF53F-2E49-4031-9822-047CC0E6BDE2}.Debug|Win32.Build.0 = Debug|Win32
{B57CF53F-2E49-4031-9822-047CC0E6BDE2}.Release|Win32.ActiveCfg = Release|Win32
{B57CF53F-2E49-4031-9822-047CC0E6BDE2}.Release|Win32.Build.0 = Release|Win32
{811C0DAB-7B96-4BD3-A154-B7572B58E4AB}.Debug|Win32.ActiveCfg = Debug|Win32
{811C0DAB-7B96-4BD3-A154-B7572B58E4AB}.Debug|Win32.Build.0 = Debug|Win32
{811C0DAB-7B96-4BD3-A154-B7572B58E4AB}.Release|Win32.ActiveCfg = Release|Win32
{811C0DAB-7B96-4BD3-A154-B7572B58E4AB}.Release|Win32.Build.0 = Release|Win32
{F9DA0FC1-651B-457B-962E-A4D61CEBF5FD}.Debug|Win32.ActiveCfg = Debug|Win32
{F9DA0FC1-651B-457B-962E-A4D61CEBF5FD}.Debug|Win32.Build.0 = Debug|Win32
{F9DA0FC1-651B-457B-962E-A4D61CEBF5FD}.Release|Win32.ActiveCfg = Release|Win32
{F9DA0FC1-651B-457B-962E-A4D61CEBF5FD}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,238 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{3B0B58B1-2734-488E-A542-ECEC11EB2455}</ProjectGuid>
<RootNamespace>HelloJavascript</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\cocos2d\cocos\2d\cocos2dx.props" />
<Import Project="..\cocos2d\cocos\2d\cocos2d_headers.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\cocos2d\cocos\2d\cocos2dx.props" />
<Import Project="..\cocos2d\cocos\2d\cocos2d_headers.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\..\runtime\HelloJavascript\win32\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration).win32\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\..\runtime\HelloJavascript\win32\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration).win32\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LibraryPath>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LibraryPath>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>false</MkTypLibCompatible>
<TargetEnvironment>Win32</TargetEnvironment>
<GenerateStublessProxies>true</GenerateStublessProxies>
<TypeLibraryName>$(IntDir)game.tlb</TypeLibraryName>
<HeaderFileName>game.h</HeaderFileName>
<DllDataFileName>
</DllDataFileName>
<InterfaceIdentifierFileName>game_i.c</InterfaceIdentifierFileName>
<ProxyFileName>game_p.c</ProxyFileName>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\scripting\javascript\bindings;$(EngineRoot)cocos\scripting\auto-generated\js-bindings;$(EngineRoot)external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;DEBUG;_DEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_DEBUG=1;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<DisableSpecificWarnings>4267;4251;4244;4800;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<PreLinkEvent>
<Command>if not exist "$(OutDir)" mkdir "$(Configuration).win32"
xcopy /Y /Q "$(EngineRoot)external\spidermonkey\prebuilt\win32\*.*" "$(Configuration).win32"
xcopy /Y /Q "$(EngineRoot)external\websockets\prebuilt\win32\*.*" "$(Configuration).win32"
xcopy /Y /Q "$(Configuration).win32\*.dll" "$(OutDir)"</Command>
</PreLinkEvent>
<Link>
<AdditionalDependencies>libcurl_imp.lib;mozjs-27.lib;ws2_32.lib;sqlite3.lib;websockets.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(Configuration).win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<ProgramDatabaseFile>$(Configuration).win32$(TargetName).pdb</ProgramDatabaseFile>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
</Link>
<PreBuildEvent>
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
if exist "$(OutDir)\Resources" rd /s /q "$(OutDir)\Resources"
mkdir "$(OutDir)\Resources"
xcopy "$(EngineRoot)cocos\scripting\javascript\script\*.js" "$(OutDir)\Resources\" /e /Y</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Copy js and resource files.</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Midl>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>false</MkTypLibCompatible>
<TargetEnvironment>Win32</TargetEnvironment>
<GenerateStublessProxies>true</GenerateStublessProxies>
<TypeLibraryName>$(IntDir)game.tlb</TypeLibraryName>
<HeaderFileName>game.h</HeaderFileName>
<DllDataFileName>
</DllDataFileName>
<InterfaceIdentifierFileName>game_i.c</InterfaceIdentifierFileName>
<ProxyFileName>game_p.c</ProxyFileName>
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\scripting\javascript\bindings;$(EngineRoot)cocos\scripting\auto-generated\js-bindings;$(EngineRoot)external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;NDEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>
</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>
</DebugInformationFormat>
<DisableSpecificWarnings>4267;4251;4244;4800;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<PreLinkEvent>
<Command>if not exist "$(OutDir)" mkdir "$(Configuration).win32"
xcopy /Y /Q "$(EngineRoot)external\spidermonkey\prebuilt\win32\*.*" "$(Configuration).win32"
xcopy /Y /Q "$(EngineRoot)external\websockets\prebuilt\win32\*.*" "$(Configuration).win32"</Command>
</PreLinkEvent>
<Link>
<AdditionalDependencies>libcurl_imp.lib;mozjs-27.lib;ws2_32.lib;sqlite3.lib;websockets.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(Configuration).win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(Configuration).win32$(TargetName).pdb</ProgramDatabaseFile>
</Link>
<PreBuildEvent>
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
if exist "$(OutDir)\Resources" rd /s /q "$(OutDir)\Resources"
mkdir "$(OutDir)\Resources"
xcopy "$(EngineRoot)cocos\scripting\javascript\script\*.js" "$(OutDir)\Resources\" /e /Y</Command>
<Message>Copy js and resource files.</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\Classes\Runtime.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="..\Classes\AppDelegate.cpp" />
<ClCompile Include="Runtime_win32.cpp" />
<ClCompile Include="SimulatorWindow.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\Classes\Runtime.h" />
<ClInclude Include="main.h" />
<ClInclude Include="..\Classes\AppDelegate.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="SimulatorWindow.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="game.rc" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\cocos2d\cocos\2d\cocos2d.vcxproj">
<Project>{98a51ba8-fc3a-415b-ac8f-8c7bd464e93e}</Project>
</ProjectReference>
<ProjectReference Include="..\cocos2d\cocos\audio\proj.win32\CocosDenshion.vcxproj">
<Project>{f8edd7fa-9a51-4e80-baeb-860825d2eac6}</Project>
</ProjectReference>
<ProjectReference Include="..\cocos2d\cocos\editor-support\cocosbuilder\proj.win32\libCocosBuilder.vcxproj">
<Project>{811c0dab-7b96-4bd3-a154-b7572b58e4ab}</Project>
</ProjectReference>
<ProjectReference Include="..\cocos2d\cocos\editor-support\cocostudio\proj.win32\libCocosStudio.vcxproj">
<Project>{b57cf53f-2e49-4031-9822-047cc0e6bde2}</Project>
</ProjectReference>
<ProjectReference Include="..\cocos2d\cocos\scripting\javascript\bindings\chipmunk\libJSBindingForChipmunk.vcxproj">
<Project>{21070e58-eec6-4e16-8b4f-6d083df55790}</Project>
</ProjectReference>
<ProjectReference Include="..\cocos2d\cocos\scripting\javascript\bindings\cocosbuilder\libJSBindingForBuilder.vcxproj">
<Project>{f9da0fc1-651b-457b-962e-a4d61cebf5fd}</Project>
</ProjectReference>
<ProjectReference Include="..\cocos2d\cocos\scripting\javascript\bindings\extension\libJSBindingForExtension.vcxproj">
<Project>{625f7391-9a91-48a1-8cfc-79508c822637}</Project>
</ProjectReference>
<ProjectReference Include="..\cocos2d\cocos\scripting\javascript\bindings\localstorage\libJSBindingForLocalStorage.vcxproj">
<Project>{68f5f371-bd7b-4c30-ae5b-0b08f22e0cde}</Project>
</ProjectReference>
<ProjectReference Include="..\cocos2d\cocos\scripting\javascript\bindings\proj.win32\libJSBinding.vcxproj">
<Project>{39379840-825a-45a0-b363-c09ffef864bd}</Project>
</ProjectReference>
<ProjectReference Include="..\cocos2d\cocos\storage\local-storage\proj.win32\libLocalStorage.vcxproj">
<Project>{632a8f38-d0f0-4d22-86b3-d69f5e6bf63a}</Project>
</ProjectReference>
<ProjectReference Include="..\cocos2d\extensions\proj.win32\libExtensions.vcxproj">
<Project>{21b2c324-891f-48ea-ad1a-5ae13de12e28}</Project>
</ProjectReference>
<ProjectReference Include="..\cocos2d\external\chipmunk\proj.win32\chipmunk.vcxproj">
<Project>{207bc7a9-ccf1-4f2f-a04d-45f72242ae25}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Image Include="res\game.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,57 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="resource">
<UniqueIdentifier>{ca9c9e15-d942-43a1-aa7a-5f0b74ca1afd}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;jpg;jpeg;jpe;png;manifest</Extensions>
</Filter>
<Filter Include="win32">
<UniqueIdentifier>{ccb2323b-1cfa-41ea-bcf4-ba5f07309396}</UniqueIdentifier>
</Filter>
<Filter Include="Classes">
<UniqueIdentifier>{e93a77e1-af1e-4400-87d3-504b62ebdbb0}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>win32</Filter>
</ClCompile>
<ClCompile Include="..\Classes\AppDelegate.cpp">
<Filter>Classes</Filter>
</ClCompile>
<ClCompile Include="SimulatorWindow.cpp">
<Filter>win32</Filter>
</ClCompile>
<ClCompile Include="..\Classes\Runtime.cpp">
<Filter>Classes</Filter>
</ClCompile>
<ClCompile Include="Runtime_win32.cpp">
<Filter>win32</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\Classes\AppDelegate.h">
<Filter>Classes</Filter>
</ClInclude>
<ClInclude Include="main.h">
<Filter>win32</Filter>
</ClInclude>
<ClInclude Include="resource.h" />
<ClInclude Include="SimulatorWindow.h">
<Filter>win32</Filter>
</ClInclude>
<ClInclude Include="..\Classes\Runtime.h">
<Filter>Classes</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="game.rc">
<Filter>resource</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="res\game.ico">
<Filter>resource</Filter>
</Image>
</ItemGroup>
</Project>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>

View File

@ -1,119 +0,0 @@
#include "Runtime.h"
#include <io.h>
#include <direct.h>
#include <stdio.h>
#include <vector>
#include <string>
using namespace std;
bool browseDir(const char *dir,const char *filespec,vector<string> &filterArray,vector<string> &fileList)
{
if (chdir(dir) != 0)
{
return false;
}
long hFile;
_finddata_t fileinfo;
if ((hFile=_findfirst(filespec,&fileinfo)) != -1)
{
do
{
if ((fileinfo.attrib & _A_SUBDIR))
{
continue;
}
char *pszexten=strrchr(fileinfo.name,'.');
char szextension[_MAX_PATH_]={0};
if (pszexten)
{
strcpy(szextension,"*");
strcat(szextension,pszexten);
if (find(filterArray.begin(),filterArray.end(),szextension) != filterArray.end())
{
continue;
}
}
strcpy(szextension,fileinfo.name);
if (find(filterArray.begin(),filterArray.end(),szextension) != filterArray.end())
{
continue;
}
char fullFileName[_MAX_PATH_] ={0};
sprintf(fullFileName,"%s%s",dir,fileinfo.name);
fileList.push_back(fullFileName);
} while (_findnext(hFile,&fileinfo) == 0);
_findclose(hFile);
}
if (chdir(dir) != 0)
{
return false;
}
if ((hFile=_findfirst("*.*",&fileinfo)) != -1)
{
do
{
if(!(fileinfo.attrib & _A_SUBDIR))
{
continue;
}
if (strcmp(fileinfo.name,".") == 0 || strcmp(fileinfo.name,"..") == 0)
{
continue;
}
if (find(filterArray.begin(),filterArray.end(),fileinfo.name) != filterArray.end())
{
continue;
}
char subdir[_MAX_PATH_]={0};
sprintf(subdir,"%s%s/",dir,fileinfo.name);
if (!browseDir(subdir,filespec,filterArray,fileList))
{
_findclose(hFile);
return false;
}
} while (_findnext(hFile,&fileinfo) == 0);
_findclose(hFile);
}
return true;
}
string getProjSearchPath()
{
extern std::string getCurAppPath(void);
string searchPath = getCurAppPath();
searchPath += "/../../..";
char fuldir[_MAX_PATH_]={0};
_fullpath(fuldir,searchPath.c_str(),_MAX_PATH_);
return fuldir;
}
vector<string> getSearchPath()
{
extern std::string getCurAppPath(void);
vector<string> searchPathArray;
string searchPathRes = getCurAppPath();
searchPathRes += "/Resources";
searchPathArray.push_back(getProjSearchPath());
searchPathArray.push_back(searchPathRes);
return searchPathArray;
}
string getDotWaitFilePath()
{
extern std::string getCurAppPath(void);
string dotwaitFile = getCurAppPath();
dotwaitFile += "/.wait";
return dotwaitFile;
}

View File

@ -1,246 +0,0 @@
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "SimulatorWindow.h"
#include "cocos2d.h"
#include "glfw3native.h"
#include "resource.h"
#include "Runtime.h"
#include <string>
#include <vector>
using namespace std;
using namespace cocos2d;
WNDPROC g_oldProc=NULL;
bool g_landscape=false;
CCSize g_screenSize;
GLView* g_eglView=NULL;
INT_PTR CALLBACK AboutDialogCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
void createViewMenu()
{
HMENU menu = GetMenu(glfwGetWin32Window(g_eglView->getWindow()));
HMENU viewMenu = GetSubMenu(menu, 1);
for (int i = SimulatorConfig::getInstance()->getScreenSizeCount() - 1; i >= 0; --i)
{
SimulatorScreenSize size = SimulatorConfig::getInstance()->getScreenSize(i);
wstring menuName;
menuName.assign(size.title.begin(), size.title.end());
MENUITEMINFO item;
ZeroMemory(&item, sizeof(item));
item.cbSize = sizeof(item);
item.fMask = MIIM_FTYPE | MIIM_ID | MIIM_STRING;
item.fType = MFT_STRING;
item.wID = ID_VIEW_SIZE + i;
item.dwTypeData = (LPTSTR)menuName.c_str();
item.cch = menuName.length();
InsertMenuItem(viewMenu, 0, TRUE, &item);
}
}
void updateMenu()
{
HMENU menu = GetMenu(glfwGetWin32Window(g_eglView->getWindow()));
HMENU viewMenu = GetSubMenu(menu, 1);
if (g_landscape)
{
CheckMenuItem(viewMenu, ID_VIEW_PORTRAIT, MF_BYCOMMAND | MF_UNCHECKED);
CheckMenuItem(viewMenu, ID_VIEW_LANDSCAPE, MF_BYCOMMAND | MF_CHECKED);
}
else
{
CheckMenuItem(viewMenu, ID_VIEW_PORTRAIT, MF_BYCOMMAND | MF_CHECKED);
CheckMenuItem(viewMenu, ID_VIEW_LANDSCAPE, MF_BYCOMMAND | MF_UNCHECKED);
}
int width = g_screenSize.width;
int height = g_screenSize.height;
if (height > width)
{
int w = width;
width = height;
height = w;
}
int count = SimulatorConfig::getInstance()->getScreenSizeCount();
for (int i = 0; i < count; ++i)
{
bool bSel = false;
SimulatorScreenSize size = SimulatorConfig::getInstance()->getScreenSize(i);
if (size.width == width && size.height == height)
{
bSel = true;
}
CheckMenuItem(viewMenu, i, MF_BYPOSITION | (bSel? MF_CHECKED : MF_UNCHECKED));
}
}
/*@brief updateView*/
void updateView()
{
if (g_landscape)
{
glfwSetWindowSize(g_eglView->getWindow(),g_screenSize.width,g_screenSize.height);
}
else
{
glfwSetWindowSize(g_eglView->getWindow(),g_screenSize.height,g_screenSize.width);
}
updateMenu();
}
void onViewChangeOrientation(int viewMenuID)
{
if (viewMenuID == ID_VIEW_PORTRAIT && g_landscape)
{
g_landscape = false;
updateView();
}
else if (viewMenuID == ID_VIEW_LANDSCAPE && !g_landscape)
{
g_landscape = true;
updateView();
}
}
void onViewChangeFrameSize(int viewMenuID)
{
int index = viewMenuID - ID_VIEW_SIZE;
if (index >= 0 && index < SimulatorConfig::getInstance()->getScreenSizeCount())
{
SimulatorScreenSize size = SimulatorConfig::getInstance()->getScreenSize(index);
g_screenSize.width = size.width;
g_screenSize.height = size.height;
updateView();
}
}
void onHelpAbout()
{
DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOG_ABOUT), glfwGetWin32Window(g_eglView->getWindow()), AboutDialogCallback);
}
/*@brief new windows process*/
LRESULT CALLBACK SNewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
switch (message)
{
case WM_COMMAND:
{
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
switch (wmId)
{
case ID_FILE_EXIT:
exit(0);
break;
case ID_VIEW_PORTRAIT:
case ID_VIEW_LANDSCAPE:
onViewChangeOrientation(wmId);
break;
case ID_CONTROL_RELOAD:
reloadScript();
break;
case ID_HELP_ABOUT:
onHelpAbout();
default:
if (wmId >= ID_VIEW_SIZE && wmId <= ID_VIEW_SIZE + SimulatorConfig::getInstance()->getScreenSizeCount() - 1)
{
onViewChangeFrameSize(wmId);
break;
}
return 0;
}
}
break;
}
return g_oldProc(hWnd, message, wParam, lParam);
}
/*@brief AboutDialog Callback*/
INT_PTR CALLBACK AboutDialogCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
return (INT_PTR)TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
}
break;
}
return (INT_PTR)FALSE;
}
void createSimulator(const char* viewName, float width, float height, float frameZoomFactor)
{
if (g_eglView)
{
return;
}
g_eglView = GLView::createWithRect(viewName,Rect(0,0,width,height),frameZoomFactor);
auto director = Director::getInstance();
director->setOpenGLView(g_eglView);
g_landscape = false;
g_screenSize.width = width;
g_screenSize.height = height;
if (width > height)
{
g_landscape = true;
}
HWND hWnd=glfwGetWin32Window(g_eglView->getWindow());
HMENU hMenu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_MENU_COCOS));
SetMenu(hWnd, hMenu);
createViewMenu();
updateMenu();
g_oldProc = (WNDPROC)SetWindowLong(hWnd, GWL_WNDPROC, (LONG)SNewWndProc);
if (g_oldProc==0)
{
printf("SetWindowLong NewWndProc Error:%d\n",GetLastError());
}
}

View File

@ -1,33 +0,0 @@
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __SIMULATOR_WINDOW_H_
#define __SIMULATOR_WINDOW_H_
/************************
@brief create Simulator
*********************************/
void createSimulator(const char* viewName, float width, float height,float frameZoomFactor = 1.0f);
#endif /* __PROJECT_CONFIG_H_ */

View File

@ -1,213 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Chinese (Simplified, PRC) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
#pragma code_page(936)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_MENU_COCOS MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM SEPARATOR
MENUITEM "E&xit", ID_FILE_EXIT
END
POPUP "&View"
BEGIN
MENUITEM SEPARATOR
MENUITEM "&Portrait", ID_VIEW_PORTRAIT
MENUITEM "&Landscape", ID_VIEW_LANDSCAPE
MENUITEM SEPARATOR
MENUITEM "&Custom", ID_VIEW_CUSTOM
END
POPUP "&Control"
BEGIN
MENUITEM "Reload", ID_CONTROL_RELOAD
END
POPUP "&Help"
BEGIN
MENUITEM "&About ...", ID_HELP_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_DIALOG_ABOUT DIALOGEX 0, 0, 243, 94
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About Simulator"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,173,69,63,18
LTEXT "Cocos2d-x-Simulator",IDC_STATIC,29,17,169,25
END
IDD_DIALOG_VIEWCUSTOM DIALOGEX 0, 0, 179, 98
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Custom"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,47,77,50,14
PUSHBUTTON "Cancel",IDCANCEL,104,77,50,14
LTEXT "Width£º",IDC_STATIC,15,14,30,8
LTEXT "Height£º",IDC_STATIC,15,36,36,12
EDITTEXT IDC_EDIT_WIDTH,60,15,89,14,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_HEIGHT,62,36,87,14,ES_AUTOHSCROLL
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_DIALOG_ABOUT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 236
TOPMARGIN, 7
BOTTOMMARGIN, 87
END
IDD_DIALOG_VIEWCUSTOM, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 172
TOPMARGIN, 7
BOTTOMMARGIN, 91
END
END
#endif // APSTUDIO_INVOKED
#endif // Chinese (Simplified, PRC) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
GLFW_ICON ICON "res\\game.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "FileDescription", "game Module"
VALUE "FileVersion", "1, 0, 0, 1"
VALUE "InternalName", "game"
VALUE "LegalCopyright", "Copyright "
VALUE "OriginalFilename", "game.exe"
VALUE "ProductName", "game Module"
VALUE "ProductVersion", "1, 0, 0, 1"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -1,59 +0,0 @@
#include "main.h"
#include "AppDelegate.h"
#include "SimulatorWindow.h"
USING_NS_CC;
// uncomment below line, open debug console
// #define USE_WIN32_CONSOLE
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
#ifdef USE_WIN32_CONSOLE
AllocConsole();
freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
#endif
// create the application instance
AppDelegate app;
createSimulator("HelloJavascript",960,640);
int ret = Application::getInstance()->run();
#ifdef USE_WIN32_CONSOLE
FreeConsole();
#endif
return ret;
}
std::string getCurAppPath(void)
{
TCHAR szAppDir[MAX_PATH]={0};
if (!GetModuleFileName(NULL,szAppDir,MAX_PATH))
return "";
int nEnd=0;
for (int i=0;szAppDir[i];i++)
{
if(szAppDir[i]=='\\')
nEnd = i;
}
szAppDir[nEnd] = 0;
int iLen = 2*wcslen(szAppDir);
char* chRtn = new char[iLen+1];
wcstombs(chRtn,szAppDir,iLen+1);
std::string strPath = chRtn;
delete [] chRtn;
chRtn=NULL;
char fuldir[MAX_PATH]={0};
_fullpath(fuldir,strPath.c_str(),MAX_PATH);
return fuldir;
}

View File

@ -1,12 +0,0 @@
#ifndef __MAIN_H__
#define __MAIN_H__
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <tchar.h>
// C RunTime Header Files
#include "CCStdC.h"
#endif // __WINMAIN_H__

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

View File

@ -1,36 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by game.rc
//
#define IDS_PROJNAME 100
#define IDR_TESTJS 100
#define IDR_MENU_COCOS 201
#define IDD_DIALOG1 202
#define IDD_DIALOG_ABOUT 202
#define IDD_DIALOG_VIEWCUSTOM 203
#define IDC_EDIT_WIDTH 1000
#define IDC_EDIT2 1001
#define IDC_EDIT_HEIGHT 1001
#define ID_VIEW_SIZE 30001
#define ID_FILE_NEW_WINDOW 32771
#define ID_VIEW_PORTRAIT 32775
#define ID_VIEW_LANDSCAPE 32776
#define ID_VIEW_CUSTOM 32777
#define ID_HELP_ABOUT 32778
#define ID_FILE_EXIT 32779
#define ID_Menu 32780
#define ID_Menu32781 32781
#define ID_TEST_RESET 32782
#define ID_CONTROL 32783
#define ID_CONTROL_RELOAD 32784
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 204
#define _APS_NEXT_COMMAND_VALUE 32785
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -1 +0,0 @@
5fe89fb5bd58cedf13b0363f97b20e3ea7ff255d

View File

@ -1 +0,0 @@
4f7ef04fa911634cbb3007282a66eef5ed548f79

View File

@ -1,74 +0,0 @@
var MyLayer = cc.Layer.extend({
isMouseDown:false,
helloImg:null,
helloLabel:null,
circle:null,
sprite:null,
ctor:function() {
this._super();
cc.associateWithNative( this, cc.Layer );
},
init:function () {
//////////////////////////////
// 1. super init first
this._super();
/////////////////////////////
// 2. add a menu item with "X" image, which is clicked to quit the program
// you may modify it.
// ask director the window size
var size = cc.Director.getInstance().getWinSize();
// add a "close" icon to exit the progress. it's an autorelease object
var closeItem = cc.MenuItemImage.create(
"res/CloseNormal.png",
"res/CloseSelected.png",
function () {
cc.log("close button was clicked.");
},this);
closeItem.setAnchorPoint(cc.p(0.5, 0.5));
var menu = cc.Menu.create(closeItem);
menu.setPosition(cc.p(0, 0));
this.addChild(menu, 1);
closeItem.setPosition(cc.p(size.width - 20, 20));
/////////////////////////////
// 3. add your codes below...
// add a label shows "Hello World"
// create and initialize a label
this.helloLabel = cc.LabelTTF.create("Hello World", "Arial", 38);
// position the label on the center of the screen
this.helloLabel.setPosition(cc.p(size.width / 2, size.height - 40));
// add the label as a child to this layer
this.addChild(this.helloLabel, 5);
// add "Helloworld" splash screen"
this.sprite = cc.Sprite.create("res/HelloWorld.png");
this.sprite.setAnchorPoint(cc.p(0.5, 0.5));
this.sprite.setPosition(cc.p(size.width / 2, size.height / 2));
this.addChild(this.sprite, 0);
return true;
}
});
var MyScene = cc.Scene.extend({
ctor:function() {
this._super();
cc.associateWithNative( this, cc.Scene );
},
onEnter:function () {
this._super();
var layer = new MyLayer();
this.addChild(layer);
layer.init();
}
});

View File

@ -1,20 +0,0 @@
var s_HelloWorld = "res/HelloWorld.png";
var s_CloseNormal = "res/CloseNormal.png";
var s_CloseSelected = "res/CloseSelected.png";
var g_ressources = [
//image
{src:s_HelloWorld},
{src:s_CloseNormal},
{src:s_CloseSelected}
//plist
//fnt
//tmx
//bgm
//effect
];

View File

@ -1,177 +0,0 @@
cmake_minimum_required(VERSION 2.6)
set(APP_NAME HelloJavascript)
project (${APP_NAME})
include(cocos2d/build/BuildHelpers.CMakeLists.txt)
option(USE_CHIPMUNK "Use chipmunk for physics library" ON)
option(USE_BOX2D "Use box2d for physics library" OFF)
option(DEBUG_MODE "Debug or release?" ON)
if(DEBUG_MODE)
set(CMAKE_BUILD_TYPE DEBUG)
else(DEBUG_MODE)
set(CMAKE_BUILD_TYPE RELEASE)
endif(DEBUG_MODE)
set(CMAKE_C_FLAGS_DEBUG "-g -Wall -DCOCOS2D_DEBUG=1")
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-std=c99")
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-std=c++11")
if(USE_CHIPMUNK)
message("Using chipmunk ...")
add_definitions(-DLINUX -DCC_ENABLE_CHIPMUNK_INTEGRATION=1)
elseif(USE_BOX2D)
message("Using box2d ...")
add_definitions(-DLINUX -DCC_ENABLE_BOX2D_INTEGRATION=1)
else(USE_CHIPMUNK)
message(FATAL_ERROR "Must choose a physics library.")
endif(USE_CHIPMUNK)
# architecture
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set(ARCH_DIR "64-bit")
else()
set(ARCH_DIR "32-bit")
endif()
set(GAME_SRC
proj.linux/main.cpp
Classes/AppDelegate.cpp
)
set(COCOS2D_ROOT ${CMAKE_SOURCE_DIR}/cocos2d)
include_directories(
/usr/local/include/GLFW
Classes
${COCOS2D_ROOT}/cocos/scripting/auto-generated/js-bindings
${COCOS2D_ROOT}/cocos/scripting/javascript/bindings
${COCOS2D_ROOT}
${COCOS2D_ROOT}/cocos
${COCOS2D_ROOT}/cocos/audio/include
${COCOS2D_ROOT}/cocos/2d
${COCOS2D_ROOT}/cocos/2d/renderer
${COCOS2D_ROOT}/cocos/2d/platform
${COCOS2D_ROOT}/cocos/2d/platform/desktop
${COCOS2D_ROOT}/cocos/2d/platform/linux
${COCOS2D_ROOT}/cocos/base
${COCOS2D_ROOT}/cocos/physics
${COCOS2D_ROOT}/cocos/editor-support
${COCOS2D_ROOT}/cocos/math/kazmath/include
${COCOS2D_ROOT}/extensions
${COCOS2D_ROOT}/external
${COCOS2D_ROOT}/external/edtaa3func
${COCOS2D_ROOT}/external/jpeg/include/linux
${COCOS2D_ROOT}/external/tiff/include/linux
${COCOS2D_ROOT}/external/webp/include/linux
${COCOS2D_ROOT}/external/tinyxml2
${COCOS2D_ROOT}/external/unzip
${COCOS2D_ROOT}/external/chipmunk/include/chipmunk
${COCOS2D_ROOT}/external/freetype2/include/linux
${COCOS2D_ROOT}/external/websockets/include/linux
${COCOS2D_ROOT}/external/spidermonkey/include/linux
${COCOS2D_ROOT}/external/linux-specific/fmod/include/${ARCH_DIR}
)
link_directories(
/usr/local/lib
${COCOS2D_ROOT}/external/jpeg/prebuilt/linux/${ARCH_DIR}
${COCOS2D_ROOT}/external/tiff/prebuilt/linux/${ARCH_DIR}
${COCOS2D_ROOT}/external/webp/prebuilt/linux/${ARCH_DIR}
${COCOS2D_ROOT}/external/freetype2/prebuilt/linux/${ARCH_DIR}
${COCOS2D_ROOT}/external/websockets/prebuilt/linux/${ARCH_DIR}
${COCOS2D_ROOT}/external/spidermonkey/prebuilt/linux/${ARCH_DIR}
${COCOS2D_ROOT}/external/linux-specific/fmod/prebuilt/${ARCH_DIR}
)
# kazmath
add_subdirectory(${COCOS2D_ROOT}/cocos/math/kazmath)
# chipmunk library
add_subdirectory(${COCOS2D_ROOT}/external/chipmunk/src)
# box2d library
add_subdirectory(${COCOS2D_ROOT}/external/Box2D)
# unzip library
add_subdirectory(${COCOS2D_ROOT}/external/unzip)
# tinyxml2 library
add_subdirectory(${COCOS2D_ROOT}/external/tinyxml2)
# audio
add_subdirectory(${COCOS2D_ROOT}/cocos/audio)
# cocos base library
add_subdirectory(${COCOS2D_ROOT}/cocos/base)
# cocos 2d library
add_subdirectory(${COCOS2D_ROOT}/cocos/2d)
# cocos storage
add_subdirectory(${COCOS2D_ROOT}/cocos/storage)
# gui
add_subdirectory(${COCOS2D_ROOT}/cocos/gui)
# network
add_subdirectory(${COCOS2D_ROOT}/cocos/network)
# extensions
add_subdirectory(${COCOS2D_ROOT}/extensions)
## Editor Support
# spine
add_subdirectory(${COCOS2D_ROOT}/cocos/editor-support/spine)
# cocosbuilder
add_subdirectory(${COCOS2D_ROOT}/cocos/editor-support/cocosbuilder)
# cocostudio
add_subdirectory(${COCOS2D_ROOT}/cocos/editor-support/cocostudio)
## Scripting
# jsbinding
add_subdirectory(${COCOS2D_ROOT}/cocos/scripting/javascript)
# add the executable
add_executable(${APP_NAME}
${GAME_SRC}
)
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set(FMOD_LIB "fmodex64")
else()
set(FMOD_LIB "fmodex")
endif()
target_link_libraries(${APP_NAME}
jsbinding
gui
network
storage
spine
cocostudio
cocosbuilder
extensions
audio
cocos2d
)
set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin")
set_target_properties(${APP_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}")
pre_build(${APP_NAME}
COMMAND ${CMAKE_COMMAND} -E remove_directory ${APP_BIN_DIR}/Resources
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Resources ${APP_BIN_DIR}/Resources
COMMAND ${CMAKE_COMMAND} -E copy_directory ${COCOS2D_ROOT}/cocos/scripting/javascript/script ${APP_BIN_DIR}/Resources
)

View File

@ -1,73 +0,0 @@
#include "AppDelegate.h"
#include "cocos2d.h"
#include "SimpleAudioEngine.h"
#include "ScriptingCore.h"
#include "jsb_cocos2dx_auto.hpp"
#include "jsb_cocos2dx_extension_auto.hpp"
#include "cocos2d_specifics.hpp"
#include "extension/jsb_cocos2dx_extension_manual.h"
#include "chipmunk/js_bindings_chipmunk_registration.h"
#include "jsb_opengl_registration.h"
#include "localstorage/js_bindings_system_registration.h"
USING_NS_CC;
using namespace CocosDenshion;
AppDelegate::AppDelegate()
{
}
AppDelegate::~AppDelegate()
{
ScriptEngineManager::destroyInstance();
}
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLView::create("My Game");
director->setOpenGLView(glview);
}
// turn on display FPS
director->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
director->setAnimationInterval(1.0 / 60);
ScriptingCore* sc = ScriptingCore::getInstance();
sc->addRegisterCallback(register_all_cocos2dx);
sc->addRegisterCallback(register_all_cocos2dx_extension);
sc->addRegisterCallback(register_cocos2dx_js_extensions);
sc->addRegisterCallback(register_all_cocos2dx_extension_manual);
sc->addRegisterCallback(jsb_register_chipmunk);
sc->addRegisterCallback(JSB_register_opengl);
sc->addRegisterCallback(jsb_register_system);
sc->start();
ScriptEngineProtocol *engine = ScriptingCore::getInstance();
ScriptEngineManager::getInstance()->setScriptEngine(engine);
ScriptingCore::getInstance()->runScript("cocos2d-jsb.js");
return true;
}
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
void AppDelegate::applicationDidEnterBackground()
{
Director::getInstance()->stopAnimation();
SimpleAudioEngine::getInstance()->pauseBackgroundMusic();
SimpleAudioEngine::getInstance()->pauseAllEffects();
}
// this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground()
{
Director::getInstance()->startAnimation();
SimpleAudioEngine::getInstance()->resumeBackgroundMusic();
SimpleAudioEngine::getInstance()->resumeAllEffects();
}

View File

@ -1,45 +0,0 @@
//
// GCTestAppDelegate.h
// GCTest
//
// Created by Rohan Kuruvilla on 06/08/2012.
// Copyright __MyCompanyName__ 2012. All rights reserved.
//
#ifndef _APP_DELEGATE_H_
#define _APP_DELEGATE_H_
#include "cocos2d.h"
/**
@brief The cocos2d Application.
The reason for implement as private inheritance is to hide some interface call by Director.
*/
class AppDelegate : private cocos2d::Application
{
public:
AppDelegate();
virtual ~AppDelegate();
/**
@brief Implement Director and Scene init code here.
@return true Initialize success, app continue.
@return false Initialize failed, app terminate.
*/
virtual bool applicationDidFinishLaunching();
/**
@brief The function be called when the application enter background
@param the pointer of the application
*/
virtual void applicationDidEnterBackground();
/**
@brief The function be called when the application enter foreground
@param the pointer of the application
*/
virtual void applicationWillEnterForeground();
};
#endif // _APP_DELEGATE_H_

Some files were not shown because too many files have changed in this diff Show More