mirror of https://github.com/axmolengine/axmol.git
Merge branch 'develop' into js_mac
This commit is contained in:
commit
c22ebb154d
24
.travis.yml
24
.travis.yml
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
language: cpp
|
||||
env:
|
||||
matrix:
|
||||
env:
|
||||
matrix:
|
||||
- GEN_JSB=YES
|
||||
- PLATFORM=linux DEBUG=1
|
||||
# Since switching to C++11 only the ARM version of the nactive client
|
||||
|
@ -10,7 +9,7 @@ env:
|
|||
# - PLATFORM=nacl DEBUG=1 NACL_ARCH=arm
|
||||
- PLATFORM=android
|
||||
- PLATFORM=emscripten DEBUG=1
|
||||
global:
|
||||
global:
|
||||
- secure: |-
|
||||
cHXOjAda+t2tmBVuVAiQfvhDN+unToO6hX1rc3dJeGDOk4rlQnylJacjA7o/
|
||||
enkWeHagbW2Ja4h7BxQz4h7dada8zEbIbEMK4VEHx6AWwQM+GIEqkJPv5g8k
|
||||
|
@ -23,16 +22,7 @@ env:
|
|||
Wsngwo3jlZtvuPfr3RNhqrz/liNIhKYnlw4KYJO90gMQ9ZQKRTlMv2BMiPw/
|
||||
9lV+vgJQDRcFe7dKwtC86vk10EU7Ym2bhVmhMxi/AlmJXgavjmPVdizRT7rh
|
||||
X2Ry/Nb6hGRkH3WS0T3D/KG1+e7lP/TMB9bvo6/locLJ2A6Z1YI=
|
||||
script:
|
||||
- export NACL_SDK_ROOT=$HOME/bin/nacl_sdk/pepper_canary
|
||||
- export PATH=$PATH:$NACL_SDK_ROOT/toolchain/linux_x86_newlib/bin
|
||||
- export PATH=$PATH:$NACL_SDK_ROOT/toolchain/linux_arm_newlib/bin
|
||||
- export NDK_ROOT=$HOME/bin/android-ndk
|
||||
- export PYTHON=/usr/bin/python
|
||||
- export LLVM=$HOME/bin/clang+llvm-3.2/bin
|
||||
- export LLVM_ROOT=$LLVM
|
||||
- ./tools/travis-scripts/run-script.sh
|
||||
|
||||
before_install:
|
||||
- ./tools/travis-scripts/before-install.sh
|
||||
|
||||
script:
|
||||
- tools/travis-scripts/run-script.sh
|
||||
before_install:
|
||||
- tools/travis-scripts/before-install.sh
|
||||
|
|
1
AUTHORS
1
AUTHORS
|
@ -357,6 +357,7 @@ Developers:
|
|||
Logging assert messages to the console.
|
||||
Renaming CCScriptSupport::executeAssert to CCScriptSupport::handleAssert.
|
||||
Adding Native Client support for develop branch (cocos2d-x 3.0) and some warnings fixes.
|
||||
Cleanup travis build scripts.
|
||||
|
||||
Peter Young (young40)
|
||||
Implements setVisible() for CCEditBox
|
||||
|
|
|
@ -36,6 +36,9 @@
|
|||
<Group
|
||||
location = "container:"
|
||||
name = "Cpp">
|
||||
<FileRef
|
||||
location = "group:samples/Cpp/TestCpp/proj.ios/TestCpp.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:samples/Cpp/SimpleGame/proj.ios/SimpleGame.xcodeproj">
|
||||
</FileRef>
|
||||
|
@ -45,14 +48,17 @@
|
|||
<FileRef
|
||||
location = "group:samples/Cpp/HelloCpp/proj.ios/HelloCpp.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:samples/Cpp/TestCpp/proj.ios/TestCpp.xcodeproj">
|
||||
</FileRef>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group
|
||||
location = "container:"
|
||||
name = "libs">
|
||||
<FileRef
|
||||
location = "group:external/Box2D/proj.ios/Box2D.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:external/chipmunk/proj.ios/chipmunk.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:cocos2dx/proj.ios/cocos2dx.xcodeproj">
|
||||
</FileRef>
|
||||
|
@ -62,12 +68,6 @@
|
|||
<FileRef
|
||||
location = "group:extensions/proj.ios/extensions.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:external/Box2D/proj.ios/Box2D.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:external/chipmunk/proj.ios/chipmunk.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:scripting/javascript/bindings/proj.ios/jsbindings.xcodeproj">
|
||||
</FileRef>
|
||||
|
|
|
@ -155,11 +155,13 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH) \
|
|||
|
||||
LOCAL_LDLIBS := -lGLESv2 \
|
||||
-llog \
|
||||
-lz
|
||||
-lz \
|
||||
-landroid
|
||||
|
||||
LOCAL_EXPORT_LDLIBS := -lGLESv2 \
|
||||
-llog \
|
||||
-lz
|
||||
-lz \
|
||||
-landroid
|
||||
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := cocos_libpng_static
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_jpeg_static
|
||||
|
|
|
@ -22,16 +22,37 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#include "CCFileUtilsAndroid.h"
|
||||
#include "support/zip_support/ZipUtils.h"
|
||||
#include "platform/CCCommon.h"
|
||||
#include "jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h"
|
||||
#include "android/asset_manager.h"
|
||||
#include "android/asset_manager_jni.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define LOG_TAG "CCFileUtilsAndroid.cpp"
|
||||
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
|
||||
|
||||
using namespace std;
|
||||
|
||||
NS_CC_BEGIN
|
||||
static AAssetManager* s_assetmanager;
|
||||
|
||||
// record the zip on the resource path
|
||||
static ZipFile *s_pZipFile = NULL;
|
||||
extern "C" {
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_cocos2dx_lib_Cocos2dxHelper_nativeSetAssetManager(JNIEnv* env,
|
||||
jobject thiz,
|
||||
jobject java_assetmanager) {
|
||||
AAssetManager* assetmanager =
|
||||
AAssetManager_fromJava(env, java_assetmanager);
|
||||
if (NULL == assetmanager) {
|
||||
LOGD("assetmanager : is NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
s_assetmanager = assetmanager;
|
||||
}
|
||||
}
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
FileUtils* FileUtils::sharedFileUtils()
|
||||
{
|
||||
|
@ -39,8 +60,6 @@ FileUtils* FileUtils::sharedFileUtils()
|
|||
{
|
||||
s_sharedFileUtils = new FileUtilsAndroid();
|
||||
s_sharedFileUtils->init();
|
||||
std::string resourcePath = getApkPath();
|
||||
s_pZipFile = new ZipFile(resourcePath, "assets/");
|
||||
}
|
||||
return s_sharedFileUtils;
|
||||
}
|
||||
|
@ -51,7 +70,6 @@ FileUtilsAndroid::FileUtilsAndroid()
|
|||
|
||||
FileUtilsAndroid::~FileUtilsAndroid()
|
||||
{
|
||||
CC_SAFE_DELETE(s_pZipFile);
|
||||
}
|
||||
|
||||
bool FileUtilsAndroid::init()
|
||||
|
@ -72,16 +90,26 @@ bool FileUtilsAndroid::isFileExist(const std::string& strFilePath)
|
|||
// Check whether file exists in apk.
|
||||
if (strFilePath[0] != '/')
|
||||
{
|
||||
std::string strPath = strFilePath;
|
||||
if (strPath.find(_defaultResRootPath) != 0)
|
||||
{// Didn't find "assets/" at the beginning of the path, adding it.
|
||||
strPath.insert(0, _defaultResRootPath);
|
||||
const char* s = strFilePath.c_str();
|
||||
|
||||
if (strFilePath.find(_defaultResRootPath) != 0)
|
||||
{
|
||||
// Didn't find "assets/" at the beginning of the path
|
||||
} else {
|
||||
// Found "assets/" at the beginning of the path and we don't want it
|
||||
s += strlen("assets/");
|
||||
}
|
||||
|
||||
if (s_pZipFile->fileExists(strPath))
|
||||
{
|
||||
bFound = true;
|
||||
}
|
||||
if (s_assetmanager) {
|
||||
AAsset* aa = AAssetManager_open(s_assetmanager, s, AASSET_MODE_UNKNOWN);
|
||||
if (aa)
|
||||
{
|
||||
bFound = true;
|
||||
AAsset_close(aa);
|
||||
} else {
|
||||
// CCLOG("[AssetManager] ... in APK %s, found = false!", strFilePath.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -134,12 +162,42 @@ unsigned char* FileUtilsAndroid::doGetFileData(const char* pszFileName, const ch
|
|||
{
|
||||
if (forAsync)
|
||||
{
|
||||
pData = s_pZipFile->getFileData(fullPath.c_str(), pSize, s_pZipFile->_dataThread);
|
||||
// Nothing to do when using the Android assetmanager APIs???
|
||||
}
|
||||
else
|
||||
|
||||
string fullPath = fullPathForFilename(pszFileName);
|
||||
|
||||
const char* relativepath = fullPath.c_str();
|
||||
|
||||
// "assets/" is at the beginning of the path and we don't want it
|
||||
relativepath += strlen("assets/");
|
||||
|
||||
if (NULL == s_assetmanager) {
|
||||
LOGD("... s_assetmanager is NULL");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// read asset data
|
||||
AAsset* asset =
|
||||
AAssetManager_open(s_assetmanager,
|
||||
relativepath,
|
||||
AASSET_MODE_UNKNOWN);
|
||||
if (NULL == asset) {
|
||||
LOGD("asset : is NULL");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
off_t size = AAsset_getLength(asset);
|
||||
|
||||
pData = new unsigned char[size];
|
||||
|
||||
int bytesread = AAsset_read(asset, (void*)pData, size);
|
||||
if (pSize)
|
||||
{
|
||||
pData = s_pZipFile->getFileData(fullPath.c_str(), pSize);
|
||||
*pSize = bytesread;
|
||||
}
|
||||
|
||||
AAsset_close(asset);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -30,6 +30,12 @@
|
|||
#include "ccTypeInfo.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "jni.h"
|
||||
#include "android/asset_manager.h"
|
||||
|
||||
extern "C" {
|
||||
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxHelper_nativeSetAssetManager(JNIEnv* env, jobject thiz, jobject java_assetmanager);
|
||||
}
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
@ -68,4 +74,3 @@ private:
|
|||
NS_CC_END
|
||||
|
||||
#endif // __CC_FILEUTILS_ANDROID_H__
|
||||
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<uses-sdk android:minSdkVersion="8"/>
|
||||
<uses-sdk android:minSdkVersion="9"/>
|
||||
|
||||
</manifest>
|
||||
|
|
|
@ -12,4 +12,4 @@
|
|||
|
||||
android.library=true
|
||||
# Project target.
|
||||
target=android-8
|
||||
target=android-10
|
||||
|
|
|
@ -74,6 +74,8 @@ public class Cocos2dxHelper {
|
|||
Cocos2dxHelper.sCocos2dMusic = new Cocos2dxMusic(pContext);
|
||||
Cocos2dxHelper.sCocos2dSound = new Cocos2dxSound(pContext);
|
||||
Cocos2dxHelper.sAssetManager = pContext.getAssets();
|
||||
|
||||
Cocos2dxHelper.nativeSetAssetManager(sAssetManager);
|
||||
Cocos2dxBitmap.setContext(pContext);
|
||||
Cocos2dxETCLoader.setContext(pContext);
|
||||
}
|
||||
|
@ -94,6 +96,8 @@ public class Cocos2dxHelper {
|
|||
|
||||
private static native void nativeSetEditTextDialogResult(final byte[] pBytes);
|
||||
|
||||
private static native void nativeSetAssetManager(AssetManager a);
|
||||
|
||||
public static String getCocos2dxPackageName() {
|
||||
return Cocos2dxHelper.sPackageName;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include "WebSocket.h"
|
||||
#include <pthread.h>
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
|
@ -71,15 +72,14 @@ public:
|
|||
|
||||
|
||||
protected:
|
||||
friend class WsThreadEntry;
|
||||
void* wsThreadEntryFunc(void* arg);
|
||||
void wsThreadEntryFunc();
|
||||
|
||||
private:
|
||||
std::list<WsMessage*>* _UIWsMessageQueue;
|
||||
std::list<WsMessage*>* _subThreadWsMessageQueue;
|
||||
pthread_mutex_t _UIWsMessageQueueMutex;
|
||||
pthread_mutex_t _subThreadWsMessageQueueMutex;
|
||||
pthread_t _subThreadInstance;
|
||||
std::mutex _UIWsMessageQueueMutex;
|
||||
std::mutex _subThreadWsMessageQueueMutex;
|
||||
std::thread* _subThreadInstance;
|
||||
WebSocket* _ws;
|
||||
bool _needQuit;
|
||||
friend class WebSocket;
|
||||
|
@ -106,13 +106,12 @@ public:
|
|||
|
||||
// Implementation of WsThreadHelper
|
||||
WsThreadHelper::WsThreadHelper()
|
||||
: _ws(NULL)
|
||||
: _subThreadInstance(nullptr)
|
||||
, _ws(NULL)
|
||||
, _needQuit(false)
|
||||
{
|
||||
_UIWsMessageQueue = new std::list<WsMessage*>();
|
||||
pthread_mutex_init(&_UIWsMessageQueueMutex, NULL);
|
||||
_subThreadWsMessageQueue = new std::list<WsMessage*>();
|
||||
pthread_mutex_init(&_subThreadWsMessageQueueMutex, NULL);
|
||||
|
||||
Director::sharedDirector()->getScheduler()->scheduleUpdateForTarget(this, 0, false);
|
||||
}
|
||||
|
@ -120,36 +119,19 @@ WsThreadHelper::WsThreadHelper()
|
|||
WsThreadHelper::~WsThreadHelper()
|
||||
{
|
||||
Director::sharedDirector()->getScheduler()->unscheduleAllForTarget(this);
|
||||
pthread_mutex_destroy(&_UIWsMessageQueueMutex);
|
||||
pthread_mutex_destroy(&_subThreadWsMessageQueueMutex);
|
||||
CC_SAFE_DELETE(_subThreadInstance);
|
||||
delete _UIWsMessageQueue;
|
||||
delete _subThreadWsMessageQueue;
|
||||
}
|
||||
|
||||
// For converting static function to member function
|
||||
class WsThreadEntry
|
||||
{
|
||||
public:
|
||||
static void* entry(void* arg)
|
||||
{
|
||||
WsThreadHelper* self = static_cast<WsThreadHelper*>(arg);
|
||||
return self->wsThreadEntryFunc(arg);
|
||||
}
|
||||
};
|
||||
|
||||
bool WsThreadHelper::createThread(const WebSocket& ws)
|
||||
{
|
||||
_ws = const_cast<WebSocket*>(&ws);
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init (&attr);
|
||||
// pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
|
||||
|
||||
// Creates websocket thread
|
||||
if (0 == pthread_create(&_subThreadInstance, &attr, WsThreadEntry::entry, this))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
_subThreadInstance = new std::thread(&WsThreadHelper::wsThreadEntryFunc, this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WsThreadHelper::quitSubThread()
|
||||
|
@ -157,7 +139,7 @@ void WsThreadHelper::quitSubThread()
|
|||
_needQuit = true;
|
||||
}
|
||||
|
||||
void* WsThreadHelper::wsThreadEntryFunc(void* arg)
|
||||
void WsThreadHelper::wsThreadEntryFunc()
|
||||
{
|
||||
_ws->onSubThreadStarted();
|
||||
|
||||
|
@ -170,28 +152,28 @@ void* WsThreadHelper::wsThreadEntryFunc(void* arg)
|
|||
}
|
||||
|
||||
_ws->onSubThreadEnded();
|
||||
|
||||
return (void*)0;
|
||||
}
|
||||
|
||||
void WsThreadHelper::sendMessageToUIThread(WsMessage *msg)
|
||||
{
|
||||
pthread_mutex_lock(&_UIWsMessageQueueMutex);
|
||||
_UIWsMessageQueueMutex.lock();
|
||||
_UIWsMessageQueue->push_back(msg);
|
||||
pthread_mutex_unlock(&_UIWsMessageQueueMutex);
|
||||
_UIWsMessageQueueMutex.unlock();
|
||||
}
|
||||
|
||||
void WsThreadHelper::sendMessageToSubThread(WsMessage *msg)
|
||||
{
|
||||
pthread_mutex_lock(&_subThreadWsMessageQueueMutex);
|
||||
_subThreadWsMessageQueueMutex.lock();
|
||||
_subThreadWsMessageQueue->push_back(msg);
|
||||
pthread_mutex_unlock(&_subThreadWsMessageQueueMutex);
|
||||
_subThreadWsMessageQueueMutex.unlock();
|
||||
}
|
||||
|
||||
void WsThreadHelper::joinSubThread()
|
||||
{
|
||||
void* ret = NULL;
|
||||
pthread_join(_subThreadInstance, &ret);
|
||||
if (_subThreadInstance->joinable())
|
||||
{
|
||||
_subThreadInstance->join();
|
||||
}
|
||||
}
|
||||
|
||||
void WsThreadHelper::update(float dt)
|
||||
|
@ -199,17 +181,17 @@ void WsThreadHelper::update(float dt)
|
|||
WsMessage *msg = NULL;
|
||||
|
||||
// Returns quickly if no message
|
||||
pthread_mutex_lock(&_UIWsMessageQueueMutex);
|
||||
_UIWsMessageQueueMutex.lock();
|
||||
if (0 == _UIWsMessageQueue->size())
|
||||
{
|
||||
pthread_mutex_unlock(&_UIWsMessageQueueMutex);
|
||||
_UIWsMessageQueueMutex.unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
// Gets message
|
||||
msg = *(_UIWsMessageQueue->begin());
|
||||
_UIWsMessageQueue->pop_front();
|
||||
pthread_mutex_unlock(&_UIWsMessageQueueMutex);
|
||||
_UIWsMessageQueueMutex.unlock();
|
||||
|
||||
if (_ws)
|
||||
{
|
||||
|
@ -378,8 +360,10 @@ void WebSocket::close()
|
|||
Director::sharedDirector()->getScheduler()->unscheduleAllForTarget(_wsHelper);
|
||||
|
||||
if (_readyState == kStateClosing || _readyState == kStateClosed)
|
||||
{
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
CCLOG("websocket (%p) connection closed by client", this);
|
||||
_readyState = kStateClosed;
|
||||
|
||||
|
@ -517,7 +501,7 @@ int WebSocket::onSocketCallback(struct libwebsocket_context *ctx,
|
|||
|
||||
case LWS_CALLBACK_CLIENT_WRITEABLE:
|
||||
{
|
||||
pthread_mutex_lock(&_wsHelper->_subThreadWsMessageQueueMutex);
|
||||
_wsHelper->_subThreadWsMessageQueueMutex.lock();
|
||||
std::list<WsMessage*>::iterator iter = _wsHelper->_subThreadWsMessageQueue->begin();
|
||||
|
||||
int bytesWrite = 0;
|
||||
|
@ -566,7 +550,7 @@ int WebSocket::onSocketCallback(struct libwebsocket_context *ctx,
|
|||
|
||||
_wsHelper->_subThreadWsMessageQueue->clear();
|
||||
|
||||
pthread_mutex_unlock(&_wsHelper->_subThreadWsMessageQueueMutex);
|
||||
_wsHelper->_subThreadWsMessageQueueMutex.unlock();
|
||||
|
||||
/* get notified as soon as we can write again */
|
||||
|
||||
|
|
|
@ -145,9 +145,9 @@ bool UpdateLayer::init()
|
|||
|
||||
Size size = Director::sharedDirector()->getWinSize();
|
||||
|
||||
pItemReset = MenuItemFont::create("reset", this, menu_selector(UpdateLayer::reset));
|
||||
pItemEnter = MenuItemFont::create("enter", this, menu_selector(UpdateLayer::enter));
|
||||
pItemUpdate = MenuItemFont::create("update", this, menu_selector(UpdateLayer::update));
|
||||
pItemReset = MenuItemFont::create("reset", CC_CALLBACK_1(UpdateLayer::reset,this));
|
||||
pItemEnter = MenuItemFont::create("enter", CC_CALLBACK_1(UpdateLayer::enter, this));
|
||||
pItemUpdate = MenuItemFont::create("update", CC_CALLBACK_1(UpdateLayer::update, this));
|
||||
|
||||
pItemEnter->setPosition(ccp(size.width/2, size.height/2 + 50));
|
||||
pItemReset->setPosition(ccp(size.width/2, size.height/2));
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<uses-sdk android:minSdkVersion="8"/>
|
||||
<uses-sdk android:minSdkVersion="9"/>
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
|
||||
<application android:label="@string/app_name"
|
||||
|
|
|
@ -11,5 +11,5 @@
|
|||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-8
|
||||
target=android-10
|
||||
android.library.reference.1=../../../../cocos2dx/platform/android/java
|
||||
|
|
|
@ -53,11 +53,11 @@
|
|||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
1A6B0595177828E700FFE52B /* libchipmunk.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libchipmunk.a; path = "../../../../external/chipmunk/proj.ios/build/Release-iphoneos/libchipmunk.a"; sourceTree = "<group>"; };
|
||||
1A6B0596177828E700FFE52B /* libcocos2dx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcocos2dx.a; path = "../../../../cocos2dx/proj.ios/build/Release-iphoneos/libcocos2dx.a"; sourceTree = "<group>"; };
|
||||
1A6B0597177828E700FFE52B /* libCocosDenshion.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libCocosDenshion.a; path = "../../../../CocosDenshion/proj.ios/build/Release-iphoneos/libCocosDenshion.a"; sourceTree = "<group>"; };
|
||||
1A6B0598177828E700FFE52B /* libextensions.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libextensions.a; path = "../../../../extensions/proj.ios/build/Release-iphoneos/libextensions.a"; sourceTree = "<group>"; };
|
||||
1A6B0599177828E700FFE52B /* libjsbindings.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libjsbindings.a; path = "../../../../scripting/javascript/bindings/proj.ios/build/Release-iphoneos/libjsbindings.a"; sourceTree = "<group>"; };
|
||||
1A6B0595177828E700FFE52B /* libchipmunk.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libchipmunk.a; path = "libchipmunk.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6B0596177828E700FFE52B /* libcocos2dx.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libcocos2dx.a; path = "libcocos2dx.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6B0597177828E700FFE52B /* libCocosDenshion.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libCocosDenshion.a; path = "libCocosDenshion.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6B0598177828E700FFE52B /* libextensions.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libextensions.a; path = "libextensions.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6B0599177828E700FFE52B /* libjsbindings.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libjsbindings.a; path = "libjsbindings.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6B05A01778291500FFE52B /* jsb.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb.js; sourceTree = "<group>"; };
|
||||
1A6B05A11778291500FFE52B /* jsb_chipmunk.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb_chipmunk.js; sourceTree = "<group>"; };
|
||||
1A6B05A21778291500FFE52B /* jsb_chipmunk_constants.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb_chipmunk_constants.js; sourceTree = "<group>"; };
|
||||
|
|
|
@ -39,8 +39,7 @@ bool HelloWorld::init()
|
|||
MenuItemImage *pCloseItem = MenuItemImage::create(
|
||||
"CloseNormal.png",
|
||||
"CloseSelected.png",
|
||||
this,
|
||||
menu_selector(HelloWorld::menuCloseCallback));
|
||||
CC_CALLBACK_1(HelloWorld::menuCloseCallback,this));
|
||||
|
||||
pCloseItem->setPosition(ccp(origin.x + visibleSize.width - pCloseItem->getContentSize().width/2 ,
|
||||
origin.y + pCloseItem->getContentSize().height/2));
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<uses-sdk android:minSdkVersion="8"/>
|
||||
<uses-sdk android:minSdkVersion="9"/>
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
|
||||
<application android:label="@string/app_name"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-8
|
||||
target=android-10
|
||||
|
||||
android.library.reference.1=../../../../cocos2dx/platform/android/java
|
||||
android.library=false
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
/* Begin PBXFileReference section */
|
||||
15003FA215D2601D00B6775A /* iphone */ = {isa = PBXFileReference; lastKnownFileType = folder; path = iphone; sourceTree = "<group>"; };
|
||||
1A0C0A6A1777F65600838530 /* libcocos2dx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcocos2dx.a; path = "../../../../cocos2dx/proj.ios/build/Release-iphoneos/libcocos2dx.a"; sourceTree = "<group>"; };
|
||||
1A0C0A6A1777F65600838530 /* libcocos2dx.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libcocos2dx.a; path = "libcocos2dx.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A1CF3661626CB6000AFC938 /* AppMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppMacros.h; sourceTree = "<group>"; };
|
||||
1A1CF3671626CEFF00AFC938 /* ipad */ = {isa = PBXFileReference; lastKnownFileType = folder; path = ipad; sourceTree = "<group>"; };
|
||||
1A1CF3681626CEFF00AFC938 /* ipadhd */ = {isa = PBXFileReference; lastKnownFileType = folder; path = ipadhd; sourceTree = "<group>"; };
|
||||
|
|
|
@ -72,8 +72,7 @@ bool HelloWorld::init()
|
|||
MenuItemImage *pCloseItem = MenuItemImage::create(
|
||||
"CloseNormal.png",
|
||||
"CloseSelected.png",
|
||||
this,
|
||||
menu_selector(HelloWorld::menuCloseCallback));
|
||||
CC_CALLBACK_1(HelloWorld::menuCloseCallback,this));
|
||||
CC_BREAK_IF(! pCloseItem);
|
||||
|
||||
// Place the menu item bottom-right conner.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<uses-sdk android:minSdkVersion="8"/>
|
||||
<uses-sdk android:minSdkVersion="9"/>
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
|
||||
<application android:label="@string/app_name"
|
||||
|
|
|
@ -11,5 +11,5 @@
|
|||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-8
|
||||
target=android-10
|
||||
android.library.reference.1=../../../../cocos2dx/platform/android/java
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
1A6E475D177819520055514D /* libcocos2dx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcocos2dx.a; path = "../../../../cocos2dx/proj.ios/build/Release-iphoneos/libcocos2dx.a"; sourceTree = "<group>"; };
|
||||
1A6E475E177819520055514D /* libCocosDenshion.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libCocosDenshion.a; path = "../../../../CocosDenshion/proj.ios/build/Release-iphoneos/libCocosDenshion.a"; sourceTree = "<group>"; };
|
||||
1A6E475D177819520055514D /* libcocos2dx.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libcocos2dx.a; path = "libcocos2dx.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E475E177819520055514D /* libCocosDenshion.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libCocosDenshion.a; path = "libCocosDenshion.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
1D6058910D05DD3D006BFB54 /* SimpleGame.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SimpleGame.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include "cocos2d.h"
|
||||
#include "cocos-ext.h"
|
||||
#include "WebSocket.h"
|
||||
#include "network/WebSocket.h"
|
||||
|
||||
class WebSocketTestLayer
|
||||
: public cocos2d::Layer
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<uses-sdk android:minSdkVersion="8"/>
|
||||
<uses-sdk android:minSdkVersion="9"/>
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
|
||||
<application android:label="@string/app_name"
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-8
|
||||
target=android-10
|
||||
|
||||
android.library.reference.1=../../../../cocos2dx/platform/android/java
|
||||
|
|
|
@ -1 +1 @@
|
|||
0ac4a6e24af867140f59a7a7429c214049731e60
|
||||
e4ca00d0a77436dcf2dc220c386d6cd0a2689450
|
|
@ -4,7 +4,7 @@
|
|||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<uses-sdk android:minSdkVersion="8"/>
|
||||
<uses-sdk android:minSdkVersion="9"/>
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
|
||||
<application android:label="@string/app_name"
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-8
|
||||
target=android-10
|
||||
|
||||
android.library.reference.1=../../../../cocos2dx/platform/android/java
|
||||
|
|
|
@ -53,11 +53,11 @@
|
|||
159004B3166DE19C006BF838 /* Icon-114.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-114.png"; sourceTree = "<group>"; };
|
||||
159004B5166DE1A8006BF838 /* Icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-72.png"; sourceTree = "<group>"; };
|
||||
159004B7166DE1AF006BF838 /* Icon-144.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-144.png"; sourceTree = "<group>"; };
|
||||
1A6E4698177813130055514D /* libchipmunk.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libchipmunk.a; path = "../../../../external/chipmunk/proj.ios/build/Release-iphoneos/libchipmunk.a"; sourceTree = "<group>"; };
|
||||
1A6E4699177813130055514D /* libcocos2dx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcocos2dx.a; path = "../../../../cocos2dx/proj.ios/build/Release-iphoneos/libcocos2dx.a"; sourceTree = "<group>"; };
|
||||
1A6E469A177813130055514D /* libCocosDenshion.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libCocosDenshion.a; path = "../../../../CocosDenshion/proj.ios/build/Release-iphoneos/libCocosDenshion.a"; sourceTree = "<group>"; };
|
||||
1A6E469B177813130055514D /* libextensions.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libextensions.a; path = "../../../../extensions/proj.ios/build/Release-iphoneos/libextensions.a"; sourceTree = "<group>"; };
|
||||
1A6E469C177813130055514D /* libjsbindings.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libjsbindings.a; path = "../../../../scripting/javascript/bindings/proj.ios/build/Release-iphoneos/libjsbindings.a"; sourceTree = "<group>"; };
|
||||
1A6E4698177813130055514D /* libchipmunk.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libchipmunk.a; path = "libchipmunk.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E4699177813130055514D /* libcocos2dx.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libcocos2dx.a; path = "libcocos2dx.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E469A177813130055514D /* libCocosDenshion.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libCocosDenshion.a; path = "libCocosDenshion.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E469B177813130055514D /* libextensions.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libextensions.a; path = "libextensions.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E469C177813130055514D /* libjsbindings.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libjsbindings.a; path = "libjsbindings.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E46A41778147D0055514D /* jsb.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb.js; sourceTree = "<group>"; };
|
||||
1A6E46A51778147D0055514D /* jsb_chipmunk.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb_chipmunk.js; sourceTree = "<group>"; };
|
||||
1A6E46A61778147D0055514D /* jsb_chipmunk_constants.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb_chipmunk_constants.js; sourceTree = "<group>"; };
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<uses-sdk android:minSdkVersion="8"/>
|
||||
<uses-sdk android:minSdkVersion="9"/>
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
|
||||
<application android:label="@string/app_name"
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-8
|
||||
target=android-10
|
||||
|
||||
android.library.reference.1=../../../../cocos2dx/platform/android/java
|
||||
|
|
|
@ -54,11 +54,11 @@
|
|||
159004B5166DE1A8006BF838 /* Icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-72.png"; sourceTree = "<group>"; };
|
||||
159004B7166DE1AF006BF838 /* Icon-144.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-144.png"; sourceTree = "<group>"; };
|
||||
1A21ED5116B02EE100A2E30E /* Published-iOS */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "Published-iOS"; path = "../../Shared/games/CrystalCraze/Published-iOS"; sourceTree = "<group>"; };
|
||||
1A6E46CB177815E00055514D /* libchipmunk.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libchipmunk.a; path = "../../../../external/chipmunk/proj.ios/build/Release-iphoneos/libchipmunk.a"; sourceTree = "<group>"; };
|
||||
1A6E46CC177815E00055514D /* libcocos2dx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcocos2dx.a; path = "../../../../cocos2dx/proj.ios/build/Release-iphoneos/libcocos2dx.a"; sourceTree = "<group>"; };
|
||||
1A6E46CD177815E00055514D /* libCocosDenshion.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libCocosDenshion.a; path = "../../../../CocosDenshion/proj.ios/build/Release-iphoneos/libCocosDenshion.a"; sourceTree = "<group>"; };
|
||||
1A6E46CE177815E00055514D /* libextensions.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libextensions.a; path = "../../../../extensions/proj.ios/build/Release-iphoneos/libextensions.a"; sourceTree = "<group>"; };
|
||||
1A6E46CF177815E00055514D /* libjsbindings.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libjsbindings.a; path = "../../../../scripting/javascript/bindings/proj.ios/build/Release-iphoneos/libjsbindings.a"; sourceTree = "<group>"; };
|
||||
1A6E46CB177815E00055514D /* libchipmunk.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libchipmunk.a; path = "libchipmunk.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E46CC177815E00055514D /* libcocos2dx.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libcocos2dx.a; path = "libcocos2dx.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E46CD177815E00055514D /* libCocosDenshion.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libCocosDenshion.a; path = "libCocosDenshion.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E46CE177815E00055514D /* libextensions.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libextensions.a; path = "libextensions.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E46CF177815E00055514D /* libjsbindings.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libjsbindings.a; path = "libjsbindings.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E46D7177816450055514D /* jsb.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb.js; sourceTree = "<group>"; };
|
||||
1A6E46D8177816450055514D /* jsb_chipmunk.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb_chipmunk.js; sourceTree = "<group>"; };
|
||||
1A6E46D9177816450055514D /* jsb_chipmunk_constants.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb_chipmunk_constants.js; sourceTree = "<group>"; };
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<uses-sdk android:minSdkVersion="8"/>
|
||||
<uses-sdk android:minSdkVersion="9"/>
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
|
||||
<application android:label="@string/app_name"
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-8
|
||||
target=android-10
|
||||
|
||||
android.library.reference.1=../../../../cocos2dx/platform/android/java
|
||||
|
|
|
@ -87,11 +87,11 @@
|
|||
15A3D2D51682EEC8002FB0C5 /* src */ = {isa = PBXFileReference; lastKnownFileType = folder; name = src; path = ../../Shared/games/MoonWarriors/src; sourceTree = "<group>"; };
|
||||
15A3D2D81682EEEA002FB0C5 /* main.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = main.js; path = ../../Shared/games/MoonWarriors/main.js; sourceTree = "<group>"; };
|
||||
15A3D2D91682EEEA002FB0C5 /* MoonWarriors-jsb.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = "MoonWarriors-jsb.js"; path = "../../Shared/games/MoonWarriors/MoonWarriors-jsb.js"; sourceTree = "<group>"; };
|
||||
1A6E46FC177818140055514D /* libchipmunk.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libchipmunk.a; path = "../../../../external/chipmunk/proj.ios/build/Release-iphoneos/libchipmunk.a"; sourceTree = "<group>"; };
|
||||
1A6E46FD177818140055514D /* libcocos2dx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcocos2dx.a; path = "../../../../cocos2dx/proj.ios/build/Release-iphoneos/libcocos2dx.a"; sourceTree = "<group>"; };
|
||||
1A6E46FE177818140055514D /* libCocosDenshion.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libCocosDenshion.a; path = "../../../../CocosDenshion/proj.ios/build/Release-iphoneos/libCocosDenshion.a"; sourceTree = "<group>"; };
|
||||
1A6E46FF177818140055514D /* libextensions.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libextensions.a; path = "../../../../extensions/proj.ios/build/Release-iphoneos/libextensions.a"; sourceTree = "<group>"; };
|
||||
1A6E4700177818150055514D /* libjsbindings.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libjsbindings.a; path = "../../../../scripting/javascript/bindings/proj.ios/build/Release-iphoneos/libjsbindings.a"; sourceTree = "<group>"; };
|
||||
1A6E46FC177818140055514D /* libchipmunk.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libchipmunk.a; path = "libchipmunk.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E46FD177818140055514D /* libcocos2dx.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libcocos2dx.a; path = "libcocos2dx.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E46FE177818140055514D /* libCocosDenshion.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libCocosDenshion.a; path = "libCocosDenshion.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E46FF177818140055514D /* libextensions.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libextensions.a; path = "libextensions.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E4700177818150055514D /* libjsbindings.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libjsbindings.a; path = "libjsbindings.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E4707177818390055514D /* jsb.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb.js; sourceTree = "<group>"; };
|
||||
1A6E4708177818390055514D /* jsb_chipmunk.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb_chipmunk.js; sourceTree = "<group>"; };
|
||||
1A6E4709177818390055514D /* jsb_chipmunk_constants.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb_chipmunk_constants.js; sourceTree = "<group>"; };
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<uses-sdk android:minSdkVersion="8"/>
|
||||
<uses-sdk android:minSdkVersion="9"/>
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
<uses-feature />
|
||||
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-8
|
||||
target=android-10
|
||||
|
||||
android.library.reference.1=../../../../cocos2dx/platform/android/java
|
||||
|
|
|
@ -117,11 +117,11 @@
|
|||
15A3D4621682F14C002FB0C5 /* main.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = main.js; path = ../../Shared/tests/main.js; sourceTree = "<group>"; };
|
||||
15A3D4711682F14C002FB0C5 /* tests_resources-jsb.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = "tests_resources-jsb.js"; path = "../../Shared/tests/tests_resources-jsb.js"; sourceTree = "<group>"; };
|
||||
15A3D4741682F14C002FB0C5 /* tests-main.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = "tests-main.js"; path = "../../Shared/tests/tests-main.js"; sourceTree = "<group>"; };
|
||||
1A4C3F0E17784B6000EDFB3B /* libchipmunk.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libchipmunk.a; path = "../../../../../../Library/Developer/Xcode/DerivedData/cocos2d-ios-etxtvifusbwprqeuljuprhxuzxti/Build/Products/Debug-iphoneos/libchipmunk.a"; sourceTree = "<group>"; };
|
||||
1A4C3F0F17784B6000EDFB3B /* libcocos2dx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcocos2dx.a; path = "../../../../../../Library/Developer/Xcode/DerivedData/cocos2d-ios-etxtvifusbwprqeuljuprhxuzxti/Build/Products/Debug-iphoneos/libcocos2dx.a"; sourceTree = "<group>"; };
|
||||
1A4C3F1017784B6000EDFB3B /* libCocosDenshion.a */ = {isa = PBXFileReference; lastKnownFileType = file; name = libCocosDenshion.a; path = "../../../../CocosDenshion/proj.ios/build/Release-iphoneos/libCocosDenshion.a"; sourceTree = "<group>"; };
|
||||
1A4C3F1117784B6000EDFB3B /* libextensions.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libextensions.a; path = "../../../../../../Library/Developer/Xcode/DerivedData/cocos2d-ios-etxtvifusbwprqeuljuprhxuzxti/Build/Products/Debug-iphoneos/libextensions.a"; sourceTree = "<group>"; };
|
||||
1A4C3F1217784B6000EDFB3B /* libjsbindings.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libjsbindings.a; path = "../../../../../../Library/Developer/Xcode/DerivedData/cocos2d-ios-etxtvifusbwprqeuljuprhxuzxti/Build/Products/Debug-iphoneos/libjsbindings.a"; sourceTree = "<group>"; };
|
||||
1A4C3F0E17784B6000EDFB3B /* libchipmunk.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libchipmunk.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A4C3F0F17784B6000EDFB3B /* libcocos2dx.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libcocos2dx.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A4C3F1017784B6000EDFB3B /* libCocosDenshion.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libCocosDenshion.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A4C3F1117784B6000EDFB3B /* libextensions.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libextensions.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A4C3F1217784B6000EDFB3B /* libjsbindings.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libjsbindings.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6B05C417782A2400FFE52B /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = usr/lib/libsqlite3.dylib; sourceTree = SDKROOT; };
|
||||
1A6B05C617782B0500FFE52B /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
|
||||
1A6E4672177812AF0055514D /* jsb.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb.js; sourceTree = "<group>"; };
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<uses-sdk android:minSdkVersion="8"/>
|
||||
<uses-sdk android:minSdkVersion="9"/>
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
|
||||
<application android:label="@string/app_name"
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-8
|
||||
target=android-10
|
||||
|
||||
android.library.reference.1=../../../../cocos2dx/platform/android/java
|
||||
|
|
|
@ -64,11 +64,11 @@
|
|||
15A3D78B1682F470002FB0C5 /* main.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = main.js; path = ../../Shared/games/WatermelonWithMe/main.js; sourceTree = "<group>"; };
|
||||
15A3D78C1682F470002FB0C5 /* resources-jsb.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = "resources-jsb.js"; path = "../../Shared/games/WatermelonWithMe/resources-jsb.js"; sourceTree = "<group>"; };
|
||||
15A3D78D1682F470002FB0C5 /* watermelon_with_me.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = watermelon_with_me.js; path = ../../Shared/games/WatermelonWithMe/watermelon_with_me.js; sourceTree = "<group>"; };
|
||||
1A6E472C177818E90055514D /* libchipmunk.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libchipmunk.a; path = "../../../../external/chipmunk/proj.ios/build/Release-iphoneos/libchipmunk.a"; sourceTree = "<group>"; };
|
||||
1A6E472D177818E90055514D /* libcocos2dx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcocos2dx.a; path = "../../../../cocos2dx/proj.ios/build/Release-iphoneos/libcocos2dx.a"; sourceTree = "<group>"; };
|
||||
1A6E472E177818E90055514D /* libCocosDenshion.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libCocosDenshion.a; path = "../../../../CocosDenshion/proj.ios/build/Release-iphoneos/libCocosDenshion.a"; sourceTree = "<group>"; };
|
||||
1A6E472F177818E90055514D /* libextensions.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libextensions.a; path = "../../../../extensions/proj.ios/build/Release-iphoneos/libextensions.a"; sourceTree = "<group>"; };
|
||||
1A6E4730177818E90055514D /* libjsbindings.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libjsbindings.a; path = "../../../../scripting/javascript/bindings/proj.ios/build/Release-iphoneos/libjsbindings.a"; sourceTree = "<group>"; };
|
||||
1A6E472C177818E90055514D /* libchipmunk.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libchipmunk.a; path = "libchipmunk.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E472D177818E90055514D /* libcocos2dx.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libcocos2dx.a; path = "libcocos2dx.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E472E177818E90055514D /* libCocosDenshion.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libCocosDenshion.a; path = "libCocosDenshion.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E472F177818E90055514D /* libextensions.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libextensions.a; path = "libextensions.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E4730177818E90055514D /* libjsbindings.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libjsbindings.a; path = "libjsbindings.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E4737177818FC0055514D /* jsb.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb.js; sourceTree = "<group>"; };
|
||||
1A6E4738177818FC0055514D /* jsb_chipmunk.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb_chipmunk.js; sourceTree = "<group>"; };
|
||||
1A6E4739177818FC0055514D /* jsb_chipmunk_constants.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb_chipmunk_constants.js; sourceTree = "<group>"; };
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8"/>
|
||||
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="9"/>
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
|
||||
<application android:label="@string/app_name"
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-8
|
||||
target=android-10
|
||||
|
||||
android.library.reference.1=../../../../cocos2dx/platform/android/java
|
||||
|
|
|
@ -49,12 +49,12 @@
|
|||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
1A6E48DC17781C0F0055514D /* libcocos2dx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcocos2dx.a; path = "../../../../cocos2dx/proj.ios/build/Release-iphoneos/libcocos2dx.a"; sourceTree = "<group>"; };
|
||||
1A6E48DD17781C0F0055514D /* libCocosDenshion.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libCocosDenshion.a; path = "../../../../CocosDenshion/proj.ios/build/Release-iphoneos/libCocosDenshion.a"; sourceTree = "<group>"; };
|
||||
1A6E48DE17781C0F0055514D /* libluabindings.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libluabindings.a; path = "../../../../scripting/lua/proj.ios/build/Release-iphoneos/libluabindings.a"; sourceTree = "<group>"; };
|
||||
1A6E48EE17781D600055514D /* libchipmunk.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libchipmunk.a; path = "../../../../external/chipmunk/proj.ios/build/Release-iphoneos/libchipmunk.a"; sourceTree = "<group>"; };
|
||||
1A6E48F217781D920055514D /* libBox2D.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libBox2D.a; path = "../../../../external/Box2D/proj.ios/build/Release-iphoneos/libBox2D.a"; sourceTree = "<group>"; };
|
||||
1A6E4901177821FB0055514D /* libextensions.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libextensions.a; path = "../../../../extensions/proj.ios/build/Release-iphoneos/libextensions.a"; sourceTree = "<group>"; };
|
||||
1A6E48DC17781C0F0055514D /* libcocos2dx.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libcocos2dx.a; path = "libcocos2dx.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E48DD17781C0F0055514D /* libCocosDenshion.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libCocosDenshion.a; path = "libCocosDenshion.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E48DE17781C0F0055514D /* libluabindings.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libluabindings.a; path = "libluabindings.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E48EE17781D600055514D /* libchipmunk.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libchipmunk.a; path = "libchipmunk.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E48F217781D920055514D /* libBox2D.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libBox2D.a; path = "libBox2D.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E4901177821FB0055514D /* libextensions.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libextensions.a; path = "libextensions.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E49041778251B0055514D /* AudioEngine.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AudioEngine.lua; sourceTree = "<group>"; };
|
||||
1A6E49051778251B0055514D /* CCBReaderLoad.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CCBReaderLoad.lua; sourceTree = "<group>"; };
|
||||
1A6E49061778251B0055514D /* Cocos2dConstants.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cocos2dConstants.lua; sourceTree = "<group>"; };
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
require "OpenglConstants"
|
||||
require "Cocos2dConstants"
|
||||
require "Opengl"
|
||||
local function OpenGLTestMainLayer()
|
||||
local kItemTagBasic = 1000
|
||||
local testCount = 16
|
||||
|
@ -190,19 +191,19 @@ local function OpenGLTestMainLayer()
|
|||
|
||||
local program = shader:getProgram()
|
||||
|
||||
local glNode = GLNode:create()
|
||||
local glNode = gl.glNodeCreate()
|
||||
glNode:setContentSize(CCSizeMake(256,256))
|
||||
glNode:setAnchorPoint(ccp(0.5, 0.5))
|
||||
uniformCenter = glNode:_getUniformLocation(program,"center")
|
||||
uniformResolution = glNode:_getUniformLocation( program, "resolution")
|
||||
uniformCenter = gl.getUniformLocation(program,"center")
|
||||
uniformResolution = gl.getUniformLocation( program, "resolution")
|
||||
glNode:setShaderProgram(shader)
|
||||
|
||||
local function initBuffer()
|
||||
squareVertexPositionBuffer.buffer_id = glNode:_createBuffer()
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
squareVertexPositionBuffer = gl.createBuffer()
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,squareVertexPositionBuffer)
|
||||
local vertices = { 256,256,0,256,256,0,0,0}
|
||||
glNode:bufferData(GLConstant.ARRAY_BUFFER,8,vertices,GLConstant.STATIC_DRAW)
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, 0)
|
||||
gl.bufferData(gl.ARRAY_BUFFER,8,vertices,gl.STATIC_DRAW)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, 0)
|
||||
end
|
||||
|
||||
local function updateMajori(fTime)
|
||||
|
@ -217,13 +218,13 @@ local function OpenGLTestMainLayer()
|
|||
shader:setUniformLocationWith2f( uniformCenter, size.width/2, size.height/2)
|
||||
shader:setUniformLocationWith2f( uniformResolution, 256, 256)
|
||||
|
||||
glNode:glEnableVertexAttribs(CCConstants.VERTEX_ATTRIB_FLAG_POSITION)
|
||||
gl.glEnableVertexAttribs(CCConstants.VERTEX_ATTRIB_FLAG_POSITION)
|
||||
|
||||
--Draw fullscreen Square
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
glNode:vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, GLConstant.FLOAT, false, 0, 0)
|
||||
glNode:drawArrays(GLConstant.TRIANGLE_STRIP,0,4)
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,0)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,squareVertexPositionBuffer)
|
||||
gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0)
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP,0,4)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,0)
|
||||
end
|
||||
end
|
||||
initBuffer()
|
||||
|
@ -252,19 +253,19 @@ local function OpenGLTestMainLayer()
|
|||
|
||||
local program = shader:getProgram()
|
||||
|
||||
local glNode = GLNode:create()
|
||||
local glNode = gl.glNodeCreate()
|
||||
glNode:setContentSize(CCSizeMake(256,256))
|
||||
glNode:setAnchorPoint(ccp(0.5, 0.5))
|
||||
uniformCenter = glNode:_getUniformLocation(program,"center")
|
||||
uniformResolution = glNode:_getUniformLocation( program, "resolution")
|
||||
uniformCenter = gl.getUniformLocation(program,"center")
|
||||
uniformResolution = gl.getUniformLocation( program, "resolution")
|
||||
glNode:setShaderProgram(shader)
|
||||
|
||||
local function initBuffer()
|
||||
squareVertexPositionBuffer.buffer_id = glNode:_createBuffer()
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
squareVertexPositionBuffer.buffer_id = gl.createBuffer()
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
local vertices = { 256,256,0,256,256,0,0,0}
|
||||
glNode:bufferData(GLConstant.ARRAY_BUFFER,8,vertices,GLConstant.STATIC_DRAW)
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, 0)
|
||||
gl.bufferData(gl.ARRAY_BUFFER,8,vertices,gl.STATIC_DRAW)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, 0)
|
||||
end
|
||||
|
||||
local function updateMandelbrot(fTime)
|
||||
|
@ -279,13 +280,13 @@ local function OpenGLTestMainLayer()
|
|||
shader:setUniformLocationWith2f( uniformCenter, size.width/2, size.height/2)
|
||||
shader:setUniformLocationWith2f( uniformResolution, 256, 256)
|
||||
|
||||
glNode:glEnableVertexAttribs(0x1)
|
||||
gl.glEnableVertexAttribs(0x1)
|
||||
|
||||
--Draw fullscreen Square
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
glNode:vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, GLConstant.FLOAT, false, 0, 0)
|
||||
glNode:drawArrays(GLConstant.TRIANGLE_STRIP,0,4)
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,0)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0)
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP,0,4)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,0)
|
||||
end
|
||||
end
|
||||
initBuffer()
|
||||
|
@ -314,19 +315,19 @@ local function OpenGLTestMainLayer()
|
|||
|
||||
local program = shader:getProgram()
|
||||
|
||||
local glNode = GLNode:create()
|
||||
local glNode = gl.glNodeCreate()
|
||||
glNode:setContentSize(CCSizeMake(256,256))
|
||||
glNode:setAnchorPoint(ccp(0.5, 0.5))
|
||||
uniformCenter = glNode:_getUniformLocation(program,"center")
|
||||
uniformResolution = glNode:_getUniformLocation( program, "resolution")
|
||||
uniformCenter = gl.getUniformLocation(program,"center")
|
||||
uniformResolution = gl.getUniformLocation( program, "resolution")
|
||||
glNode:setShaderProgram(shader)
|
||||
|
||||
local function initBuffer()
|
||||
squareVertexPositionBuffer.buffer_id = glNode:_createBuffer()
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
squareVertexPositionBuffer.buffer_id = gl.createBuffer()
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
local vertices = { 256,256,0,256,256,0,0,0}
|
||||
glNode:bufferData(GLConstant.ARRAY_BUFFER,8,vertices,GLConstant.STATIC_DRAW)
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, 0)
|
||||
gl.bufferData(gl.ARRAY_BUFFER,8,vertices,gl.STATIC_DRAW)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, 0)
|
||||
end
|
||||
|
||||
local function updateHeart(fTime)
|
||||
|
@ -341,13 +342,13 @@ local function OpenGLTestMainLayer()
|
|||
shader:setUniformLocationWith2f( uniformCenter, size.width/2, size.height/2)
|
||||
shader:setUniformLocationWith2f( uniformResolution, 256, 256)
|
||||
|
||||
glNode:glEnableVertexAttribs(0x1)
|
||||
gl.glEnableVertexAttribs(0x1)
|
||||
|
||||
--Draw fullscreen Square
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
glNode:vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, GLConstant.FLOAT, false, 0, 0)
|
||||
glNode:drawArrays(GLConstant.TRIANGLE_STRIP,0,4)
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,0)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0)
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP,0,4)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,0)
|
||||
end
|
||||
end
|
||||
initBuffer()
|
||||
|
@ -376,19 +377,19 @@ local function OpenGLTestMainLayer()
|
|||
|
||||
local program = shader:getProgram()
|
||||
|
||||
local glNode = GLNode:create()
|
||||
local glNode = gl.glNodeCreate()
|
||||
glNode:setContentSize(CCSizeMake(256,256))
|
||||
glNode:setAnchorPoint(ccp(0.5, 0.5))
|
||||
uniformCenter = glNode:_getUniformLocation(program,"center")
|
||||
uniformResolution = glNode:_getUniformLocation( program, "resolution")
|
||||
uniformCenter = gl.getUniformLocation(program,"center")
|
||||
uniformResolution = gl.getUniformLocation( program, "resolution")
|
||||
glNode:setShaderProgram(shader)
|
||||
|
||||
local function initBuffer()
|
||||
squareVertexPositionBuffer.buffer_id = glNode:_createBuffer()
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
squareVertexPositionBuffer.buffer_id = gl.createBuffer()
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
local vertices = { 256,256,0,256,256,0,0,0}
|
||||
glNode:bufferData(GLConstant.ARRAY_BUFFER,8,vertices,GLConstant.STATIC_DRAW)
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, 0)
|
||||
gl.bufferData(gl.ARRAY_BUFFER,8,vertices,gl.STATIC_DRAW)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, 0)
|
||||
end
|
||||
|
||||
local function updatePlasma(fTime)
|
||||
|
@ -403,13 +404,13 @@ local function OpenGLTestMainLayer()
|
|||
shader:setUniformLocationWith2f( uniformCenter, size.width/2, size.height/2)
|
||||
shader:setUniformLocationWith2f( uniformResolution, 256, 256)
|
||||
|
||||
glNode:glEnableVertexAttribs(0x1)
|
||||
gl.glEnableVertexAttribs(0x1)
|
||||
|
||||
--Draw fullscreen Square
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
glNode:vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, GLConstant.FLOAT, false, 0, 0)
|
||||
glNode:drawArrays(GLConstant.TRIANGLE_STRIP,0,4)
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,0)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0)
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP,0,4)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,0)
|
||||
end
|
||||
end
|
||||
initBuffer()
|
||||
|
@ -438,19 +439,19 @@ local function OpenGLTestMainLayer()
|
|||
|
||||
local program = shader:getProgram()
|
||||
|
||||
local glNode = GLNode:create()
|
||||
local glNode = gl.glNodeCreate()
|
||||
glNode:setContentSize(CCSizeMake(256,256))
|
||||
glNode:setAnchorPoint(ccp(0.5, 0.5))
|
||||
uniformCenter = glNode:_getUniformLocation(program,"center")
|
||||
uniformResolution = glNode:_getUniformLocation( program, "resolution")
|
||||
uniformCenter = gl.getUniformLocation(program,"center")
|
||||
uniformResolution = gl.getUniformLocation( program, "resolution")
|
||||
glNode:setShaderProgram(shader)
|
||||
|
||||
local function initBuffer()
|
||||
squareVertexPositionBuffer.buffer_id = glNode:_createBuffer()
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
squareVertexPositionBuffer.buffer_id = gl.createBuffer()
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
local vertices = { 256,256,0,256,256,0,0,0}
|
||||
glNode:bufferData(GLConstant.ARRAY_BUFFER,8,vertices,GLConstant.STATIC_DRAW)
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, 0)
|
||||
gl.bufferData(gl.ARRAY_BUFFER,8,vertices,gl.STATIC_DRAW)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, 0)
|
||||
end
|
||||
|
||||
local function updateFlower(fTime)
|
||||
|
@ -465,13 +466,13 @@ local function OpenGLTestMainLayer()
|
|||
shader:setUniformLocationWith2f( uniformCenter, size.width/2, size.height/2)
|
||||
shader:setUniformLocationWith2f( uniformResolution, 256, 256)
|
||||
|
||||
glNode:glEnableVertexAttribs(0x1)
|
||||
gl.glEnableVertexAttribs(0x1)
|
||||
|
||||
--Draw fullscreen Square
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
glNode:vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, GLConstant.FLOAT, false, 0, 0)
|
||||
glNode:drawArrays(GLConstant.TRIANGLE_STRIP,0,4)
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,0)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0)
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP,0,4)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,0)
|
||||
end
|
||||
end
|
||||
initBuffer()
|
||||
|
@ -500,19 +501,19 @@ local function OpenGLTestMainLayer()
|
|||
|
||||
local program = shader:getProgram()
|
||||
|
||||
local glNode = GLNode:create()
|
||||
local glNode = gl.glNodeCreate()
|
||||
glNode:setContentSize(CCSizeMake(256,256))
|
||||
glNode:setAnchorPoint(ccp(0.5, 0.5))
|
||||
uniformCenter = glNode:_getUniformLocation(program,"center")
|
||||
uniformResolution = glNode:_getUniformLocation( program, "resolution")
|
||||
uniformCenter = gl.getUniformLocation(program,"center")
|
||||
uniformResolution = gl.getUniformLocation( program, "resolution")
|
||||
glNode:setShaderProgram(shader)
|
||||
|
||||
local function initBuffer()
|
||||
squareVertexPositionBuffer.buffer_id = glNode:_createBuffer()
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
squareVertexPositionBuffer.buffer_id = gl.createBuffer()
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
local vertices = { 256,256,0,256,256,0,0,0}
|
||||
glNode:bufferData(GLConstant.ARRAY_BUFFER,8,vertices,GLConstant.STATIC_DRAW)
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, 0)
|
||||
gl.bufferData(gl.ARRAY_BUFFER,8,vertices,gl.STATIC_DRAW)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, 0)
|
||||
end
|
||||
|
||||
local function updateJulia(fTime)
|
||||
|
@ -527,13 +528,13 @@ local function OpenGLTestMainLayer()
|
|||
shader:setUniformLocationWith2f( uniformCenter, size.width/2, size.height/2)
|
||||
shader:setUniformLocationWith2f( uniformResolution, 256, 256)
|
||||
|
||||
glNode:glEnableVertexAttribs(0x1)
|
||||
gl.glEnableVertexAttribs(0x1)
|
||||
|
||||
--Draw fullscreen Square
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
glNode:vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, GLConstant.FLOAT, false, 0, 0)
|
||||
glNode:drawArrays(GLConstant.TRIANGLE_STRIP,0,4)
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,0)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id)
|
||||
gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0)
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP,0,4)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,0)
|
||||
end
|
||||
end
|
||||
initBuffer()
|
||||
|
@ -551,7 +552,7 @@ local function OpenGLTestMainLayer()
|
|||
local sprite = CCSprite:create("Images/grossini.png")
|
||||
sprite:setPosition( size.width/2, size.height/2)
|
||||
glGetActiveLayer:addChild(sprite)
|
||||
local glNode = GLNode:create()
|
||||
local glNode = gl.glNodeCreate()
|
||||
glGetActiveLayer:addChild(glNode,-10)
|
||||
local scheduler = CCDirector:sharedDirector():getScheduler()
|
||||
|
||||
|
@ -560,13 +561,13 @@ local function OpenGLTestMainLayer()
|
|||
local glProgam = tolua.cast(sprite:getShaderProgram(),"CCGLProgram")
|
||||
if nil ~= glProgam then
|
||||
local p = glProgam:getProgram()
|
||||
local aaSize,aaType,aaName = glNode:_getActiveAttrib(p,0)
|
||||
local aaSize,aaType,aaName = gl.getActiveAttrib(p,0)
|
||||
local strFmt = "size:"..aaSize.." type:"..aaType.." name:"..aaName
|
||||
print(strFmt)
|
||||
local auSize,auType,auName = glNode:_getActiveUniform(p,0)
|
||||
local auSize,auType,auName = gl.getActiveUniform(p,0)
|
||||
strFmt = "size:"..auSize.." type:"..auType.." name:"..auName
|
||||
print(strFmt)
|
||||
local shadersTable = glNode:_getAttachedShaders(p)
|
||||
local shadersTable = gl.getAttachedShaders(p)
|
||||
if type(shadersTable) == "table" then
|
||||
local count = table.getn(shadersTable)
|
||||
local i = 1
|
||||
|
@ -598,7 +599,7 @@ local function OpenGLTestMainLayer()
|
|||
local squareVertexTextureBuffer = {}
|
||||
local texImage2dLayer = CCLayer:create()
|
||||
InitTitle(texImage2dLayer)
|
||||
local glNode = GLNode:create()
|
||||
local glNode = gl.glNodeCreate()
|
||||
texImage2dLayer:addChild(glNode, 10)
|
||||
glNode:setPosition(size.width/2, size.height/2)
|
||||
glNode:setContentSize(CCSizeMake(128,128))
|
||||
|
@ -606,8 +607,8 @@ local function OpenGLTestMainLayer()
|
|||
local shaderCache = CCShaderCache:getInstance()
|
||||
local shader = shaderCache:getProgram("ShaderPositionTexture")
|
||||
local function initGL()
|
||||
texture.texture_id = glNode:_createTexture()
|
||||
glNode:_bindTexture(GLConstant.TEXTURE_2D,texture.texture_id )
|
||||
texture.texture_id = gl.createTexture()
|
||||
gl.bindTexture(gl.TEXTURE_2D,texture.texture_id )
|
||||
local pixels = {}
|
||||
local i = 1
|
||||
while i <= 4096 do
|
||||
|
@ -621,22 +622,22 @@ local function OpenGLTestMainLayer()
|
|||
i = i + 1
|
||||
end
|
||||
|
||||
glNode:_texImage2D(GLConstant.TEXTURE_2D, 0, GLConstant.RGBA, 32, 32, 0, GLConstant.RGBA, GLConstant.UNSIGNED_BYTE, table.getn(pixels),pixels)
|
||||
glNode:texParameteri(GLConstant.TEXTURE_2D, GLConstant.TEXTURE_MAG_FILTER, GLConstant.NEAREST)
|
||||
glNode:texParameteri(GLConstant.TEXTURE_2D, GLConstant.TEXTURE_MIN_FILTER, GLConstant.NEAREST)
|
||||
glNode:_bindTexture(GLConstant.TEXTURE_2D, 0)
|
||||
gl._texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 32, 32, 0, gl.RGBA, gl.UNSIGNED_BYTE, table.getn(pixels),pixels)
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST)
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST)
|
||||
gl.bindTexture(gl.TEXTURE_2D, 0)
|
||||
|
||||
--Square
|
||||
squareVertexPositionBuffer.buffer_id = glNode:_createBuffer()
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexPositionBuffer.buffer_id)
|
||||
squareVertexPositionBuffer.buffer_id = gl.createBuffer()
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, squareVertexPositionBuffer.buffer_id)
|
||||
local vertices = { 128, 128, 0, 128, 128, 0, 0, 0 }
|
||||
glNode:bufferData(GLConstant.ARRAY_BUFFER,table.getn(vertices),vertices,GLConstant.STATIC_DRAW)
|
||||
gl.bufferData(gl.ARRAY_BUFFER,table.getn(vertices),vertices,gl.STATIC_DRAW)
|
||||
|
||||
squareVertexTextureBuffer.buffer_id = glNode:_createBuffer()
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexTextureBuffer.buffer_id)
|
||||
squareVertexTextureBuffer.buffer_id = gl.createBuffer()
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, squareVertexTextureBuffer.buffer_id)
|
||||
local texcoords = { 1, 1, 0, 1, 1, 0, 0, 0 }
|
||||
glNode:bufferData(GLConstant.ARRAY_BUFFER,table.getn(texcoords),texcoords,GLConstant.STATIC_DRAW)
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,0)
|
||||
gl.bufferData(gl.ARRAY_BUFFER,table.getn(texcoords),texcoords,gl.STATIC_DRAW)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,0)
|
||||
end
|
||||
|
||||
local function TexImage2DDraw()
|
||||
|
@ -644,20 +645,20 @@ local function OpenGLTestMainLayer()
|
|||
shader:use()
|
||||
shader:setUniformsForBuiltins()
|
||||
|
||||
glNode:_bindTexture(GLConstant.TEXTURE_2D, texture.texture_id)
|
||||
glNode:glEnableVertexAttribs(CCConstants.VERTEX_ATTRIB_FLAG_TEX_COORDS or CCConstants.VERTEX_ATTRIB_FLAG_POSITION)
|
||||
gl.bindTexture(gl.TEXTURE_2D, texture.texture_id)
|
||||
gl.glEnableVertexAttribs(CCConstants.VERTEX_ATTRIB_FLAG_TEX_COORDS or CCConstants.VERTEX_ATTRIB_FLAG_POSITION)
|
||||
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexPositionBuffer.buffer_id)
|
||||
glNode:vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION,2,GLConstant.FLOAT,false,0,0)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, squareVertexPositionBuffer.buffer_id)
|
||||
gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION,2,gl.FLOAT,false,0,0)
|
||||
|
||||
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexTextureBuffer.buffer_id)
|
||||
glNode:vertexAttribPointer(CCConstants.VERTEX_ATTRIB_TEX_COORDS,2,GLConstant.FLOAT,false,0,0)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, squareVertexTextureBuffer.buffer_id)
|
||||
gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_TEX_COORDS,2,gl.FLOAT,false,0,0)
|
||||
|
||||
glNode:drawArrays(GLConstant.TRIANGLE_STRIP,0,4)
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP,0,4)
|
||||
|
||||
glNode:_bindTexture(GLConstant.TEXTURE_2D,0)
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,0)
|
||||
gl.bindTexture(gl.TEXTURE_2D,0)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER,0)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -669,9 +670,9 @@ local function OpenGLTestMainLayer()
|
|||
local function CreateSupportedExtensionsLayer()
|
||||
local extensionsLayer = CCLayer:create()
|
||||
InitTitle(extensionsLayer)
|
||||
local glNode = GLNode:create()
|
||||
local glNode = gl.glNodeCreate()
|
||||
extensionsLayer:addChild(glNode,-10)
|
||||
local supportExtensions = glNode:getSupportedExtensions()
|
||||
local supportExtensions = gl.getSupportedExtensions()
|
||||
if type(supportExtensions) ~= "table" then
|
||||
print("error:return value not table")
|
||||
return
|
||||
|
@ -688,7 +689,7 @@ local function OpenGLTestMainLayer()
|
|||
local function CreateReadPixelsTest()
|
||||
local readPixelsLayer = CCLayer:create()
|
||||
InitTitle(readPixelsLayer)
|
||||
local glNode = GLNode:create()
|
||||
local glNode = gl.glNodeCreate()
|
||||
readPixelsLayer:addChild(glNode,-10)
|
||||
|
||||
local x = size.width
|
||||
|
@ -726,7 +727,7 @@ local function OpenGLTestMainLayer()
|
|||
local i = 1
|
||||
local strFmt = ""
|
||||
--blue
|
||||
local bPixels = glNode:readPixels(0, 0, 1, 1, GLConstant.RGBA, GLConstant.UNSIGNED_BYTE, pixelCount)
|
||||
local bPixels = gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixelCount)
|
||||
for i=1,pixelCount do
|
||||
local strTmp = string.format("%d:%d ",i,bPixels[i])
|
||||
strFmt = strFmt .. strTmp
|
||||
|
@ -734,7 +735,7 @@ local function OpenGLTestMainLayer()
|
|||
print(strFmt)
|
||||
strFmt = ""
|
||||
--red
|
||||
local rPixels = glNode:readPixels(x-1, 0, 1, 1, GLConstant.RGBA, GLConstant.UNSIGNED_BYTE, pixelCount)
|
||||
local rPixels = gl.readPixels(x-1, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixelCount)
|
||||
for i=1,pixelCount do
|
||||
local strTmp = string.format("%d:%d ",i,rPixels[i])
|
||||
strFmt = strFmt .. strTmp
|
||||
|
@ -742,7 +743,7 @@ local function OpenGLTestMainLayer()
|
|||
print(strFmt)
|
||||
strFmt = ""
|
||||
--green
|
||||
local gPixels = glNode:readPixels(0, y-1, 1, 1, GLConstant.RGBA, GLConstant.UNSIGNED_BYTE, pixelCount)
|
||||
local gPixels = gl.readPixels(0, y-1, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixelCount)
|
||||
for i=1,pixelCount do
|
||||
local strTmp = string.format("%d:%d ",i,gPixels[i])
|
||||
strFmt = strFmt .. strTmp
|
||||
|
@ -750,7 +751,7 @@ local function OpenGLTestMainLayer()
|
|||
print(strFmt)
|
||||
strFmt = ""
|
||||
--white
|
||||
local wPixels = glNode:readPixels(x-1, y-1, 1, 1, GLConstant.RGBA, GLConstant.UNSIGNED_BYTE, pixelCount)
|
||||
local wPixels = gl.readPixels(x-1, y-1, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixelCount)
|
||||
for i=1,pixelCount do
|
||||
local strTmp = string.format("%d:%d ",i,wPixels[i])
|
||||
strFmt = strFmt .. strTmp
|
||||
|
@ -778,18 +779,18 @@ local function OpenGLTestMainLayer()
|
|||
local blue = CCLayerColor:create(ccc4(0, 0, 255, 255))
|
||||
clearLayer:addChild( blue, 1 )
|
||||
|
||||
local glNode = GLNode:create()
|
||||
local glNode = gl.glNodeCreate()
|
||||
clearLayer:addChild(glNode,10)
|
||||
--glNode:init()
|
||||
--gl.init()
|
||||
local scheduler = CCDirector:sharedDirector():getScheduler()
|
||||
|
||||
local function clearDraw()
|
||||
glNode:clear(GLConstant.COLOR_BUFFER_BIT)
|
||||
gl.clear(gl.COLOR_BUFFER_BIT)
|
||||
end
|
||||
|
||||
local function getCurrentResult()
|
||||
|
||||
local pixels = glNode:readPixels(math.floor(size.width/2), math.floor(size.height/2), 1, 1, GLConstant.RGBA, GLConstant.UNSIGNED_BYTE, 4)
|
||||
local pixels = gl.readPixels(math.floor(size.width/2), math.floor(size.height/2), 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, 4)
|
||||
local strFmt = ""
|
||||
for i=1,4 do
|
||||
local strTmp = string.format("%d:%d ",i,pixels[i])
|
||||
|
@ -814,7 +815,7 @@ local function OpenGLTestMainLayer()
|
|||
local function createNodeWebGLAPITest()
|
||||
local nodeWebGLAPILayer = CCLayer:create()
|
||||
InitTitle(nodeWebGLAPILayer)
|
||||
local glNode = GLNode:create()
|
||||
local glNode = gl.glNodeCreate()
|
||||
nodeWebGLAPILayer:addChild(glNode,10)
|
||||
local shaderProgram = {}
|
||||
local triangleVertexPositionBuffer = {}
|
||||
|
@ -841,13 +842,13 @@ local function OpenGLTestMainLayer()
|
|||
local function compileShader(source,type)
|
||||
local shader
|
||||
if type == "fragment" then
|
||||
shader = glNode:_createShader(GLConstant.FRAGMENT_SHADER)
|
||||
shader = gl.createShader(gl.FRAGMENT_SHADER)
|
||||
else
|
||||
shader = glNode:_createShader(GLConstant.VERTEX_SHADER)
|
||||
shader = gl.createShader(gl.VERTEX_SHADER)
|
||||
end
|
||||
glNode:_shaderSource(shader,source)
|
||||
glNode:_compileShader(shader)
|
||||
local ret = glNode:_getShaderParameter(shader,GLConstant.COMPILE_STATUS)
|
||||
gl.shaderSource(shader,source)
|
||||
gl.compileShader(shader)
|
||||
local ret = gl.getShaderParameter(shader,gl.COMPILE_STATUS)
|
||||
if not ret then
|
||||
--throw
|
||||
print("Could not compile "..type.." shader")
|
||||
|
@ -856,111 +857,111 @@ local function OpenGLTestMainLayer()
|
|||
end
|
||||
|
||||
local function initBuffers()
|
||||
triangleVertexPositionBuffer.buffer_id = glNode:_createBuffer()
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, triangleVertexPositionBuffer.buffer_id)
|
||||
triangleVertexPositionBuffer.buffer_id = gl.createBuffer()
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, triangleVertexPositionBuffer.buffer_id)
|
||||
local vertices = {
|
||||
0.0, 1.0, 0.0,
|
||||
-1.0, -1.0, 0.0,
|
||||
1.0, -1.0, 0.0
|
||||
}
|
||||
glNode:bufferData(GLConstant.ARRAY_BUFFER, 9, vertices,GLConstant.STATIC_DRAW)
|
||||
gl.bufferData(gl.ARRAY_BUFFER, 9, vertices,gl.STATIC_DRAW)
|
||||
triangleVertexPositionBuffer.itemSize = 3
|
||||
triangleVertexPositionBuffer.numItems = 3
|
||||
|
||||
triangleVertexColorBuffer.buffer_id = glNode:_createBuffer()
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, triangleVertexColorBuffer.buffer_id)
|
||||
triangleVertexColorBuffer.buffer_id = gl.createBuffer()
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, triangleVertexColorBuffer.buffer_id)
|
||||
local colors = {
|
||||
1.0, 0.0, 0.0, 1.0,
|
||||
1.0, 0.0, 0.0, 1.0,
|
||||
1.0, 0.0, 0.0, 1.0
|
||||
}
|
||||
glNode:bufferData(GLConstant.ARRAY_BUFFER, 12, colors , GLConstant.STATIC_DRAW)
|
||||
gl.bufferData(gl.ARRAY_BUFFER, 12, colors , gl.STATIC_DRAW)
|
||||
triangleVertexColorBuffer.itemSize = 4
|
||||
triangleVertexColorBuffer.numItems = 3
|
||||
|
||||
squareVertexPositionBuffer.buffer_id = glNode:_createBuffer()
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexPositionBuffer.buffer_id)
|
||||
squareVertexPositionBuffer.buffer_id = gl.createBuffer()
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, squareVertexPositionBuffer.buffer_id)
|
||||
vertices = {
|
||||
1.0, 1.0, 0.0,
|
||||
-1.0, 1.0, 0.0,
|
||||
1.0, -1.0, 0.0,
|
||||
-1.0, -1.0, 0.0
|
||||
}
|
||||
glNode:bufferData(GLConstant.ARRAY_BUFFER, 12, vertices,GLConstant.STATIC_DRAW)
|
||||
gl.bufferData(gl.ARRAY_BUFFER, 12, vertices,gl.STATIC_DRAW)
|
||||
squareVertexPositionBuffer.itemSize = 3
|
||||
squareVertexPositionBuffer.numItems = 4
|
||||
|
||||
squareVertexColorBuffer.buffer_id = glNode:_createBuffer()
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexColorBuffer.buffer_id)
|
||||
squareVertexColorBuffer.buffer_id = gl.createBuffer()
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, squareVertexColorBuffer.buffer_id)
|
||||
colors = {
|
||||
0.0, 0.0, 1.0, 1.0,
|
||||
0.0, 0.0, 1.0, 1.0,
|
||||
0.0, 0.0, 1.0, 1.0,
|
||||
0.0, 0.0, 1.0, 1.0
|
||||
}
|
||||
glNode:bufferData(GLConstant.ARRAY_BUFFER, 16,colors, GLConstant.STATIC_DRAW)
|
||||
gl.bufferData(gl.ARRAY_BUFFER, 16,colors, gl.STATIC_DRAW)
|
||||
squareVertexColorBuffer.itemSize = 4
|
||||
squareVertexColorBuffer.numItems = 4
|
||||
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, 0)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, 0)
|
||||
end
|
||||
|
||||
local function setMatrixUniforms()
|
||||
glNode:uniformMatrix4fv(shaderProgram.pMatrixUniform,false,table.getn(pMatrix), pMatrix)
|
||||
glNode:uniformMatrix4fv(shaderProgram.mvMatrixUniform,false,table.getn(mvMatrix),mvMatrix)
|
||||
gl.uniformMatrix4fv(shaderProgram.pMatrixUniform,false,table.getn(pMatrix), pMatrix)
|
||||
gl.uniformMatrix4fv(shaderProgram.mvMatrixUniform,false,table.getn(mvMatrix),mvMatrix)
|
||||
end
|
||||
|
||||
local function nodeWebGLDraw()
|
||||
glNode:_useProgram(shaderProgram.program_id)
|
||||
glNode:uniformMatrix4fv(shaderProgram.pMatrixUniform,false,table.getn(pMatrix),pMatrix)
|
||||
glNode:uniformMatrix4fv(shaderProgram.mvMatrixUniform,false,table.getn(mvMatrix),mvMatrix)
|
||||
gl.useProgram(shaderProgram.program_id)
|
||||
gl.uniformMatrix4fv(shaderProgram.pMatrixUniform,false,table.getn(pMatrix),pMatrix)
|
||||
gl.uniformMatrix4fv(shaderProgram.mvMatrixUniform,false,table.getn(mvMatrix),mvMatrix)
|
||||
|
||||
glNode:enableVertexAttribArray(shaderProgram.vertexPositionAttribute)
|
||||
glNode:enableVertexAttribArray(shaderProgram.vertexColorAttribute)
|
||||
gl.enableVertexAttribArray(shaderProgram.vertexPositionAttribute)
|
||||
gl.enableVertexAttribArray(shaderProgram.vertexColorAttribute)
|
||||
|
||||
--Draw
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexPositionBuffer.buffer_id)
|
||||
glNode:vertexAttribPointer(shaderProgram.vertexPositionAttribute, squareVertexPositionBuffer.itemSize, GLConstant.FLOAT, false, 0, 0)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, squareVertexPositionBuffer.buffer_id)
|
||||
gl.vertexAttribPointer(shaderProgram.vertexPositionAttribute, squareVertexPositionBuffer.itemSize, gl.FLOAT, false, 0, 0)
|
||||
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexColorBuffer.buffer_id)
|
||||
glNode:vertexAttribPointer(shaderProgram.vertexColorAttribute, squareVertexColorBuffer.itemSize, GLConstant.FLOAT, false, 0, 0)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, squareVertexColorBuffer.buffer_id)
|
||||
gl.vertexAttribPointer(shaderProgram.vertexColorAttribute, squareVertexColorBuffer.itemSize, gl.FLOAT, false, 0, 0)
|
||||
|
||||
setMatrixUniforms()
|
||||
|
||||
glNode:drawArrays(GLConstant.TRIANGLE_STRIP, 0, squareVertexPositionBuffer.numItems)
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, squareVertexPositionBuffer.numItems)
|
||||
|
||||
--DrawArray
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, triangleVertexPositionBuffer.buffer_id)
|
||||
glNode:vertexAttribPointer(shaderProgram.vertexPositionAttribute, triangleVertexPositionBuffer.itemSize, GLConstant.FLOAT, false, 0, 0)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, triangleVertexPositionBuffer.buffer_id)
|
||||
gl.vertexAttribPointer(shaderProgram.vertexPositionAttribute, triangleVertexPositionBuffer.itemSize, gl.FLOAT, false, 0, 0)
|
||||
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, triangleVertexColorBuffer.buffer_id)
|
||||
glNode:vertexAttribPointer(shaderProgram.vertexColorAttribute, triangleVertexColorBuffer.itemSize, GLConstant.FLOAT, false, 0, 0)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, triangleVertexColorBuffer.buffer_id)
|
||||
gl.vertexAttribPointer(shaderProgram.vertexColorAttribute, triangleVertexColorBuffer.itemSize, gl.FLOAT, false, 0, 0)
|
||||
|
||||
glNode:drawArrays(GLConstant.TRIANGLES, 0, triangleVertexPositionBuffer.numItems)
|
||||
gl.drawArrays(gl.TRIANGLES, 0, triangleVertexPositionBuffer.numItems)
|
||||
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, 0)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, 0)
|
||||
end
|
||||
|
||||
local fshader = compileShader(fsh, 'fragment')
|
||||
local vshader = compileShader(vsh, 'vertex')
|
||||
shaderProgram.program_id = glNode:_createProgram()
|
||||
glNode:_attachShader(shaderProgram.program_id,vshader)
|
||||
glNode:_attachShader(shaderProgram.program_id,fshader)
|
||||
glNode:_linkProgram(shaderProgram.program_id)
|
||||
if not glNode:_getProgramParameter(shaderProgram.program_id, GLConstant.LINK_STATUS) then
|
||||
shaderProgram.program_id = gl.createProgram()
|
||||
gl.attachShader(shaderProgram.program_id,vshader)
|
||||
gl.attachShader(shaderProgram.program_id,fshader)
|
||||
gl.linkProgram(shaderProgram.program_id)
|
||||
if not gl.getProgramParameter(shaderProgram.program_id, gl.LINK_STATUS) then
|
||||
--throw
|
||||
print("Could not initialise shaders")
|
||||
end
|
||||
glNode:_useProgram(shaderProgram.program_id)
|
||||
gl.useProgram(shaderProgram.program_id)
|
||||
|
||||
shaderProgram.vertexPositionAttribute = glNode:_getAttribLocation(shaderProgram.program_id,"aVertexPosition")
|
||||
glNode:enableVertexAttribArray(shaderProgram.vertexPositionAttribute)
|
||||
shaderProgram.vertexPositionAttribute = gl.getAttribLocation(shaderProgram.program_id,"aVertexPosition")
|
||||
gl.enableVertexAttribArray(shaderProgram.vertexPositionAttribute)
|
||||
|
||||
shaderProgram.vertexColorAttribute = glNode:_getAttribLocation(shaderProgram.program_id,"aVertexColor")
|
||||
glNode:enableVertexAttribArray(shaderProgram.vertexColorAttribute)
|
||||
shaderProgram.vertexColorAttribute = gl.getAttribLocation(shaderProgram.program_id,"aVertexColor")
|
||||
gl.enableVertexAttribArray(shaderProgram.vertexColorAttribute)
|
||||
|
||||
shaderProgram.pMatrixUniform = glNode:_getUniformLocation(shaderProgram.program_id, "uPMatrix")
|
||||
shaderProgram.mvMatrixUniform = glNode:_getUniformLocation(shaderProgram.program_id, "uMVMatrix")
|
||||
shaderProgram.pMatrixUniform = gl.getUniformLocation(shaderProgram.program_id, "uPMatrix")
|
||||
shaderProgram.mvMatrixUniform = gl.getUniformLocation(shaderProgram.program_id, "uMVMatrix")
|
||||
|
||||
initBuffers()
|
||||
|
||||
|
@ -972,7 +973,7 @@ local function OpenGLTestMainLayer()
|
|||
local function createGLNodeCCAPITest()
|
||||
local nodeCCAPILayer = CCLayer:create()
|
||||
InitTitle(nodeCCAPILayer)
|
||||
local glNode = GLNode:create()
|
||||
local glNode = gl.glNodeCreate()
|
||||
nodeCCAPILayer:addChild(glNode,10)
|
||||
local shader = CCShaderCache:getInstance():getProgram("ShaderPositionColor")
|
||||
local triangleVertexPositionBuffer = {}
|
||||
|
@ -981,70 +982,70 @@ local function OpenGLTestMainLayer()
|
|||
local squareVertexColorBuffer = {}
|
||||
|
||||
local function initBuffers()
|
||||
triangleVertexPositionBuffer.buffer_id = glNode:_createBuffer()
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, triangleVertexPositionBuffer.buffer_id)
|
||||
triangleVertexPositionBuffer.buffer_id = gl.createBuffer()
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, triangleVertexPositionBuffer.buffer_id)
|
||||
local vertices = {
|
||||
size.width / 2, size.height,
|
||||
0, 0,
|
||||
size.width, 0
|
||||
}
|
||||
glNode:bufferData(GLConstant.ARRAY_BUFFER, table.getn(vertices), vertices, GLConstant.STATIC_DRAW)
|
||||
gl.bufferData(gl.ARRAY_BUFFER, table.getn(vertices), vertices, gl.STATIC_DRAW)
|
||||
|
||||
triangleVertexColorBuffer.buffer_id = glNode:_createBuffer()
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, triangleVertexColorBuffer.buffer_id)
|
||||
triangleVertexColorBuffer.buffer_id = gl.createBuffer()
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, triangleVertexColorBuffer.buffer_id)
|
||||
local colors = {
|
||||
1.0, 0.0, 0.0, 1.0,
|
||||
1.0, 0.0, 0.0, 1.0,
|
||||
1.0, 0.0, 0.0, 1.0
|
||||
}
|
||||
glNode:bufferData(GLConstant.ARRAY_BUFFER, table.getn(colors),colors, GLConstant.STATIC_DRAW)
|
||||
gl.bufferData(gl.ARRAY_BUFFER, table.getn(colors),colors, gl.STATIC_DRAW)
|
||||
|
||||
--Square
|
||||
squareVertexPositionBuffer.buffer_id = glNode:_createBuffer()
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexPositionBuffer.buffer_id)
|
||||
squareVertexPositionBuffer.buffer_id = gl.createBuffer()
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, squareVertexPositionBuffer.buffer_id)
|
||||
vertices = {
|
||||
size.width, size.height,
|
||||
0, size.height,
|
||||
size.width, 0,
|
||||
0, 0
|
||||
}
|
||||
glNode:bufferData(GLConstant.ARRAY_BUFFER, table.getn(vertices), vertices, GLConstant.STATIC_DRAW)
|
||||
gl.bufferData(gl.ARRAY_BUFFER, table.getn(vertices), vertices, gl.STATIC_DRAW)
|
||||
|
||||
squareVertexColorBuffer.buffer_id = glNode:_createBuffer()
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexColorBuffer.buffer_id)
|
||||
squareVertexColorBuffer.buffer_id = gl.createBuffer()
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, squareVertexColorBuffer.buffer_id)
|
||||
colors = {
|
||||
0.0, 0.0, 1.0, 1.0,
|
||||
0.0, 0.0, 1.0, 1.0,
|
||||
0.0, 0.0, 1.0, 1.0,
|
||||
0.0, 0.0, 1.0, 1.0
|
||||
};
|
||||
glNode:bufferData(GLConstant.ARRAY_BUFFER, table.getn(colors), colors, GLConstant.STATIC_DRAW)
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, 0)
|
||||
gl.bufferData(gl.ARRAY_BUFFER, table.getn(colors), colors, gl.STATIC_DRAW)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, 0)
|
||||
end
|
||||
|
||||
local function GLNodeCCAPIDraw()
|
||||
shader:use()
|
||||
shader:setUniformsForBuiltins()
|
||||
glNode:glEnableVertexAttribs(CCConstants.VERTEX_ATTRIB_FLAG_COLOR or CCConstants.VERTEX_ATTRIB_FLAG_POSITION)
|
||||
gl.glEnableVertexAttribs(CCConstants.VERTEX_ATTRIB_FLAG_COLOR or CCConstants.VERTEX_ATTRIB_FLAG_POSITION)
|
||||
|
||||
--
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexPositionBuffer.buffer_id)
|
||||
glNode:vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, GLConstant.FLOAT, false, 0, 0)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, squareVertexPositionBuffer.buffer_id)
|
||||
gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0)
|
||||
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexColorBuffer.buffer_id)
|
||||
glNode:vertexAttribPointer(CCConstants.VERTEX_ATTRIB_COLOR, 4, GLConstant.FLOAT, false, 0, 0)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, squareVertexColorBuffer.buffer_id)
|
||||
gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_COLOR, 4, gl.FLOAT, false, 0, 0)
|
||||
|
||||
glNode:drawArrays(GLConstant.TRIANGLE_STRIP, 0, 4)
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4)
|
||||
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, triangleVertexPositionBuffer.buffer_id)
|
||||
glNode:vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, GLConstant.FLOAT, false, 0, 0)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, triangleVertexPositionBuffer.buffer_id)
|
||||
gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, gl.FLOAT, false, 0, 0)
|
||||
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, triangleVertexColorBuffer.buffer_id)
|
||||
glNode:vertexAttribPointer(CCConstants.VERTEX_ATTRIB_COLOR, 4, GLConstant.FLOAT, false, 0, 0)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, triangleVertexColorBuffer.buffer_id)
|
||||
gl.vertexAttribPointer(CCConstants.VERTEX_ATTRIB_COLOR, 4, gl.FLOAT, false, 0, 0)
|
||||
|
||||
glNode:drawArrays(GLConstant.TRIANGLE_STRIP, 0, 3)
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 3)
|
||||
|
||||
glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, 0)
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, 0)
|
||||
|
||||
end
|
||||
|
||||
|
@ -1057,19 +1058,19 @@ local function OpenGLTestMainLayer()
|
|||
local function createGLTexParamterTest()
|
||||
local glTexParamLayer = CCLayer:create()
|
||||
InitTitle(glTexParamLayer)
|
||||
local glNode = GLNode:create()
|
||||
local glNode = gl.glNodeCreate()
|
||||
glTexParamLayer:addChild(glNode,10)
|
||||
local function getTexValues()
|
||||
glNode:_bindTexture(GLConstant.TEXTURE_2D, 0)
|
||||
glNode:texParameteri(GLConstant.TEXTURE_2D, GLConstant.TEXTURE_MAG_FILTER, GLConstant.NEAREST)
|
||||
glNode:texParameteri(GLConstant.TEXTURE_2D, GLConstant.TEXTURE_MIN_FILTER, GLConstant.NEAREST)
|
||||
glNode:texParameteri( GLConstant.TEXTURE_2D, GLConstant.TEXTURE_WRAP_S, GLConstant.CLAMP_TO_EDGE )
|
||||
glNode:texParameteri( GLConstant.TEXTURE_2D, GLConstant.TEXTURE_WRAP_S, GLConstant.CLAMP_TO_EDGE )
|
||||
gl.bindTexture(gl.TEXTURE_2D, 0)
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST)
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST)
|
||||
gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE )
|
||||
gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE )
|
||||
|
||||
local mag = glNode:getTexParameter(GLConstant.TEXTURE_2D, GLConstant.TEXTURE_MAG_FILTER)
|
||||
local min = glNode:getTexParameter(GLConstant.TEXTURE_2D, GLConstant.TEXTURE_MIN_FILTER)
|
||||
local w_s = glNode:getTexParameter(GLConstant.TEXTURE_2D, GLConstant.TEXTURE_WRAP_S)
|
||||
local w_t = glNode:getTexParameter(GLConstant.TEXTURE_2D, GLConstant.TEXTURE_WRAP_S)
|
||||
local mag = gl.getTexParameter(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER)
|
||||
local min = gl.getTexParameter(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER)
|
||||
local w_s = gl.getTexParameter(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S)
|
||||
local w_t = gl.getTexParameter(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S)
|
||||
local strFmt = string.format("%d %d %d %d",mag,min,w_s,w_t)
|
||||
print(strFmt)
|
||||
end
|
||||
|
@ -1080,7 +1081,7 @@ local function OpenGLTestMainLayer()
|
|||
local function createGetUniformTest()
|
||||
local getUniformLayer = CCLayer:create()
|
||||
InitTitle(getUniformLayer)
|
||||
local glNode = GLNode:create()
|
||||
local glNode = gl.glNodeCreate()
|
||||
getUniformLayer:addChild(glNode,10)
|
||||
local pMatrix = {1,2,3,4, 4,3,2,1, 1,2,4,8, 1.1,1.2,1.3,1.4}
|
||||
|
||||
|
@ -1090,11 +1091,11 @@ local function OpenGLTestMainLayer()
|
|||
|
||||
shader:use()
|
||||
|
||||
local loc = glNode:_getUniformLocation( program, "CC_MVPMatrix")
|
||||
local loc = gl.getUniformLocation( program, "CC_MVPMatrix")
|
||||
|
||||
glNode:uniformMatrix4fv(loc, false, table.getn(pMatrix), pMatrix)
|
||||
gl.uniformMatrix4fv(loc, false, table.getn(pMatrix), pMatrix)
|
||||
|
||||
local uniformTable = glNode:_getUniform( program, loc )
|
||||
local uniformTable = gl.getUniform( program, loc )
|
||||
local count = table.getn(uniformTable)
|
||||
local strFmt = ""
|
||||
for i=1,count do
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8"/>
|
||||
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="9"/>
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
|
||||
<application android:label="@string/app_name"
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-8
|
||||
target=android-10
|
||||
|
||||
android.library.reference.1=../../../../cocos2dx/platform/android/java
|
||||
|
|
|
@ -73,16 +73,16 @@
|
|||
15C156951683138E00D239F2 /* Icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-72.png"; sourceTree = SOURCE_ROOT; };
|
||||
15C156961683138E00D239F2 /* Icon-114.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-114.png"; sourceTree = SOURCE_ROOT; };
|
||||
15C156971683138E00D239F2 /* Icon-144.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-144.png"; sourceTree = SOURCE_ROOT; };
|
||||
1A6E48E217781C2B0055514D /* libBox2D.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libBox2D.a; path = "../../../../external/Box2D/proj.ios/build/Release-iphoneos/libBox2D.a"; sourceTree = "<group>"; };
|
||||
1A6E48E317781C2B0055514D /* libchipmunk.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libchipmunk.a; path = "../../../../external/chipmunk/proj.ios/build/Release-iphoneos/libchipmunk.a"; sourceTree = "<group>"; };
|
||||
1A6E48E417781C2B0055514D /* libcocos2dx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcocos2dx.a; path = "../../../../cocos2dx/proj.ios/build/Release-iphoneos/libcocos2dx.a"; sourceTree = "<group>"; };
|
||||
1A6E48E517781C2B0055514D /* libCocosDenshion.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libCocosDenshion.a; path = "../../../../CocosDenshion/proj.ios/build/Release-iphoneos/libCocosDenshion.a"; sourceTree = "<group>"; };
|
||||
1A6E48E717781C2B0055514D /* libluabindings.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libluabindings.a; path = "../../../../scripting/lua/proj.ios/build/Release-iphoneos/libluabindings.a"; sourceTree = "<group>"; };
|
||||
1A6E48E217781C2B0055514D /* libBox2D.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libBox2D.a; path = "libBox2D.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E48E317781C2B0055514D /* libchipmunk.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libchipmunk.a; path = "libchipmunk.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E48E417781C2B0055514D /* libcocos2dx.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libcocos2dx.a; path = "libcocos2dx.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E48E517781C2B0055514D /* libCocosDenshion.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libCocosDenshion.a; path = "libCocosDenshion.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E48E717781C2B0055514D /* libluabindings.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libluabindings.a; path = "libluabindings.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1A6E48F717781F9F0055514D /* AudioEngine.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AudioEngine.lua; sourceTree = "<group>"; };
|
||||
1A6E48F817781F9F0055514D /* CCBReaderLoad.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CCBReaderLoad.lua; sourceTree = "<group>"; };
|
||||
1A6E48F917781F9F0055514D /* Cocos2dConstants.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cocos2dConstants.lua; sourceTree = "<group>"; };
|
||||
1A6E48FA17781F9F0055514D /* OpenglConstants.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = OpenglConstants.lua; sourceTree = "<group>"; };
|
||||
1A6E48FF177821AF0055514D /* libextensions.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libextensions.a; path = "../../../../extensions/proj.ios/build/Release-iphoneos/libextensions.a"; sourceTree = "<group>"; };
|
||||
1A6E48FF177821AF0055514D /* libextensions.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libextensions.a; path = "libextensions.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1AD263A1168350490089000C /* luaScript */ = {isa = PBXFileReference; lastKnownFileType = folder; name = luaScript; path = ../../../Lua/TestLua/Resources/luaScript; sourceTree = "<group>"; };
|
||||
1AD263A31683506C0089000C /* animations */ = {isa = PBXFileReference; lastKnownFileType = folder; path = animations; sourceTree = "<group>"; };
|
||||
1AD263A41683506C0089000C /* app.icf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = app.icf; sourceTree = "<group>"; };
|
||||
|
|
|
@ -1 +1 @@
|
|||
e110ce7b59357a987fd5383cd1aa89f254db2d45
|
||||
fb7e01e5b657a41142a4774075e84a7436010de3
|
|
@ -0,0 +1,299 @@
|
|||
require "OpenglConstants"
|
||||
|
||||
gl = gl or {}
|
||||
|
||||
--Create functions
|
||||
function gl.createTexture()
|
||||
local retTable = {}
|
||||
retTable.texture_id = gl._createTexture()
|
||||
return retTable
|
||||
end
|
||||
|
||||
function gl.createBuffer()
|
||||
local retTable = {}
|
||||
retTable.buffer_id = gl._createBuffer()
|
||||
return retTable
|
||||
end
|
||||
|
||||
function gl.createRenderbuffer()
|
||||
local retTable = {}
|
||||
retTable.renderbuffer_id = gl._createRenderuffer()
|
||||
return retTable
|
||||
end
|
||||
|
||||
function gl.createFramebuffer( )
|
||||
local retTable = {}
|
||||
retTable.framebuffer_id = gl._createFramebuffer()
|
||||
return retTable
|
||||
end
|
||||
|
||||
function gl.createProgram()
|
||||
local retTable = {}
|
||||
retTable.program_id = gl._createProgram()
|
||||
return retTable
|
||||
end
|
||||
|
||||
function gl.createShader(shaderType)
|
||||
local retTable = {}
|
||||
retTable.shader_id = gl._createShader(shaderType)
|
||||
return retTable
|
||||
end
|
||||
|
||||
--Delete Fun
|
||||
function gl.deleteTexture(texture)
|
||||
local texture_id = 0
|
||||
if "number" == type(texture) then
|
||||
texture_id = texture
|
||||
elseif "table" == type(texture) then
|
||||
texture_id = texture.texture_id
|
||||
end
|
||||
gl._deleteTexture(texture_id)
|
||||
end
|
||||
|
||||
function gl.deleteBuffer(buffer)
|
||||
local buffer_id = 0
|
||||
if "number" == type(buffer) then
|
||||
buffer_id = buffer
|
||||
elseif "table" == type(buffer) then
|
||||
buffer_id = buffer.buffer_id
|
||||
end
|
||||
gl._deleteBuffer(buffer_id)
|
||||
end
|
||||
|
||||
function gl.deleteRenderbuffer(buffer)
|
||||
local renderbuffer_id = 0
|
||||
if "number" == type(buffer) then
|
||||
renderbuffer_id = buffer
|
||||
elseif "table" == type(buffer) then
|
||||
renderbuffer_id = buffer.renderbuffer_id
|
||||
end
|
||||
gl._deleteRenderbuffer(renderbuffer_id)
|
||||
end
|
||||
|
||||
function gl.deleteFramebuffer(buffer)
|
||||
local framebuffer_id = 0
|
||||
if "number" == type(buffer) then
|
||||
framebuffer_id = buffer
|
||||
elseif "table" == type(buffer) then
|
||||
framebuffer_id = buffer.framebuffer_id
|
||||
end
|
||||
gl._deleteFramebuffer(framebuffer_id)
|
||||
end
|
||||
|
||||
function gl.deleteProgram( program )
|
||||
local program_id = 0
|
||||
if "number" == type(buffer) then
|
||||
program_id = program
|
||||
elseif "table" == type(program) then
|
||||
program_id = program.program_id
|
||||
end
|
||||
|
||||
gl._deleteProgram(program_id)
|
||||
end
|
||||
|
||||
function gl.deleteShader(shader)
|
||||
local shader_id = 0
|
||||
if "number" == type(shader) then
|
||||
shader_id = shader
|
||||
elseif "table" == type(shader) then
|
||||
shader_id = shader.shader_id
|
||||
end
|
||||
|
||||
gl._deleteShader(shader_id)
|
||||
end
|
||||
|
||||
--Bind Related
|
||||
function gl.bindTexture(target, texture)
|
||||
local texture_id = 0
|
||||
if "number" == type(texture) then
|
||||
texture_id = texture
|
||||
elseif "table" == type(texture) then
|
||||
texture_id = texture.texture_id
|
||||
end
|
||||
|
||||
gl._bindTexture(target,texture_id)
|
||||
end
|
||||
|
||||
function gl.bindBuffer( target,buffer )
|
||||
local buffer_id = 0
|
||||
if "number" == type(buffer) then
|
||||
buffer_id = buffer
|
||||
elseif "table" == type(buffer) then
|
||||
buffer_id = buffer.buffer_id
|
||||
end
|
||||
|
||||
gl._bindBuffer(target, buffer_id)
|
||||
end
|
||||
|
||||
function gl.bindRenderBuffer(target, buffer)
|
||||
local buffer_id = 0
|
||||
|
||||
if "number" == type(buffer) then
|
||||
buffer_id = buffer;
|
||||
elseif "table" == type(buffer) then
|
||||
buffer_id = buffer.buffer_id
|
||||
end
|
||||
|
||||
gl._bindRenderbuffer(target, buffer_id)
|
||||
end
|
||||
|
||||
function gl.bindFramebuffer(target, buffer)
|
||||
local buffer_id = 0
|
||||
|
||||
if "number" == type(buffer) then
|
||||
buffer_id = buffer
|
||||
elseif "table" == type(buffer) then
|
||||
buffer_id = buffer.buffer_id
|
||||
end
|
||||
|
||||
gl._bindFramebuffer(target, buffer_id)
|
||||
end
|
||||
|
||||
--Uniform related
|
||||
function gl.getUniform(program, location)
|
||||
local program_id = 0
|
||||
local location_id = 0
|
||||
|
||||
if "number" == type(program) then
|
||||
program_id = program
|
||||
else
|
||||
program_id = program.program_id
|
||||
end
|
||||
|
||||
if "number" == type(location) then
|
||||
location_id = location
|
||||
else
|
||||
location_id = location.location_id
|
||||
end
|
||||
|
||||
return gl._getUniform(program_id, location_id)
|
||||
end
|
||||
|
||||
--shader related
|
||||
function gl.compileShader(shader)
|
||||
gl._compileShader( shader.shader_id)
|
||||
end
|
||||
|
||||
function gl.shaderSource(shader, source)
|
||||
gl._shaderSource(shader.shader_id, source)
|
||||
end
|
||||
|
||||
function gl.getShaderParameter(shader, e)
|
||||
return gl._getShaderParameter(shader.shader_id,e)
|
||||
end
|
||||
|
||||
function gl.getShaderInfoLog( shader )
|
||||
return gl._getShaderInfoLog(shader.shader_id)
|
||||
end
|
||||
|
||||
--program related
|
||||
function gl.attachShader( program, shader )
|
||||
local program_id = 0
|
||||
|
||||
if "number" == type(program) then
|
||||
program_id = program
|
||||
elseif "table" == type(program) then
|
||||
program_id = program.program_id
|
||||
end
|
||||
|
||||
gl._attachShader(program_id, shader.shader_id)
|
||||
end
|
||||
|
||||
function gl.linkProgram( program )
|
||||
local program_id = 0
|
||||
|
||||
if "number" == type(program) then
|
||||
program_id = program
|
||||
elseif "table" == type(program) then
|
||||
program_id = program.program_id
|
||||
end
|
||||
|
||||
gl._linkProgram(program_id)
|
||||
end
|
||||
|
||||
function gl.getProgramParameter(program, e)
|
||||
local program_id = 0
|
||||
|
||||
if "number" == type(program) then
|
||||
program_id = program
|
||||
elseif "table" == type(program) then
|
||||
program_id = program.program_id
|
||||
end
|
||||
|
||||
return gl._getProgramParameter(program_id, e)
|
||||
end
|
||||
|
||||
function gl.useProgram(program)
|
||||
local program_id = 0
|
||||
if "number" == type(program) then
|
||||
program_id = program
|
||||
elseif "table" == type(program) then
|
||||
program_id = program.program_id
|
||||
end
|
||||
|
||||
gl._useProgram (program_id)
|
||||
end
|
||||
|
||||
function gl.getAttribLocation(program, name )
|
||||
local program_id = 0
|
||||
|
||||
if "number" == type(program) then
|
||||
program_id = program
|
||||
elseif "table" == type(program) then
|
||||
program_id = program.program_id
|
||||
end
|
||||
|
||||
return gl._getAttribLocation(program_id, name)
|
||||
end
|
||||
|
||||
function gl.getUniformLocation( program, name )
|
||||
local program_id = 0
|
||||
|
||||
if "number" == type(program) then
|
||||
program_id = program
|
||||
elseif "table" == type(program) then
|
||||
program_id = program.program_id
|
||||
end
|
||||
|
||||
return gl._getUniformLocation(program_id,name)
|
||||
end
|
||||
|
||||
function gl.getActiveAttrib( program, index )
|
||||
local program_id = 0
|
||||
if "number" == type(program) then
|
||||
program_id = program
|
||||
elseif "table" == type(program) then
|
||||
program_id = program.program_id
|
||||
end
|
||||
|
||||
return gl._getActiveAttrib(program_id, index);
|
||||
end
|
||||
|
||||
function gl.getActiveUniform( program, index )
|
||||
local program_id = 0
|
||||
|
||||
if "number" == type(program) then
|
||||
program_id = program
|
||||
elseif "table" == type(program) then
|
||||
program_id = program.program_id
|
||||
end
|
||||
|
||||
return gl._getActiveUniform(program_id, index)
|
||||
end
|
||||
|
||||
function gl.getAttachedShaders(program)
|
||||
local program_id = 0
|
||||
|
||||
if "number" == type(program) then
|
||||
program_id = program
|
||||
elseif "table" == type(program) then
|
||||
program_id = program.program_id
|
||||
end
|
||||
|
||||
return gl._getAttachedShaders(program_id)
|
||||
end
|
||||
|
||||
function gl.glNodeCreate()
|
||||
return GLNode:create()
|
||||
end
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -4,7 +4,7 @@
|
|||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<uses-sdk android:minSdkVersion="8"/>
|
||||
<uses-sdk android:minSdkVersion="9"/>
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
|
||||
<application android:label="@string/app_name"
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-8
|
||||
target=android-10
|
||||
|
||||
android.library.reference.1=../../../cocos2dx/platform/android/java
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8"/>
|
||||
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="9"/>
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
|
||||
<application android:label="@string/app_name"
|
||||
|
|
|
@ -11,8 +11,7 @@ LLVM_PACKAGE=""
|
|||
LLVM_PACKAGE_SUFFIX=""
|
||||
|
||||
mkdir -p $HOME/bin
|
||||
pushd $HOME/bin
|
||||
|
||||
cd $HOME/bin
|
||||
|
||||
install_android_ndk()
|
||||
{
|
||||
|
@ -40,7 +39,7 @@ install_llvm()
|
|||
LLVM_PACKAGE="clang+llvm-3.3-Ubuntu-13.04-x86_64-linux-gnu"
|
||||
LLVM_PACKAGE_SUFFIX=".tar.bz2"
|
||||
fi
|
||||
|
||||
|
||||
# Download llvm
|
||||
echo "Download ${LLVM_PACKAGE} ..."
|
||||
curl -O http://llvm.org/releases/${LLVM_VERSION}/${LLVM_PACKAGE}${LLVM_PACKAGE_SUFFIX}
|
||||
|
@ -50,7 +49,7 @@ install_llvm()
|
|||
else
|
||||
tar xjf ${LLVM_PACKAGE}${LLVM_PACKAGE_SUFFIX}
|
||||
fi
|
||||
|
||||
|
||||
# Rename llvm
|
||||
mv ${LLVM_PACKAGE} clang+llvm-${LLVM_VERSION}
|
||||
}
|
||||
|
@ -71,49 +70,49 @@ install_llvm_3_2()
|
|||
mv clang+llvm-3.2-x86_64-${HOST_NAME} clang+llvm-3.2
|
||||
}
|
||||
|
||||
install_nacl_sdk()
|
||||
{
|
||||
# NaCl compilers are built for 32-bit linux so we need to install
|
||||
# the runtime support for this.
|
||||
if [ ! -e "/lib/ld-linux.so.2" ]; then
|
||||
sudo apt-get update
|
||||
sudo apt-get install libc6:i386 libstdc++6:i386
|
||||
fi
|
||||
if [ ! -d nacl_sdl ]; then
|
||||
echo "Download nacl_sdk ..."
|
||||
wget http://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/nacl_sdk.zip
|
||||
echo "Decompress nacl_sdk.zip"
|
||||
unzip nacl_sdk.zip
|
||||
fi
|
||||
nacl_sdk/naclsdk update --force pepper_canary
|
||||
}
|
||||
|
||||
if [ "$GEN_JSB"x = "YES"x ]; then
|
||||
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
|
||||
exit 0
|
||||
fi
|
||||
install_android_ndk
|
||||
install_llvm
|
||||
fi
|
||||
|
||||
if [ "$PLATFORM"x = "linux"x ]; then
|
||||
elif [ "$PLATFORM"x = "linux"x ]; then
|
||||
bash $COCOS2DX_ROOT/install-deps-linux.sh
|
||||
fi
|
||||
|
||||
if [ "$PLATFORM"x = "nacl"x ]; then
|
||||
# NaCl compilers are built for 32-bit linux so we need to install
|
||||
# the runtime support for this.
|
||||
sudo apt-get update
|
||||
sudo apt-get install libc6:i386 libstdc++6:i386
|
||||
echo "Download nacl_sdk ..."
|
||||
wget http://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/nacl_sdk.zip
|
||||
echo "Decompress nacl_sdk.zip"
|
||||
unzip nacl_sdk.zip
|
||||
nacl_sdk/naclsdk update --force pepper_canary
|
||||
fi
|
||||
|
||||
if [ "$PLATFORM"x = "android"x ]; then
|
||||
elif [ "$PLATFORM"x = "nacl"x ]; then
|
||||
install_nacl_sdk
|
||||
elif [ "$PLATFORM"x = "android"x ]; then
|
||||
install_android_ndk
|
||||
install_llvm
|
||||
fi
|
||||
|
||||
if [ "$PLATFORM"x = "emscripten"x ]; then
|
||||
elif [ "$PLATFORM"x = "emscripten"x ]; then
|
||||
sudo rm -rf /dev/shm && sudo ln -s /run/shm /dev/shm
|
||||
install_llvm_3_2
|
||||
fi
|
||||
|
||||
if [ "$PLATFORM"x = "ios"x ]; then
|
||||
elif [ "$PLATFORM"x = "ios"x ]; then
|
||||
install_android_ndk
|
||||
install_llvm
|
||||
|
||||
|
||||
pushd $COCOS2DX_ROOT
|
||||
git submodule add https://github.com/facebook/xctool.git ./xctool
|
||||
git submodule init
|
||||
git submodule update
|
||||
popd
|
||||
else
|
||||
echo "Unknown \$PLATFORM: '$PLATFORM'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
popd
|
||||
|
|
|
@ -49,14 +49,13 @@ if [ "$GEN_JSB"x != "YES"x ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
#Set git user
|
||||
git config --global user.email ${GH_EMAIL}
|
||||
git config --global user.name ${GH_USER}
|
||||
|
||||
# Update submodule of auto-gen JSBinding repo.
|
||||
pushd "$GENERATED_WORKTREE"
|
||||
|
||||
git checkout -B master
|
||||
#Set git user
|
||||
git config user.email ${GH_EMAIL}
|
||||
git config user.name ${GH_USER}
|
||||
#Set remotes
|
||||
git remote add upstream https://${GH_USER}:${GH_PASSWORD}@github.com/folecr/cocos2dx-autogen-bindings.git 2> /dev/null > /dev/null
|
||||
|
||||
|
|
|
@ -5,14 +5,6 @@ set -e
|
|||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
COCOS2DX_ROOT="$DIR"/../..
|
||||
|
||||
if [ "$GEN_JSB"x = "YES"x ]; then
|
||||
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
|
||||
exit 0
|
||||
fi
|
||||
cd $COCOS2DX_ROOT/tools/travis-scripts
|
||||
./generate-jsbindings.sh
|
||||
fi
|
||||
|
||||
build_android()
|
||||
{
|
||||
cd $COCOS2DX_ROOT/samples/$1/$2/proj.android
|
||||
|
@ -20,10 +12,35 @@ build_android()
|
|||
./build_native.sh
|
||||
}
|
||||
|
||||
if [ "$PLATFORM"x = "android"x ]; then
|
||||
if [ "$GEN_JSB"x = "YES"x ]; then
|
||||
# Re-generation of the javascript bindings can perform push of the new
|
||||
# version back to github. We don't do this for pull requests, or if
|
||||
# GH_USER/GH_EMAIL/GH_PASSWORD environment variables are not set correctly
|
||||
# by the encoded variables in the .travis.yml file. (e.g. if cloned repo's
|
||||
# want to use travis).
|
||||
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
|
||||
exit 0
|
||||
fi
|
||||
if [ -z "${GH_EMAIL}" ]; then
|
||||
echo "GH_EMAIL not set"
|
||||
exit 0
|
||||
fi
|
||||
if [ -z "${GH_USER}" ]; then
|
||||
echo "GH_USER not set"
|
||||
exit 0
|
||||
fi
|
||||
if [ -z "${GH_PASSWORD}" ]; then
|
||||
echo "GH_USER not set"
|
||||
exit 0
|
||||
fi
|
||||
export NDK_ROOT=$HOME/bin/android-ndk
|
||||
cd $COCOS2DX_ROOT/tools/travis-scripts
|
||||
./generate-jsbindings.sh
|
||||
|
||||
elif [ "$PLATFORM"x = "android"x ]; then
|
||||
export NDK_ROOT=$HOME/bin/android-ndk
|
||||
cd $COCOS2DX_ROOT/tools/travis-scripts
|
||||
./generate-jsbindings.sh
|
||||
|
||||
cd $COCOS2DX_ROOT
|
||||
mkdir android_build_objs
|
||||
build_android Cpp HelloCpp
|
||||
|
@ -32,19 +49,16 @@ if [ "$PLATFORM"x = "android"x ]; then
|
|||
build_android Javascript TestJavascript
|
||||
build_android Lua HelloLua
|
||||
build_android Lua TestLua
|
||||
fi
|
||||
|
||||
if [ "$PLATFORM"x = "nacl"x ]; then
|
||||
elif [ "$PLATFORM"x = "nacl"x ]; then
|
||||
export NACL_SDK_ROOT=$HOME/bin/nacl_sdk/pepper_canary
|
||||
export PATH=$PATH:$NACL_SDK_ROOT/toolchain/linux_x86_newlib/bin
|
||||
export PATH=$PATH:$NACL_SDK_ROOT/toolchain/linux_arm_newlib/bin
|
||||
cd $COCOS2DX_ROOT
|
||||
make -j4
|
||||
fi
|
||||
|
||||
if [ "$PLATFORM"x = "linux"x ]; then
|
||||
elif [ "$PLATFORM"x = "linux"x ]; then
|
||||
cd $COCOS2DX_ROOT
|
||||
make -j4
|
||||
fi
|
||||
|
||||
if [ "$PLATFORM"x = "emscripten"x ]; then
|
||||
elif [ "$PLATFORM"x = "emscripten"x ]; then
|
||||
cd $COCOS2DX_ROOT
|
||||
export PYTHON=/usr/bin/python
|
||||
export LLVM=$HOME/bin/clang+llvm-3.2/bin
|
||||
|
@ -52,9 +66,7 @@ if [ "$PLATFORM"x = "emscripten"x ]; then
|
|||
sudo mkdir -p /Library/Fonts
|
||||
sudo cp samples/Cpp/TestCpp/Resources/fonts/arial.ttf /Library/Fonts/Arial.ttf
|
||||
EMCC_DEBUG=1 make -f Makefile.emscripten -j 8
|
||||
fi
|
||||
|
||||
if [ "$PLATFORM"x = "ios"x ]; then
|
||||
elif [ "$PLATFORM"x = "ios"x ]; then
|
||||
cd $COCOS2DX_ROOT/tools/travis-scripts
|
||||
./generate-jsbindings.sh
|
||||
|
||||
|
@ -70,4 +82,7 @@ if [ "$PLATFORM"x = "ios"x ]; then
|
|||
#xctool/xctool.sh -project samples/Javascript/WatermelonWithMe/proj.ios/WatermelonWithMe.xcodeproj -scheme WatermelonWithMe test
|
||||
xctool/xctool.sh -project samples/Lua/HelloLua/proj.ios/HelloLua.xcodeproj -scheme HelloLua test
|
||||
xctool/xctool.sh -project samples/Lua/TestLua/proj.ios/TestLua.xcodeproj -scheme TestLua test
|
||||
else
|
||||
echo "Unknown \$PLATFORM: '$PLATFORM'"
|
||||
exit 1
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue