Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into ccx_filesystem

This commit is contained in:
minggo 2013-06-26 14:02:16 +08:00
commit f531842735
36 changed files with 1688 additions and 2938 deletions

View File

@ -62,6 +62,7 @@ Developers:
Added __attribute__(__format__()) for CCLog and CCString
Refactoring network extension and fixing unlikely memory leaks.
Adding PUT/DELETE methods for CCHttpRequest.
Adding project part for QtCreator.
savdalion
Added example for russian language in TestCpp
@ -358,6 +359,7 @@ Developers:
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.
Refactoring emscripten building script.
Peter Young (young40)
Implements setVisible() for CCEditBox

View File

@ -0,0 +1,20 @@
################################################################################
# Do not include this file in your project: see cocos2dx.pri.
################################################################################
linux {
# We will compile extensions on demand using Makefile.
build_CocosDension.name = Build extension static library
build_CocosDension.input = $$PWD/Makefile
build_CocosDension.output = $$CC_LIBRARY_DIR/libcocosdenshion.so
build_CocosDension.target = $$CC_LIBRARY_DIR/libcocosdenshion.so
build_CocosDension.CONFIG = no_link target_predeps
build_CocosDension.commands = cd $$PWD && make $$CC_MAKE_FLAGS
QMAKE_EXTRA_COMPILERS += build_CocosDension
QMAKE_EXTRA_TARGETS += build_CocosDension
PRE_TARGETDEPS += $$CC_LIBRARY_DIR/libcocosdenshion.so
LIBS += -lcocosdenshion
}

View File

@ -1,6 +1,6 @@
PLATFORM ?= linux
define MAKE_TARGET
define MAKE_TARGETS
+$(MAKE) -C external/chipmunk/proj.$(PLATFORM) $@
+$(MAKE) -C external/Box2D/proj.$(PLATFORM) $@
+$(MAKE) -C CocosDenshion/proj.$(PLATFORM) $@
@ -10,14 +10,22 @@ define MAKE_TARGET
+$(MAKE) -C samples/Cpp/HelloCpp/proj.$(PLATFORM) $@
+$(MAKE) -C samples/Cpp/TestCpp/proj.$(PLATFORM) $@
+$(MAKE) -C samples/Cpp/SimpleGame/proj.$(PLATFORM) $@
endef
# Haven't yet got the lua projects working with emscripten
ifneq ($(PLATFORM),emscripten)
define MAKE_LUA
+$(MAKE) -C samples/Lua/HelloLua/proj.$(PLATFORM) $@
+$(MAKE) -C samples/Lua/TestLua/proj.$(PLATFORM) $@
endef
endif
all:
$(call MAKE_TARGET,all)
$(call MAKE_TARGETS,all)
$(call MAKE_LUA,all)
clean:
$(call MAKE_TARGET,clean)
$(call MAKE_TARGETS,clean)
$(call MAKE_LUA,clean)
.PHONY: all clean

View File

@ -1,26 +0,0 @@
PLATFORM = emscripten
define MAKE_TARGET
+$(MAKE) -C external/chipmunk/proj.$(PLATFORM) $@
+$(MAKE) -C external/Box2D/proj.$(PLATFORM) $@
+$(MAKE) -C CocosDenshion/proj.$(PLATFORM) $@
+$(MAKE) -C extensions/proj.$(PLATFORM) $@
+$(MAKE) -C cocos2dx/proj.$(PLATFORM) $@
+$(MAKE) -C scripting/lua/proj.$(PLATFORM) $@
+$(MAKE) -C samples/Cpp/HelloCpp/proj.$(PLATFORM) $@
+$(MAKE) -C samples/Cpp/TestCpp/proj.$(PLATFORM) $@
+$(MAKE) -C samples/Cpp/SimpleGame/proj.$(PLATFORM) $@
endef
# Haven't yet got the lua projects working.
# +$(MAKE) -C samples/Lua/HelloLua/proj.$(PLATFORM) $@
# +$(MAKE) -C samples/Lua/TestLua/proj.$(PLATFORM) $@
all:
$(call MAKE_TARGET,all)
clean:
$(call MAKE_TARGET,clean)
.PHONY: all clean

23
build-emscripten.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
# Build script to build all components for emscripten.
#
# By default this script will build the 'all' target in
# both debug and release configurations. Pass "clean" to
# clean all configuration.
#
# This script expects llvm-3.2 to be installed in
# $HOME/bin/clang+llvm-3.2.
SCRIPT_DIR=$(dirname ${BASH_SOURCE})
set -e
set -x
cd $SCRIPT_DIR
export PYTHON=/usr/bin/python
export LLVM=$HOME/bin/clang+llvm-3.2/bin
export LLVM_ROOT=$LLVM
make PLATFORM=emscripten DEBUG=1 -j10 $*
make PLATFORM=emscripten DEBUG=0 -j10 $*

View File

@ -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>

File diff suppressed because it is too large Load Diff

View File

@ -1,178 +0,0 @@
/*
* Module: sched.h
*
* Purpose:
* Provides an implementation of POSIX realtime extensions
* as defined in
*
* POSIX 1003.1b-1993 (POSIX.1b)
*
* --------------------------------------------------------------------------
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
* Copyright(C) 1999,2005 Pthreads-win32 contributors
*
* Contact Email: rpj@callisto.canberra.edu.au
*
* The current list of contributors is contained
* in the file CONTRIBUTORS included with the source
* code distribution. The list can also be seen at the
* following World Wide Web location:
* http://sources.redhat.com/pthreads-win32/contributors.html
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library in the file COPYING.LIB;
* if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifndef _SCHED_H
#define _SCHED_H
#undef PTW32_LEVEL
#if defined(_POSIX_SOURCE)
#define PTW32_LEVEL 0
/* Early POSIX */
#endif
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
#undef PTW32_LEVEL
#define PTW32_LEVEL 1
/* Include 1b, 1c and 1d */
#endif
#if defined(INCLUDE_NP)
#undef PTW32_LEVEL
#define PTW32_LEVEL 2
/* Include Non-Portable extensions */
#endif
#define PTW32_LEVEL_MAX 3
#if !defined(PTW32_LEVEL)
#define PTW32_LEVEL PTW32_LEVEL_MAX
/* Include everything */
#endif
#if __GNUC__ && ! defined (__declspec)
# error Please upgrade your GNU compiler to one that supports __declspec.
#endif
/*
* When building the DLL code, you should define PTW32_BUILD so that
* the variables/functions are exported correctly. When using the DLL,
* do NOT define PTW32_BUILD, and then the variables/functions will
* be imported correctly.
*/
#ifndef PTW32_STATIC_LIB
# ifdef PTW32_BUILD
# define PTW32_DLLPORT __declspec (dllexport)
# else
# define PTW32_DLLPORT __declspec (dllimport)
# endif
#else
# define PTW32_DLLPORT
#endif
/*
* This is a duplicate of what is in the autoconf config.h,
* which is only used when building the pthread-win32 libraries.
*/
#ifndef PTW32_CONFIG_H
# if defined(WINCE)
# define NEED_ERRNO
# define NEED_SEM
# endif
# if defined(_UWIN) || defined(__MINGW32__)
# define HAVE_MODE_T
# endif
#endif
/*
*
*/
#if PTW32_LEVEL >= PTW32_LEVEL_MAX
#ifdef NEED_ERRNO
#include "need_errno.h"
#else
#include <errno.h>
#endif
#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
#if defined(__MINGW32__) || defined(_UWIN)
#if PTW32_LEVEL >= PTW32_LEVEL_MAX
/* For pid_t */
# include <sys/types.h>
/* Required by Unix 98 */
# include <time.h>
#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
#else
typedef int pid_t;
#endif
/* Thread scheduling policies */
enum {
SCHED_OTHER = 0,
SCHED_FIFO,
SCHED_RR,
SCHED_MIN = SCHED_OTHER,
SCHED_MAX = SCHED_RR
};
struct sched_param {
int sched_priority;
};
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
PTW32_DLLPORT int __cdecl sched_yield (void);
PTW32_DLLPORT int __cdecl sched_get_priority_min (int policy);
PTW32_DLLPORT int __cdecl sched_get_priority_max (int policy);
PTW32_DLLPORT int __cdecl sched_setscheduler (pid_t pid, int policy);
PTW32_DLLPORT int __cdecl sched_getscheduler (pid_t pid);
/*
* Note that this macro returns ENOTSUP rather than
* ENOSYS as might be expected. However, returning ENOSYS
* should mean that sched_get_priority_{min,max} are
* not implemented as well as sched_rr_get_interval.
* This is not the case, since we just don't support
* round-robin scheduling. Therefore I have chosen to
* return the same value as sched_setscheduler when
* SCHED_RR is passed to it.
*/
#define sched_rr_get_interval(_pid, _interval) \
( errno = ENOTSUP, (int) -1 )
#ifdef __cplusplus
} /* End of extern "C" */
#endif /* __cplusplus */
#undef PTW32_LEVEL
#undef PTW32_LEVEL_MAX
#endif /* !_SCHED_H */

View File

@ -1,166 +0,0 @@
/*
* Module: semaphore.h
*
* Purpose:
* Semaphores aren't actually part of the PThreads standard.
* They are defined by the POSIX Standard:
*
* POSIX 1003.1b-1993 (POSIX.1b)
*
* --------------------------------------------------------------------------
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
* Copyright(C) 1999,2005 Pthreads-win32 contributors
*
* Contact Email: rpj@callisto.canberra.edu.au
*
* The current list of contributors is contained
* in the file CONTRIBUTORS included with the source
* code distribution. The list can also be seen at the
* following World Wide Web location:
* http://sources.redhat.com/pthreads-win32/contributors.html
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library in the file COPYING.LIB;
* if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined( SEMAPHORE_H )
#define SEMAPHORE_H
#undef PTW32_LEVEL
#if defined(_POSIX_SOURCE)
#define PTW32_LEVEL 0
/* Early POSIX */
#endif
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
#undef PTW32_LEVEL
#define PTW32_LEVEL 1
/* Include 1b, 1c and 1d */
#endif
#if defined(INCLUDE_NP)
#undef PTW32_LEVEL
#define PTW32_LEVEL 2
/* Include Non-Portable extensions */
#endif
#define PTW32_LEVEL_MAX 3
#if !defined(PTW32_LEVEL)
#define PTW32_LEVEL PTW32_LEVEL_MAX
/* Include everything */
#endif
#if __GNUC__ && ! defined (__declspec)
# error Please upgrade your GNU compiler to one that supports __declspec.
#endif
/*
* When building the DLL code, you should define PTW32_BUILD so that
* the variables/functions are exported correctly. When using the DLL,
* do NOT define PTW32_BUILD, and then the variables/functions will
* be imported correctly.
*/
#ifndef PTW32_STATIC_LIB
# ifdef PTW32_BUILD
# define PTW32_DLLPORT __declspec (dllexport)
# else
# define PTW32_DLLPORT __declspec (dllimport)
# endif
#else
# define PTW32_DLLPORT
#endif
/*
* This is a duplicate of what is in the autoconf config.h,
* which is only used when building the pthread-win32 libraries.
*/
#ifndef PTW32_CONFIG_H
# if defined(WINCE)
# define NEED_ERRNO
# define NEED_SEM
# endif
# if defined(_UWIN) || defined(__MINGW32__)
# define HAVE_MODE_T
# endif
#endif
/*
*
*/
#if PTW32_LEVEL >= PTW32_LEVEL_MAX
#ifdef NEED_ERRNO
#include "need_errno.h"
#else
#include <errno.h>
#endif
#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
#define _POSIX_SEMAPHORES
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#ifndef HAVE_MODE_T
typedef unsigned int mode_t;
#endif
typedef struct sem_t_ * sem_t;
PTW32_DLLPORT int __cdecl sem_init (sem_t * sem,
int pshared,
unsigned int value);
PTW32_DLLPORT int __cdecl sem_destroy (sem_t * sem);
PTW32_DLLPORT int __cdecl sem_trywait (sem_t * sem);
PTW32_DLLPORT int __cdecl sem_wait (sem_t * sem);
PTW32_DLLPORT int __cdecl sem_timedwait (sem_t * sem,
const struct timespec * abstime);
PTW32_DLLPORT int __cdecl sem_post (sem_t * sem);
PTW32_DLLPORT int __cdecl sem_post_multiple (sem_t * sem,
int count);
PTW32_DLLPORT int __cdecl sem_open (const char * name,
int oflag,
mode_t mode,
unsigned int value);
PTW32_DLLPORT int __cdecl sem_close (sem_t * sem);
PTW32_DLLPORT int __cdecl sem_unlink (const char * name);
PTW32_DLLPORT int __cdecl sem_getvalue (sem_t * sem,
int * sval);
#ifdef __cplusplus
} /* End of extern "C" */
#endif /* __cplusplus */
#undef PTW32_LEVEL
#undef PTW32_LEVEL_MAX
#endif /* !SEMAPHORE_H */

View File

@ -31,7 +31,7 @@ JSLIBS := --js-library $(COCOS_SRC)/platform/emscripten/CCTextureCacheEmscripten
CCFLAGS += -MMD -Wall -fPIC -Qunused-arguments -Wno-overloaded-virtual -Qunused-variable -s TOTAL_MEMORY=268435456 -s VERBOSE=1 -U__native_client__ $(EXPORTED_FLAGS) $(JSLIBS)
CXXFLAGS += -MMD -Wall -fPIC -Qunused-arguments -Wno-overloaded-virtual -Qunused-variable -s TOTAL_MEMORY=268435456 -s VERBOSE=1 -U__native_client__ $(EXPORTED_FLAGS) $(JSLIBS)
LIB_DIR = $(COCOS_SRC)/lib/emscripten
LIB_DIR = $(COCOS_ROOT)/lib/emscripten
BIN_DIR = bin
INCLUDES += \

View File

@ -0,0 +1,37 @@
################################################################################
# Do not include this file in your project: see cocos2dx.pri.
################################################################################
linux {
# Use OpenAL in default QtCreator project.
isEmpty(COCOS2D_USE_FMOD):COCOS2D_USE_FMOD=0
# Variables used when building libraries.
CC_LIBRARY_DIR = $$PWD/../../lib/linux/release
CC_MAKE_FLAGS = -s
CONFIG(debug, debug|release) {
# Override in debug build.
CC_MAKE_FLAGS += DEBUG=1
CC_LIBRARY_DIR = $$PWD/../../lib/linux/debug
}
contains(COCOS2D_MODULES,box2d) {
CC_MAKE_FLAGS += USE_BOX2D=1
}
!equals(COCOS2D_USE_FMOD, 1) {
CC_MAKE_FLAGS += OPENAL=1
}
# We will compile cocos2d shared library on demand using Makefile.
build_cocos2d.name = Build cocos2d shared library
build_cocos2d.input = $$PWD/Makefile
build_cocos2d.output = $$CC_LIBRARY_DIR/libcocos2d.so
build_cocos2d.target = $$CC_LIBRARY_DIR/libcocos2d.so
build_cocos2d.CONFIG = no_link target_predeps
build_cocos2d.commands = cd $$PWD && make $$CC_MAKE_FLAGS ${QMAKE_FILE_IN}
QMAKE_EXTRA_COMPILERS += build_cocos2d
QMAKE_EXTRA_TARGETS += build_cocos2d
PRE_TARGETDEPS += $$CC_LIBRARY_DIR/libcocos2d.so
LIBS += -L$$CC_LIBRARY_DIR -lcocos2d -Wl,-rpath,\'$$CC_LIBRARY_DIR\'
}

View File

@ -0,0 +1,70 @@
################################################################################
#
# If you want enable extra modules, set COCOS2D_MODULES variable before include
# this file, example:
# COCOS2D_MODULES += CocosDenshion
# COCOS2D_MODULES += extensions
# COCOS2D_MODULES += box2d
# or
# COCOS2D_MODULES += chipmunk
# note: you cannot include both box2d and chipmunk.
#
# By default, QtCreator project will use OpenAL audio backend (because FMOD is
# free only for non-commercial use). If you are legal FMOD user, set variable
# COCOS2D_USE_FMOD to use FMOD audio backend:
# COCOS2D_USE_FMOD = 1
#
################################################################################
INCLUDEPATH += $$PWD/../
INCLUDEPATH += $$PWD/../cocoa/
INCLUDEPATH += $$PWD/../include/
INCLUDEPATH += $$PWD/../platform/
INCLUDEPATH += $$PWD/../kazmath/include
*-msvc* {
# Use equivalents of -Wno-overloaded-virtual -Wno-unused-parameter.
QMAKE_CXXFLAGS_WARN_ON += /wd4263 /wd4100
} else {
QMAKE_CXXFLAGS_WARN_ON += -Wno-ignored-qualifiers -Wno-overloaded-virtual -Wno-unused-parameter -Wno-unused-function
QMAKE_CXXFLAGS += -std=c++0x
}
include($$PWD/cocos2dx.prf)
linux {
DEFINES += LINUX
INCLUDEPATH += $$PWD/../platform/linux
LIBS += -lpthread
}
contains(COCOS2D_MODULES,CocosDenshion) {
INCLUDEPATH += $$PWD/../../CocosDenshion/include
include($$PWD/../../CocosDenshion/proj.linux/CocosDenshion.prf)
}
contains(COCOS2D_MODULES,extensions) {
INCLUDEPATH += $$PWD/../../extensions
LIBS += -lcurl
include($$PWD/../../extensions/proj.linux/extensions.prf)
}
contains(COCOS2D_MODULES,box2d) {
INCLUDEPATH += $$PWD/../../external
include($$PWD/../../external/Box2D/proj.linux/box2d.prf)
}
contains(COCOS2D_MODULES,chipmunk) {
contains(COCOS2D_MODULES,box2d):error("COCOS2D_MODULES cannot contain both box2d and chipmunk: choose one and remove another.")
INCLUDEPATH += $$PWD/../../external/chipmunk/include/chipmunk
include($$PWD/../../external/chipmunk/proj.linux/chipmunk.prf)
}
CONFIG(debug, debug|release) {
DEFINES += COCOS2D_DEBUG=1
}
else {
DEFINES += COCOS2D_DEBUG=0
}

View File

@ -7,7 +7,7 @@
</PropertyGroup>
<ItemDefinitionGroup>
<Link>
<AdditionalDependencies>opengl32.lib;glew32.lib;libzlib.lib;libpng.lib;libjpeg.lib;libtiff.lib;libwebp.lib;libiconv.lib;pthreadVCE2.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>opengl32.lib;glew32.lib;libzlib.lib;libpng.lib;libjpeg.lib;libtiff.lib;libwebp.lib;libiconv.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
</Link>

View File

@ -24,22 +24,19 @@
****************************************************************************/
#include "HttpClient.h"
// #include "platform/CCThread.h"
#include <thread>
#include <queue>
#include <pthread.h>
#include <errno.h>
#include "curl/curl.h"
NS_CC_EXT_BEGIN
static pthread_t s_networkThread;
static pthread_mutex_t s_requestQueueMutex;
static pthread_mutex_t s_responseQueueMutex;
static std::mutex s_requestQueueMutex;
static std::mutex s_responseQueueMutex;
static pthread_mutex_t s_SleepMutex;
static pthread_cond_t s_SleepCondition;
static std::mutex s_SleepMutex;
static std::condition_variable s_SleepCondition;
static unsigned long s_asyncRequestCount = 0;
@ -93,7 +90,7 @@ static int processDeleteTask(HttpRequest *request, write_callback callback, void
// Worker thread
static void* networkThread(void *data)
static void networkThread(void)
{
HttpRequest *request = NULL;
@ -107,19 +104,23 @@ static void* networkThread(void *data)
// step 1: send http request if the requestQueue isn't empty
request = NULL;
pthread_mutex_lock(&s_requestQueueMutex); //Get request task from queue
s_requestQueueMutex.lock();
//Get request task from queue
if (0 != s_requestQueue->count())
{
request = dynamic_cast<HttpRequest*>(s_requestQueue->objectAtIndex(0));
s_requestQueue->removeObjectAtIndex(0);
// request's refcount = 1 here
}
pthread_mutex_unlock(&s_requestQueueMutex);
s_requestQueueMutex.unlock();
if (NULL == request)
{
// Wait for http request tasks from main thread
pthread_cond_wait(&s_SleepCondition, &s_SleepMutex);
std::unique_lock<std::mutex> lk(s_SleepMutex);
s_SleepCondition.wait(lk);
continue;
}
@ -194,37 +195,29 @@ static void* networkThread(void *data)
// add response packet into queue
pthread_mutex_lock(&s_responseQueueMutex);
s_responseQueueMutex.lock();
s_responseQueue->addObject(response);
pthread_mutex_unlock(&s_responseQueueMutex);
s_responseQueueMutex.unlock();
// resume dispatcher selector
Director::sharedDirector()->getScheduler()->resumeTarget(HttpClient::getInstance());
}
// cleanup: if worker thread received quit signal, clean up un-completed request queue
pthread_mutex_lock(&s_requestQueueMutex);
s_requestQueueMutex.lock();
s_requestQueue->removeAllObjects();
pthread_mutex_unlock(&s_requestQueueMutex);
s_requestQueueMutex.unlock();
s_asyncRequestCount -= s_requestQueue->count();
if (s_requestQueue != NULL) {
pthread_mutex_destroy(&s_requestQueueMutex);
pthread_mutex_destroy(&s_responseQueueMutex);
pthread_mutex_destroy(&s_SleepMutex);
pthread_cond_destroy(&s_SleepCondition);
s_requestQueue->release();
s_requestQueue = NULL;
s_responseQueue->release();
s_responseQueue = NULL;
}
pthread_exit(NULL);
return 0;
}
//Configure curl's timeout property
@ -405,7 +398,7 @@ HttpClient::~HttpClient()
need_quit = true;
if (s_requestQueue != NULL) {
pthread_cond_signal(&s_SleepCondition);
s_SleepCondition.notify_one();
}
s_pHttpClient = NULL;
@ -424,14 +417,9 @@ bool HttpClient::lazyInitThreadSemphore()
s_responseQueue = new Array();
s_responseQueue->init();
pthread_mutex_init(&s_requestQueueMutex, NULL);
pthread_mutex_init(&s_responseQueueMutex, NULL);
pthread_mutex_init(&s_SleepMutex, NULL);
pthread_cond_init(&s_SleepCondition, NULL);
pthread_create(&s_networkThread, NULL, networkThread, NULL);
pthread_detach(s_networkThread);
auto t = std::thread(&networkThread);
t.detach();
need_quit = false;
}
@ -456,12 +444,12 @@ void HttpClient::send(HttpRequest* request)
request->retain();
pthread_mutex_lock(&s_requestQueueMutex);
s_requestQueueMutex.lock();
s_requestQueue->addObject(request);
pthread_mutex_unlock(&s_requestQueueMutex);
s_requestQueueMutex.unlock();
// Notify thread start to work
pthread_cond_signal(&s_SleepCondition);
s_SleepCondition.notify_one();
}
// Poll and notify main thread if responses exists in queue
@ -471,13 +459,15 @@ void HttpClient::dispatchResponseCallbacks(float delta)
HttpResponse* response = NULL;
pthread_mutex_lock(&s_responseQueueMutex);
s_responseQueueMutex.lock();
if (s_responseQueue->count())
{
response = dynamic_cast<HttpResponse*>(s_responseQueue->objectAtIndex(0));
s_responseQueue->removeObjectAtIndex(0);
}
pthread_mutex_unlock(&s_responseQueueMutex);
s_responseQueueMutex.unlock();
if (response)
{

View File

@ -119,6 +119,7 @@ WsThreadHelper::WsThreadHelper()
WsThreadHelper::~WsThreadHelper()
{
Director::sharedDirector()->getScheduler()->unscheduleAllForTarget(this);
joinSubThread();
CC_SAFE_DELETE(_subThreadInstance);
delete _UIWsMessageQueue;
delete _subThreadWsMessageQueue;
@ -130,7 +131,6 @@ bool WsThreadHelper::createThread(const WebSocket& ws)
// Creates websocket thread
_subThreadInstance = new std::thread(&WsThreadHelper::wsThreadEntryFunc, this);
return true;
}
@ -156,16 +156,14 @@ void WsThreadHelper::wsThreadEntryFunc()
void WsThreadHelper::sendMessageToUIThread(WsMessage *msg)
{
_UIWsMessageQueueMutex.lock();
std::lock_guard<std::mutex> lk(_UIWsMessageQueueMutex);
_UIWsMessageQueue->push_back(msg);
_UIWsMessageQueueMutex.unlock();
}
void WsThreadHelper::sendMessageToSubThread(WsMessage *msg)
{
_subThreadWsMessageQueueMutex.lock();
std::lock_guard<std::mutex> lk(_subThreadWsMessageQueueMutex);
_subThreadWsMessageQueue->push_back(msg);
_subThreadWsMessageQueueMutex.unlock();
}
void WsThreadHelper::joinSubThread()
@ -181,17 +179,16 @@ void WsThreadHelper::update(float dt)
WsMessage *msg = NULL;
// Returns quickly if no message
_UIWsMessageQueueMutex.lock();
std::lock_guard<std::mutex> lk(_UIWsMessageQueueMutex);
if (0 == _UIWsMessageQueue->size())
{
_UIWsMessageQueueMutex.unlock();
return;
}
// Gets message
msg = *(_UIWsMessageQueue->begin());
_UIWsMessageQueue->pop_front();
_UIWsMessageQueueMutex.unlock();
if (_ws)
{
@ -394,11 +391,8 @@ int WebSocket::onSubThreadLoop()
}
// Sleep 50 ms
#ifdef WIN32
Sleep(50);
#else
usleep(50000);
#endif
std::this_thread::sleep_for(std::chrono::milliseconds(50));
// return 0 to continue the loop.
return 0;
}
@ -501,7 +495,8 @@ int WebSocket::onSocketCallback(struct libwebsocket_context *ctx,
case LWS_CALLBACK_CLIENT_WRITEABLE:
{
_wsHelper->_subThreadWsMessageQueueMutex.lock();
std::lock_guard<std::mutex> lk(_wsHelper->_subThreadWsMessageQueueMutex);
std::list<WsMessage*>::iterator iter = _wsHelper->_subThreadWsMessageQueue->begin();
int bytesWrite = 0;
@ -550,7 +545,6 @@ int WebSocket::onSocketCallback(struct libwebsocket_context *ctx,
_wsHelper->_subThreadWsMessageQueue->clear();
_wsHelper->_subThreadWsMessageQueueMutex.unlock();
/* get notified as soon as we can write again */

View File

@ -0,0 +1,20 @@
################################################################################
# Do not include this file in your project: see cocos2dx.pri.
################################################################################
linux {
# We will compile extensions on demand using Makefile.
build_extension.name = Build extension static library
build_extension.input = $$PWD/Makefile
build_extension.output = $$CC_LIBRARY_DIR/libextension.a
build_extension.target = $$CC_LIBRARY_DIR/libextension.a
build_extension.CONFIG = no_link target_predeps
build_extension.commands = cd $$PWD && make $$CC_MAKE_FLAGS
QMAKE_EXTRA_COMPILERS += build_extension
QMAKE_EXTRA_TARGETS += build_extension
PRE_TARGETDEPS += $$CC_LIBRARY_DIR/libextension.a
LIBS += -Wl,-Bstatic -lextension -Wl,-Bdynamic
}

19
external/Box2D/proj.linux/box2d.prf vendored Normal file
View File

@ -0,0 +1,19 @@
################################################################################
# Do not include this file in your project: see cocos2dx.pri.
################################################################################
linux {
# We will compile box2d on demand using Makefile.
build_box2d.name = Build box2d static library
build_box2d.input = $$PWD/Makefile
build_box2d.output = $$CC_LIBRARY_DIR/libbox2d.a
build_box2d.target = $$CC_LIBRARY_DIR/libbox2d.a
build_box2d.CONFIG = no_link target_predeps
build_box2d.commands = cd $$PWD && make $$CC_MAKE_FLAGS
QMAKE_EXTRA_COMPILERS += build_box2d
QMAKE_EXTRA_TARGETS += build_box2d
PRE_TARGETDEPS += $$CC_LIBRARY_DIR/libbox2d.a
LIBS += -Wl,-Bstatic -lbox2d -Wl,-Bdynamic
}

View File

@ -0,0 +1,19 @@
################################################################################
# Do not include this file in your project: see cocos2dx.pri.
################################################################################
linux {
# We will compile chipmunk on demand using Makefile.
build_chipmunk.name = Build chipmunk static library
build_chipmunk.input = $$PWD/Makefile
build_chipmunk.output = $$CC_LIBRARY_DIR/libchipmunk.a
build_chipmunk.target = $$CC_LIBRARY_DIR/libchipmunk.a
build_chipmunk.CONFIG = no_link target_predeps
build_chipmunk.commands = cd $$PWD && make $$CC_MAKE_FLAGS
QMAKE_EXTRA_COMPILERS += build_chipmunk
QMAKE_EXTRA_TARGETS += build_chipmunk
PRE_TARGETDEPS += $$CC_LIBRARY_DIR/libchipmunk.a
LIBS += -Wl,-Bstatic -lchipmunk -Wl,-Bdynamic
}

View File

@ -7,6 +7,11 @@
objects = {
/* Begin PBXBuildFile section */
1A6B059A177828E700FFE52B /* libchipmunk.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A6B0595177828E700FFE52B /* libchipmunk.a */; };
1A6B059B177828E700FFE52B /* libcocos2dx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A6B0596177828E700FFE52B /* libcocos2dx.a */; };
1A6B059C177828E700FFE52B /* libCocosDenshion.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A6B0597177828E700FFE52B /* libCocosDenshion.a */; };
1A6B059D177828E700FFE52B /* libextensions.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A6B0598177828E700FFE52B /* libextensions.a */; };
1A6B059E177828E700FFE52B /* libjsbindings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A6B0599177828E700FFE52B /* libjsbindings.a */; };
1A6B05B81778293600FFE52B /* jsb.js in Resources */ = {isa = PBXBuildFile; fileRef = 1A6B05A01778291500FFE52B /* jsb.js */; };
1A6B05B91778293600FFE52B /* jsb_chipmunk.js in Resources */ = {isa = PBXBuildFile; fileRef = 1A6B05A11778291500FFE52B /* jsb_chipmunk.js */; };
1A6B05BA1778293600FFE52B /* jsb_chipmunk_constants.js in Resources */ = {isa = PBXBuildFile; fileRef = 1A6B05A21778291500FFE52B /* jsb_chipmunk_constants.js */; };
@ -45,15 +50,14 @@
46A212B316D4A43400723F2B /* main.js in Resources */ = {isa = PBXBuildFile; fileRef = 46A212B116D4A41700723F2B /* main.js */; };
46A212BE16D4A4C000723F2B /* myApp.js in Resources */ = {isa = PBXBuildFile; fileRef = 46A212BC16D4A4B100723F2B /* myApp.js */; };
46A2146116D4B04A00723F2B /* Background.png in Resources */ = {isa = PBXBuildFile; fileRef = 46A2146016D4B04A00723F2B /* Background.png */; };
A0C2189D1779272900BE78B5 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A0C2189C1779272900BE78B5 /* Default-568h@2x.png */; };
A0F3A9B8177905F600CF0EB6 /* libchipmunk.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A0F3A9B3177905F600CF0EB6 /* libchipmunk.a */; };
A0F3A9B9177905F600CF0EB6 /* libcocos2dx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A0F3A9B4177905F600CF0EB6 /* libcocos2dx.a */; };
A0F3A9BA177905F600CF0EB6 /* libCocosDenshion.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A0F3A9B5177905F600CF0EB6 /* libCocosDenshion.a */; };
A0F3A9BB177905F600CF0EB6 /* libextensions.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A0F3A9B6177905F600CF0EB6 /* libextensions.a */; };
A0F3A9BC177905F600CF0EB6 /* libjsbindings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A0F3A9B7177905F600CF0EB6 /* libjsbindings.a */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
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>"; };
@ -95,12 +99,6 @@
46A212B116D4A41700723F2B /* main.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = main.js; sourceTree = "<group>"; };
46A212BC16D4A4B100723F2B /* myApp.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = myApp.js; sourceTree = "<group>"; };
46A2146016D4B04A00723F2B /* Background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Background.png; sourceTree = "<group>"; };
A0C2189C1779272900BE78B5 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
A0F3A9B3177905F600CF0EB6 /* libchipmunk.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libchipmunk.a; path = "../../../../external/chipmunk/proj.ios/build/Release-iphoneos/libchipmunk.a"; sourceTree = "<group>"; };
A0F3A9B4177905F600CF0EB6 /* libcocos2dx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcocos2dx.a; path = "../../../../../../Library/Developer/Xcode/DerivedData/cocos2d-ios-efgwnjcjlugbweaakhyrdehqseht/Build/Products/Debug-iphoneos/libcocos2dx.a"; sourceTree = "<group>"; };
A0F3A9B5177905F600CF0EB6 /* libCocosDenshion.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libCocosDenshion.a; path = "../../../../../../Library/Developer/Xcode/DerivedData/cocos2d-ios-efgwnjcjlugbweaakhyrdehqseht/Build/Products/Debug-iphoneos/libCocosDenshion.a"; sourceTree = "<group>"; };
A0F3A9B6177905F600CF0EB6 /* libextensions.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libextensions.a; path = "../../../../extensions/proj.ios/build/Release-iphoneos/libextensions.a"; sourceTree = "<group>"; };
A0F3A9B7177905F600CF0EB6 /* libjsbindings.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libjsbindings.a; path = "../../../../../../Library/Developer/Xcode/DerivedData/cocos2d-ios-efgwnjcjlugbweaakhyrdehqseht/Build/Products/Debug-iphoneos/libjsbindings.a"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -108,13 +106,13 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
A0F3A9B8177905F600CF0EB6 /* libchipmunk.a in Frameworks */,
A0F3A9B9177905F600CF0EB6 /* libcocos2dx.a in Frameworks */,
A0F3A9BA177905F600CF0EB6 /* libCocosDenshion.a in Frameworks */,
A0F3A9BB177905F600CF0EB6 /* libextensions.a in Frameworks */,
A0F3A9BC177905F600CF0EB6 /* libjsbindings.a in Frameworks */,
1A6B05CB17782B8700FFE52B /* libsqlite3.dylib in Frameworks */,
1A6B05C917782B8100FFE52B /* libz.dylib in Frameworks */,
1A6B059A177828E700FFE52B /* libchipmunk.a in Frameworks */,
1A6B059B177828E700FFE52B /* libcocos2dx.a in Frameworks */,
1A6B059C177828E700FFE52B /* libCocosDenshion.a in Frameworks */,
1A6B059D177828E700FFE52B /* libextensions.a in Frameworks */,
1A6B059E177828E700FFE52B /* libjsbindings.a in Frameworks */,
469A7A0216C0F242006FFCB2 /* QuartzCore.framework in Frameworks */,
469A7A0416C0F242006FFCB2 /* OpenGLES.framework in Frameworks */,
469A7A0616C0F242006FFCB2 /* OpenAL.framework in Frameworks */,
@ -152,7 +150,6 @@
469A79F516C0F242006FFCB2 = {
isa = PBXGroup;
children = (
A0C2189C1779272900BE78B5 /* Default-568h@2x.png */,
469A7D0516C0F429006FFCB2 /* Classes */,
469A7A0016C0F242006FFCB2 /* Frameworks */,
469A7CEE16C0F311006FFCB2 /* ios */,
@ -172,13 +169,13 @@
469A7A0016C0F242006FFCB2 /* Frameworks */ = {
isa = PBXGroup;
children = (
A0F3A9B3177905F600CF0EB6 /* libchipmunk.a */,
A0F3A9B4177905F600CF0EB6 /* libcocos2dx.a */,
A0F3A9B5177905F600CF0EB6 /* libCocosDenshion.a */,
A0F3A9B6177905F600CF0EB6 /* libextensions.a */,
A0F3A9B7177905F600CF0EB6 /* libjsbindings.a */,
1A6B05CA17782B8700FFE52B /* libsqlite3.dylib */,
1A6B05C817782B8100FFE52B /* libz.dylib */,
1A6B0595177828E700FFE52B /* libchipmunk.a */,
1A6B0596177828E700FFE52B /* libcocos2dx.a */,
1A6B0597177828E700FFE52B /* libCocosDenshion.a */,
1A6B0598177828E700FFE52B /* libextensions.a */,
1A6B0599177828E700FFE52B /* libjsbindings.a */,
469A7A0116C0F242006FFCB2 /* QuartzCore.framework */,
469A7A0316C0F242006FFCB2 /* OpenGLES.framework */,
469A7A0516C0F242006FFCB2 /* OpenAL.framework */,
@ -307,7 +304,6 @@
469A7DD716C0F74F006FFCB2 /* Icon.png in Resources */,
469A7DD816C0F74F006FFCB2 /* Icon@2x.png in Resources */,
46A2146116D4B04A00723F2B /* Background.png in Resources */,
A0C2189D1779272900BE78B5 /* Default-568h@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -24,6 +24,13 @@ $(TARGET).js: $(OBJECTS) $(STATICLIBS) $(COCOS_LIBS) $(CORE_MAKEFILE_LIST)
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) $(OBJECTS) -o $@ $(SHAREDLIBS) $(STATICLIBS)
ifeq ($(shell uname -s),Darwin)
ARIEL_TTF := /Library/Fonts/Arial.ttf
else
ARIEL_TTF := $(COCOS_ROOT)/samples/Cpp/TestCpp/Resources/fonts/arial.ttf
endif
$(TARGET).data:
@mkdir -p $(@D)
$(eval RESTMP := $(shell mktemp -d /tmp/cocos-emscripten.XXXXXX))
@ -32,7 +39,7 @@ $(TARGET).data:
(cd $(RESOURCE_PATH) && cp -a $(RESOURCES) $(RESTMP))
(cd $(FONT_PATH) && cp -a * $(RESTMP)/fonts)
# NOTE: we copy the system arial.ttf so that there is always a fallback.
cp /Library/Fonts/Arial.ttf $(RESTMP)/fonts/arial.ttf
cp $(ARIEL_TTF) $(RESTMP)/fonts/arial.ttf
(cd $(RESTMP); python $(PACKAGER) $(EXECUTABLE).data $(patsubst %,--preload %,$(RESOURCES)) --preload fonts --pre-run > $(EXECUTABLE).data.js)
mv $(RESTMP)/$(EXECUTABLE).data $@
mv $(RESTMP)/$(EXECUTABLE).data.js $@.js

View File

@ -8,12 +8,12 @@
/* Begin PBXBuildFile section */
15003FA315D2601D00B6775A /* iphone in Resources */ = {isa = PBXBuildFile; fileRef = 15003FA215D2601D00B6775A /* iphone */; };
1A0C0A6B1777F65600838530 /* libcocos2dx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A0C0A6A1777F65600838530 /* libcocos2dx.a */; };
1A1CF3691626CEFF00AFC938 /* ipad in Resources */ = {isa = PBXBuildFile; fileRef = 1A1CF3671626CEFF00AFC938 /* ipad */; };
1A1CF36A1626CEFF00AFC938 /* ipadhd in Resources */ = {isa = PBXBuildFile; fileRef = 1A1CF3681626CEFF00AFC938 /* ipadhd */; };
1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; };
A0F3A9BE1779062B00CF0EB6 /* libcocos2dx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A0F3A9BD1779062B00CF0EB6 /* libcocos2dx.a */; };
BF1373EF128A898400D9F789 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF492D4B1289302400A09262 /* OpenGLES.framework */; };
BF1373F0128A899500D9F789 /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = BF492C21128924A800A09262 /* libxml2.dylib */; };
BF1373F1128A899E00D9F789 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = BF492B6912891AC600A09262 /* libz.dylib */; };
@ -34,6 +34,7 @@
/* Begin PBXFileReference section */
15003FA215D2601D00B6775A /* iphone */ = {isa = PBXFileReference; lastKnownFileType = folder; path = iphone; 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>"; };
@ -44,11 +45,6 @@
781C33B11547F06B00633F88 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; };
781C33B31547F06B00633F88 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
781C33B51547F06B00633F88 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
A0F3A9BD1779062B00CF0EB6 /* libcocos2dx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcocos2dx.a; path = "../../../../../../Library/Developer/Xcode/DerivedData/cocos2d-ios-efgwnjcjlugbweaakhyrdehqseht/Build/Products/Debug-iphoneos/libcocos2dx.a"; sourceTree = "<group>"; };
A0F3A9BF1779069A00CF0EB6 /* libBox2D.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libBox2D.a; path = "../../../../../../Library/Developer/Xcode/DerivedData/cocos2d-ios-efgwnjcjlugbweaakhyrdehqseht/Build/Products/Debug-iphoneos/libBox2D.a"; sourceTree = "<group>"; };
A0F3A9C01779069A00CF0EB6 /* libchipmunk.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libchipmunk.a; path = "../../../../external/chipmunk/proj.ios/build/Release-iphoneos/libchipmunk.a"; sourceTree = "<group>"; };
A0F3A9C11779069A00CF0EB6 /* libCocosDenshion.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libCocosDenshion.a; path = "../../../../../../Library/Developer/Xcode/DerivedData/cocos2d-ios-efgwnjcjlugbweaakhyrdehqseht/Build/Products/Debug-iphoneos/libCocosDenshion.a"; sourceTree = "<group>"; };
A0F3A9C21779069A00CF0EB6 /* libextensions.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libextensions.a; path = "../../../../extensions/proj.ios/build/Release-iphoneos/libextensions.a"; sourceTree = "<group>"; };
BF137426128A8E4600D9F789 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
BF23D4E3143315EB00657E08 /* AppDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppDelegate.cpp; sourceTree = "<group>"; };
BF23D4E4143315EB00657E08 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
@ -76,7 +72,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
A0F3A9BE1779062B00CF0EB6 /* libcocos2dx.a in Frameworks */,
1A0C0A6B1777F65600838530 /* libcocos2dx.a in Frameworks */,
1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */,
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */,
288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */,
@ -113,11 +109,7 @@
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
A0F3A9BF1779069A00CF0EB6 /* libBox2D.a */,
A0F3A9C01779069A00CF0EB6 /* libchipmunk.a */,
A0F3A9C11779069A00CF0EB6 /* libCocosDenshion.a */,
A0F3A9C21779069A00CF0EB6 /* libextensions.a */,
A0F3A9BD1779062B00CF0EB6 /* libcocos2dx.a */,
1A0C0A6A1777F65600838530 /* libcocos2dx.a */,
BF492B6912891AC600A09262 /* libz.dylib */,
BF137426128A8E4600D9F789 /* QuartzCore.framework */,
BF492D4B1289302400A09262 /* OpenGLES.framework */,

View File

@ -37,6 +37,12 @@ $(TARGET).js: $(OBJECTS) $(STATICLIBS) $(COCOS_LIBS) $(CORE_MAKEFILE_LIST)
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) $(OBJECTS) -o $@ $(SHAREDLIBS) $(STATICLIBS)
ifeq ($(shell uname -s),Darwin)
ARIEL_TTF := /Library/Fonts/Arial.ttf
else
ARIEL_TTF := $(COCOS_ROOT)/samples/Cpp/TestCpp/Resources/fonts/arial.ttf
endif
$(TARGET).data:
@mkdir -p $(@D)
$(eval RESTMP := $(shell mktemp -d /tmp/cocos-emscripten.XXXXXX))
@ -45,7 +51,7 @@ $(TARGET).data:
(cd $(RESOURCE_PATH) && tar cf - $(RESOURCES)) | (cd $(RESTMP) && tar xvf -)
(cd $(SD_RESOURCE_PATH) && tar cf - $(SD_RESOURCES)) | (cd $(RESTMP) && tar xvf -)
# NOTE: we copy the system arial.ttf so that there is always a fallback.
cp /Library/Fonts/Arial.ttf $(RESTMP)/fonts/arial.ttf
cp $(ARIEL_TTF) $(RESTMP)/fonts/arial.ttf
(cd $(RESTMP); python $(PACKAGER) $(EXECUTABLE).data $(patsubst %,--preload %,$(ALL_ASSETS)) --preload fonts --pre-run > $(EXECUTABLE).data.js)
mv $(RESTMP)/$(EXECUTABLE).data $@
mv $(RESTMP)/$(EXECUTABLE).data.js $@.js

View File

@ -3,16 +3,16 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 45;
objects = {
/* Begin PBXBuildFile section */
1A6E475F177819520055514D /* libcocos2dx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A6E475D177819520055514D /* libcocos2dx.a */; };
1A6E4760177819520055514D /* libCocosDenshion.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A6E475E177819520055514D /* libCocosDenshion.a */; };
1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; };
782F4619153FEDF0009FC2E5 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 782F4617153FEDF0009FC2E5 /* Default.png */; };
A0F3A9B01779050000CF0EB6 /* libcocos2dx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A0F3A9AF1779050000CF0EB6 /* libcocos2dx.a */; };
A0F3A9B21779052600CF0EB6 /* libCocosDenshion.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A0F3A9B11779052600CF0EB6 /* libCocosDenshion.a */; };
BF1373EF128A898400D9F789 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF492D4B1289302400A09262 /* OpenGLES.framework */; };
BF1373F0128A899500D9F789 /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = BF492C21128924A800A09262 /* libxml2.dylib */; };
BF1373F1128A899E00D9F789 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = BF492B6912891AC600A09262 /* libz.dylib */; };
@ -39,6 +39,8 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
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; };
@ -47,8 +49,6 @@
781C33B31547F06B00633F88 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
781C33B51547F06B00633F88 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
782F4617153FEDF0009FC2E5 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = SOURCE_ROOT; };
A0F3A9AF1779050000CF0EB6 /* libcocos2dx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcocos2dx.a; path = "../../../../../../Library/Developer/Xcode/DerivedData/cocos2d-ios-efgwnjcjlugbweaakhyrdehqseht/Build/Products/Debug-iphoneos/libcocos2dx.a"; sourceTree = "<group>"; };
A0F3A9B11779052600CF0EB6 /* libCocosDenshion.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libCocosDenshion.a; path = "../../../../../../Library/Developer/Xcode/DerivedData/cocos2d-ios-efgwnjcjlugbweaakhyrdehqseht/Build/Products/Debug-iphoneos/libCocosDenshion.a"; sourceTree = "<group>"; };
BF137426128A8E4600D9F789 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
BF23D4E3143315EB00657E08 /* AppDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppDelegate.cpp; sourceTree = "<group>"; };
BF23D4E4143315EB00657E08 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
@ -81,8 +81,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
A0F3A9B21779052600CF0EB6 /* libCocosDenshion.a in Frameworks */,
A0F3A9B01779050000CF0EB6 /* libcocos2dx.a in Frameworks */,
1A6E475F177819520055514D /* libcocos2dx.a in Frameworks */,
1A6E4760177819520055514D /* libCocosDenshion.a in Frameworks */,
D4E6BCCE15FCBAD7008BF525 /* AudioToolbox.framework in Frameworks */,
D4E6BCCD15FCBAC8008BF525 /* AVFoundation.framework in Frameworks */,
D4E6BCCC15FCBABC008BF525 /* OpenAL.framework in Frameworks */,
@ -122,8 +122,8 @@
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
A0F3A9B11779052600CF0EB6 /* libCocosDenshion.a */,
A0F3A9AF1779050000CF0EB6 /* libcocos2dx.a */,
1A6E475D177819520055514D /* libcocos2dx.a */,
1A6E475E177819520055514D /* libCocosDenshion.a */,
BF492B6912891AC600A09262 /* libz.dylib */,
BF137426128A8E4600D9F789 /* QuartzCore.framework */,
BF492D4B1289302400A09262 /* OpenGLES.framework */,
@ -208,11 +208,8 @@
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0460;
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SimpleGame" */;
compatibilityVersion = "Xcode 3.2";
compatibilityVersion = "Xcode 3.1";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
@ -299,6 +296,7 @@
);
INFOPLIST_FILE = "SimpleGame-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
LIBRARY_SEARCH_PATHS = "$(inherited)";
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = SimpleGame;
PROVISIONING_PROFILE = "";
@ -336,6 +334,7 @@
);
INFOPLIST_FILE = "SimpleGame-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
LIBRARY_SEARCH_PATHS = "$(inherited)";
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = SimpleGame;
PROVISIONING_PROFILE = "";
@ -355,6 +354,7 @@
GCC_VERSION = "";
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = iphoneos;
VALID_ARCHS = "armv6 armv7 i386";
};
@ -370,6 +370,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
PREBINDING = NO;
SDKROOT = iphoneos;
VALID_ARCHS = "armv6 armv7 i386";
};

View File

@ -1 +1 @@
a000f34faade66f3ab3354b00fa7b2c2aebd339c
e4ca00d0a77436dcf2dc220c386d6cd0a2689450

View File

@ -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>"; };

View File

@ -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>"; };

View File

@ -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>"; };

View File

@ -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>"; };

View File

@ -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>"; };

View File

@ -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>"; };

View File

@ -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

View File

@ -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>"; };

View File

@ -1 +1 @@
e110ce7b59357a987fd5383cd1aa89f254db2d45
fb7e01e5b657a41142a4774075e84a7436010de3

View File

@ -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

View File

@ -63,9 +63,7 @@ elif [ "$PLATFORM"x = "emscripten"x ]; then
export PYTHON=/usr/bin/python
export LLVM=$HOME/bin/clang+llvm-3.2/bin
export LLVM_ROOT=$LLVM
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
EMCC_DEBUG=1 make PLATFORM=emscripten -j 8
elif [ "$PLATFORM"x = "ios"x ]; then
cd $COCOS2DX_ROOT/tools/travis-scripts
./generate-jsbindings.sh