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

This commit is contained in:
yinkaile 2013-12-27 13:49:02 +08:00
commit ab1f49fbb5
27 changed files with 134 additions and 78 deletions

View File

@ -678,6 +678,9 @@ Developers:
seobyeongky
Updates spine runtime.
luocker
Fix a bug that string itself is also modified in `String::componentsSeparatedByString`.
Retired Core Developers:
WenSheng Yang
Author of windows port, CCTextField,

View File

@ -15,6 +15,7 @@ cocos2d-x-3.0beta0 ?? 2013
[FIX] LabelBMFont string can't be shown integrally.
[FIX] Deprecates FileUtils::getFileData, adds FileUtils::getStringFromFile/getDataFromFile.
[FIX] GUI refactoring: Removes UI prefix, Widget is inherited from Node, uses new containers(Vector<T>, Map<K,V>).
[FIX] String itself is also modified in `String::componentsSeparatedByString`.
[Android]
[NEW] build/android-build.sh: add supporting to generate .apk file
[FIX] XMLHttpRequest receives wrong binary array.

View File

@ -1076,6 +1076,8 @@ void DisplayLinkDirector::startAnimation()
}
_invalid = false;
Application::getInstance()->setAnimationInterval(_animationInterval);
}
void DisplayLinkDirector::mainLoop()

View File

@ -185,6 +185,11 @@ void ShaderCache::reloadDefaultShaders()
p->reset();
loadDefaultShader(p, kShaderType_PositionTextureColor);
// Position Texture Color without MVP shader
p = getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP);
p->reset();
loadDefaultShader(p, kShaderType_PositionTextureColor_noMVP);
// Position Texture Color alpha test
p = getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST);
p->reset();

View File

@ -204,7 +204,7 @@ protected:
ValueMap _properties;
//! tile properties
IntValueMap _tileProperties;
ValueMapIntKey _tileProperties;
private:
CC_DISALLOW_COPY_AND_ASSIGN(TMXTiledMap);

View File

@ -536,7 +536,7 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
}
else if ( tmxMapInfo->getParentElement() == TMXPropertyTile )
{
IntValueMap& dict = tmxMapInfo->getTileProperties().at(tmxMapInfo->getParentGID()).asIntKeyMap();
ValueMapIntKey& dict = tmxMapInfo->getTileProperties().at(tmxMapInfo->getParentGID()).asIntKeyMap();
int propertyName = attributeDict["name"].asInt();
dict[propertyName] = attributeDict["value"];

View File

@ -195,8 +195,8 @@ public:
/* initializes parsing of an XML string, either a tmx (Map) string or tsx (Tileset) string */
bool parseXMLString(const std::string& xmlString);
IntValueMap& getTileProperties() { return _tileProperties; };
void setTileProperties(const IntValueMap& tileProperties) {
ValueMapIntKey& getTileProperties() { return _tileProperties; };
void setTileProperties(const ValueMapIntKey& tileProperties) {
_tileProperties = tileProperties;
};
@ -311,7 +311,7 @@ protected:
//! current string
std::string _currentString;
//! tile properties
IntValueMap _tileProperties;
ValueMapIntKey _tileProperties;
unsigned int _currentFirstGID;
};

View File

@ -65,11 +65,14 @@ Renderer::~Renderer()
glDeleteVertexArrays(1, &_quadVAO);
GL::bindVAO(0);
}
#if CC_ENABLE_CACHE_TEXTURE_DATA
NotificationCenter::getInstance()->removeObserver(this, EVNET_COME_TO_FOREGROUND);
#endif
}
void Renderer::initGLView()
{
#if 0//CC_ENABLE_CACHE_TEXTURE_DATA
#if CC_ENABLE_CACHE_TEXTURE_DATA
// listen the event when app go to background
NotificationCenter::getInstance()->addObserver(this,
callfuncO_selector(Renderer::onBackToForeground),

View File

@ -26,7 +26,7 @@
#define __CCMAP_H__
#include "ccMacros.h"
#include "CCObject.h"
#include <vector>
#include <unordered_map>
@ -62,6 +62,7 @@ public:
Map<K, V>()
: _data()
{
static_assert(std::is_convertible<V, Object*>::value, "Invalid Type for cocos2d::Map<K, V>!");
CCLOGINFO("In the default constructor of Map!");
}
@ -69,6 +70,7 @@ public:
explicit Map<K, V>(ssize_t capacity)
: _data()
{
static_assert(std::is_convertible<V, Object*>::value, "Invalid Type for cocos2d::Map<K, V>!");
CCLOGINFO("In the constructor with capacity of Map!");
_data.reserve(capacity);
}
@ -76,6 +78,7 @@ public:
/** Copy constructor */
Map<K, V>(const Map<K, V>& other)
{
static_assert(std::is_convertible<V, Object*>::value, "Invalid Type for cocos2d::Map<K, V>!");
CCLOGINFO("In the copy constructor of Map!");
_data = other._data;
addRefForAllObjects();
@ -84,6 +87,7 @@ public:
/** Move constructor */
Map<K, V>(Map<K, V>&& other)
{
static_assert(std::is_convertible<V, Object*>::value, "Invalid Type for cocos2d::Map<K, V>!");
CCLOGINFO("In the move constructor of Map!");
_data = std::move(other._data);
}

View File

@ -181,20 +181,20 @@ void __String::appendWithFormat(const char* format, ...)
__Array* __String::componentsSeparatedByString(const char *delimiter)
{
__Array* result = __Array::create();
std::string strTmp = _string;
size_t cutAt;
while( (cutAt = _string.find_first_of(delimiter)) != _string.npos )
while( (cutAt = strTmp.find_first_of(delimiter)) != strTmp.npos )
{
if(cutAt > 0)
{
result->addObject(__String::create(_string.substr(0, cutAt)));
result->addObject(__String::create(strTmp.substr(0, cutAt)));
}
_string = _string.substr(cutAt + 1);
strTmp = strTmp.substr(cutAt + 1);
}
if(_string.length() > 0)
if(strTmp.length() > 0)
{
result->addObject(__String::create(_string));
result->addObject(__String::create(strTmp));
}
return result;

View File

@ -32,7 +32,7 @@ const Value Value::Null;
Value::Value()
: _vectorData(new ValueVector())
, _mapData(new ValueMap())
, _intKeyMapData(new IntValueMap())
, _intKeyMapData(new ValueMapIntKey())
, _type(Type::NONE)
{
@ -137,19 +137,19 @@ Value::Value(ValueMap&& v)
*_mapData = std::move(v);
}
Value::Value(const IntValueMap& v)
Value::Value(const ValueMapIntKey& v)
: _vectorData(nullptr)
, _mapData(nullptr)
, _intKeyMapData(new IntValueMap())
, _intKeyMapData(new ValueMapIntKey())
, _type(Type::INT_KEY_MAP)
{
*_intKeyMapData = v;
}
Value::Value(IntValueMap&& v)
Value::Value(ValueMapIntKey&& v)
: _vectorData(nullptr)
, _mapData(nullptr)
, _intKeyMapData(new IntValueMap())
, _intKeyMapData(new ValueMapIntKey())
, _type(Type::INT_KEY_MAP)
{
*_intKeyMapData = std::move(v);
@ -209,7 +209,7 @@ Value& Value::operator= (const Value& other)
break;
case Type::INT_KEY_MAP:
if (_intKeyMapData == nullptr)
_intKeyMapData = new IntValueMap();
_intKeyMapData = new ValueMapIntKey();
*_intKeyMapData = *other._intKeyMapData;
break;
default:
@ -357,20 +357,20 @@ Value& Value::operator= (ValueMap&& v)
return *this;
}
Value& Value::operator= (const IntValueMap& v)
Value& Value::operator= (const ValueMapIntKey& v)
{
clear();
_type = Type::INT_KEY_MAP;
_intKeyMapData = new IntValueMap();
_intKeyMapData = new ValueMapIntKey();
*_intKeyMapData = v;
return *this;
}
Value& Value::operator= (IntValueMap&& v)
Value& Value::operator= (ValueMapIntKey&& v)
{
clear();
_type = Type::INT_KEY_MAP;
_intKeyMapData = new IntValueMap();
_intKeyMapData = new ValueMapIntKey();
*_intKeyMapData = std::move(v);
return *this;
}

View File

@ -37,7 +37,7 @@ class Value;
typedef std::vector<Value> ValueVector;
typedef std::unordered_map<std::string, Value> ValueMap;
typedef std::unordered_map<int, Value> IntValueMap;
typedef std::unordered_map<int, Value> ValueMapIntKey;
class Value
{
@ -59,8 +59,8 @@ public:
explicit Value(const ValueMap& v);
explicit Value(ValueMap&& v);
explicit Value(const IntValueMap& v);
explicit Value(IntValueMap&& v);
explicit Value(const ValueMapIntKey& v);
explicit Value(ValueMapIntKey&& v);
Value(const Value& other);
Value(Value&& other);
@ -84,8 +84,8 @@ public:
Value& operator= (const ValueMap& v);
Value& operator= (ValueMap&& v);
Value& operator= (const IntValueMap& v);
Value& operator= (IntValueMap&& v);
Value& operator= (const ValueMapIntKey& v);
Value& operator= (ValueMapIntKey&& v);
unsigned char asByte() const;
int asInt() const;
@ -100,8 +100,8 @@ public:
inline ValueMap& asValueMap() { return *_mapData; }
inline const ValueMap& asValueMap() const { return *_mapData; }
inline IntValueMap& asIntKeyMap() { return *_intKeyMapData; }
inline const IntValueMap& asIntKeyMap() const { return *_intKeyMapData; }
inline ValueMapIntKey& asIntKeyMap() { return *_intKeyMapData; }
inline const ValueMapIntKey& asIntKeyMap() const { return *_intKeyMapData; }
inline bool isNull() const { return _type == Type::NONE; }
@ -138,7 +138,7 @@ private:
std::string _strData;
ValueVector* _vectorData;
ValueMap* _mapData;
IntValueMap* _intKeyMapData;
ValueMapIntKey* _intKeyMapData;
Type _type;
};

View File

@ -26,7 +26,7 @@ THE SOFTWARE.
#define __CCVECTOR_H__
#include "ccMacros.h"
#include "CCObject.h"
#include <vector>
#include <functional>
#include <algorithm> // for std::find
@ -68,13 +68,14 @@ public:
Vector<T>()
: _data()
{
static_assert(std::is_convertible<T, Object*>::value, "Invalid Type for cocos2d::Vector<T>!");
}
/** Constructor with a capacity */
explicit Vector<T>(ssize_t capacity)
: _data()
{
static_assert(std::is_convertible<T, Object*>::value, "Invalid Type for cocos2d::Vector<T>!");
CCLOGINFO("In the default constructor with capacity of Vector.");
reserve(capacity);
}
@ -89,6 +90,7 @@ public:
/** Copy constructor */
Vector<T>(const Vector<T>& other)
{
static_assert(std::is_convertible<T, Object*>::value, "Invalid Type for cocos2d::Vector<T>!");
CCLOGINFO("In the copy constructor!");
_data = other._data;
addRefForAllObjects();
@ -97,6 +99,7 @@ public:
/** Move constructor */
Vector<T>(Vector<T>&& other)
{
static_assert(std::is_convertible<T, Object*>::value, "Invalid Type for cocos2d::Vector<T>!");
CCLOGINFO("In the move constructor of Vector!");
_data = std::move(other._data);
}

View File

@ -151,10 +151,6 @@ void ActionNode::initActionNodeFromRoot(Object* root)
{
Node* rootNode = dynamic_cast<Node*>(root);
if (rootNode != NULL)
{
log("Need a definition of <initActionNodeFromRoot> for gameObject");
}
else
{
Widget* rootWidget = dynamic_cast<Widget*>(root);
if (rootWidget != NULL)
@ -165,7 +161,7 @@ void ActionNode::initActionNodeFromRoot(Object* root)
setObject(widget);
}
}
}
}
}
void ActionNode::setUnitTime(float fTime)

View File

@ -619,7 +619,7 @@ void WidgetPropertiesReader0250::setPropsForLabelAtlasFromJsonDictionary(Widget*
const char* cmft = dicHelper->getStringValue_json(options, "charMapFile");
cmf_tp = tp_c.append(cmft).c_str();
labelAtlas->setProperty(dicHelper->getStringValue_json(options, "stringValue"),cmf_tp,dicHelper->getIntValue_json(options, "itemWidth"),dicHelper->getIntValue_json(options,"itemHeight"),dicHelper->getStringValue_json(options, "startCharMap"));
labelAtlas->setProperty(dicHelper->getStringValue_json(options, "stringValue"),cmf_tp,dicHelper->getIntValue_json(options, "itemWidth") / CC_CONTENT_SCALE_FACTOR() ,dicHelper->getIntValue_json(options,"itemHeight") / CC_CONTENT_SCALE_FACTOR(), dicHelper->getStringValue_json(options, "startCharMap"));
}
setColorPropsForWidgetFromJsonDictionary(widget,options);
}
@ -1025,7 +1025,23 @@ Widget* WidgetPropertiesReader0300::widgetFromJsonDictionary(JsonDictionary *dat
Widget* child = widgetFromJsonDictionary(subData);
if (child)
{
widget->addChild(child);
PageView* pageView = dynamic_cast<PageView*>(widget);
if (pageView)
{
pageView->addPage(static_cast<Layout*>(child));
}
else
{
ListView* listView = dynamic_cast<ListView*>(widget);
if (listView)
{
listView->pushBackCustomItem(child);
}
else
{
widget->addChild(child);
}
}
}
CC_SAFE_DELETE(subData);
}
@ -1525,7 +1541,7 @@ void WidgetPropertiesReader0300::setPropsForLabelAtlasFromJsonDictionary(Widget*
std::string tp_c = m_strFilePath;
const char* cmfPath = dicHelper->getStringValue_json(cmftDic, "path");
const char* cmf_tp = tp_c.append(cmfPath).c_str();
labelAtlas->setProperty(dicHelper->getStringValue_json(options, "stringValue"),cmf_tp,dicHelper->getIntValue_json(options, "itemWidth"),dicHelper->getIntValue_json(options,"itemHeight"),dicHelper->getStringValue_json(options, "startCharMap"));
labelAtlas->setProperty(dicHelper->getStringValue_json(options, "stringValue"),cmf_tp,dicHelper->getIntValue_json(options, "itemWidth") / CC_CONTENT_SCALE_FACTOR(),dicHelper->getIntValue_json(options,"itemHeight") / CC_CONTENT_SCALE_FACTOR(), dicHelper->getStringValue_json(options, "startCharMap"));
break;
}
case 1:
@ -1931,11 +1947,26 @@ void WidgetPropertiesReader0300::setPropsForLabelBMFontFromJsonDictionary(Widget
void WidgetPropertiesReader0300::setPropsForPageViewFromJsonDictionary(Widget*widget,JsonDictionary* options)
{
setPropsForLayoutFromJsonDictionary(widget, options);
}
void WidgetPropertiesReader0300::setPropsForListViewFromJsonDictionary(Widget* widget, JsonDictionary* options)
{
setPropsForLayoutFromJsonDictionary(widget, options);
ListView* listView = static_cast<ListView*>(widget);
float innerWidth = DICTOOL->getFloatValue_json(options, "innerWidth");
float innerHeight = DICTOOL->getFloatValue_json(options, "innerHeight");
listView->setInnerContainerSize(Size(innerWidth, innerHeight));
int direction = DICTOOL->getFloatValue_json(options, "direction");
listView->setDirection((SCROLLVIEW_DIR)direction);
ListViewGravity gravity = (ListViewGravity)DICTOOL->getIntValue_json(options, "gravity");
listView->setGravity(gravity);
float itemMargin = DICTOOL->getFloatValue_json(options, "itemMargin");
listView->setItemsMargin(itemMargin);
}
}

@ -1 +1 @@
Subproject commit f8780070ba5aa2b640ef1da1008a6acc77f66217
Subproject commit 6f6b1240ecac0cbf3e4a2a0bd7356b708c054daf

View File

@ -288,15 +288,15 @@ public:
return NULL;
}
virtual long numberOfCellsInTableView(TableView *table)
virtual ssize_t numberOfCellsInTableView(TableView *table)
{
jsval ret;
bool ok = callJSDelegate(table, "numberOfCellsInTableView", ret);
if (ok)
{
JSContext* cx = ScriptingCore::getInstance()->getGlobalContext();
long count = 0;
JSBool isSucceed = jsval_to_long(cx, ret, &count);
ssize_t count = 0;
JSBool isSucceed = jsval_to_ssize(cx, ret, &count);
if (isSucceed) return count;
}
return 0;

View File

@ -1034,7 +1034,7 @@ JSBool jsval_to_ccvaluemap(JSContext* cx, jsval v, cocos2d::ValueMap* ret)
return JS_TRUE;
}
JSBool jsval_to_ccintvaluemap(JSContext* cx, jsval v, cocos2d::IntValueMap* ret)
JSBool jsval_to_ccvaluemapintkey(JSContext* cx, jsval v, cocos2d::ValueMapIntKey* ret)
{
if (JSVAL_IS_NULL(v) || JSVAL_IS_VOID(v))
{
@ -1049,7 +1049,7 @@ JSBool jsval_to_ccintvaluemap(JSContext* cx, jsval v, cocos2d::IntValueMap* ret)
JSObject* it = JS_NewPropertyIterator(cx, tmp);
IntValueMap& dict = *ret;
ValueMapIntKey& dict = *ret;
while (true)
{
@ -2040,7 +2040,7 @@ jsval ccvalue_to_jsval(JSContext* cx, const cocos2d::Value& v)
ret = ccvaluemap_to_jsval(cx, obj.asValueMap());
break;
case Value::Type::INT_KEY_MAP:
ret = ccintvaluemap_to_jsval(cx, obj.asIntKeyMap());
ret = ccvaluemapintkey_to_jsval(cx, obj.asIntKeyMap());
break;
default:
break;
@ -2082,7 +2082,7 @@ jsval ccvaluemap_to_jsval(JSContext* cx, const cocos2d::ValueMap& v)
dictElement = ccvaluemap_to_jsval(cx, obj.asValueMap());
break;
case Value::Type::INT_KEY_MAP:
dictElement = ccintvaluemap_to_jsval(cx, obj.asIntKeyMap());
dictElement = ccvaluemapintkey_to_jsval(cx, obj.asIntKeyMap());
break;
default:
break;
@ -2096,7 +2096,7 @@ jsval ccvaluemap_to_jsval(JSContext* cx, const cocos2d::ValueMap& v)
return OBJECT_TO_JSVAL(jsRet);
}
jsval ccintvaluemap_to_jsval(JSContext* cx, const cocos2d::IntValueMap& v)
jsval ccvaluemapintkey_to_jsval(JSContext* cx, const cocos2d::ValueMapIntKey& v)
{
JSObject* jsRet = JS_NewObject(cx, NULL, NULL, NULL);
@ -2131,7 +2131,7 @@ jsval ccintvaluemap_to_jsval(JSContext* cx, const cocos2d::IntValueMap& v)
dictElement = ccvaluemap_to_jsval(cx, obj.asValueMap());
break;
case Value::Type::INT_KEY_MAP:
dictElement = ccintvaluemap_to_jsval(cx, obj.asIntKeyMap());
dictElement = ccvaluemapintkey_to_jsval(cx, obj.asIntKeyMap());
break;
default:
break;
@ -2176,7 +2176,7 @@ jsval ccvaluevector_to_jsval(JSContext* cx, const cocos2d::ValueVector& v)
arrElement = ccvaluemap_to_jsval(cx, obj.asValueMap());
break;
case Value::Type::INT_KEY_MAP:
arrElement = ccintvaluemap_to_jsval(cx, obj.asIntKeyMap());
arrElement = ccvaluemapintkey_to_jsval(cx, obj.asIntKeyMap());
break;
default:
break;

View File

@ -149,7 +149,7 @@ JSBool jsval_to_ccvector(JSContext* cx, jsval v, cocos2d::Vector<T>* ret)
JSBool jsval_to_ccvalue(JSContext* cx, jsval v, cocos2d::Value* ret);
JSBool jsval_to_ccvaluemap(JSContext* cx, jsval v, cocos2d::ValueMap* ret);
JSBool jsval_to_ccintvaluemap(JSContext* cx, jsval v, cocos2d::IntValueMap* ret);
JSBool jsval_to_ccvaluemapintkey(JSContext* cx, jsval v, cocos2d::ValueMapIntKey* ret);
JSBool jsval_to_ccvaluevector(JSContext* cx, jsval v, cocos2d::ValueVector* ret);
JSBool jsval_to_ssize( JSContext *cx, jsval vp, ssize_t* ret);
JSBool jsval_to_std_vector_string( JSContext *cx, jsval vp, std::vector<std::string>* ret);
@ -292,7 +292,7 @@ jsval ccmap_string_key_to_jsval(JSContext* cx, const cocos2d::Map<std::string, T
jsval ccvalue_to_jsval(JSContext* cx, const cocos2d::Value& v);
jsval ccvaluemap_to_jsval(JSContext* cx, const cocos2d::ValueMap& v);
jsval ccintvaluemap_to_jsval(JSContext* cx, const cocos2d::IntValueMap& v);
jsval ccvaluemapintkey_to_jsval(JSContext* cx, const cocos2d::ValueMapIntKey& v);
jsval ccvaluevector_to_jsval(JSContext* cx, const cocos2d::ValueVector& v);
jsval ssize_to_jsval(JSContext *cx, ssize_t v);

View File

@ -1253,7 +1253,7 @@ bool luaval_to_ccvaluemap(lua_State* L, int lo, cocos2d::ValueMap* ret)
return ok;
}
bool luaval_to_ccintvaluemap(lua_State* L, int lo, cocos2d::IntValueMap* ret)
bool luaval_to_ccvaluemapintkey(lua_State* L, int lo, cocos2d::ValueMapIntKey* ret)
{
if (nullptr == L || nullptr == ret)
return false;
@ -1274,7 +1274,7 @@ bool luaval_to_ccintvaluemap(lua_State* L, int lo, cocos2d::IntValueMap* ret)
std::string stringValue = "";
int intKey = 0;
bool boolVal = false;
IntValueMap& dict = *ret;
ValueMapIntKey& dict = *ret;
lua_pushnil(L); /* first key L: lotable ..... nil */
while ( 0 != lua_next(L, lo ) ) /* L: lotable ..... key value */
{
@ -1882,7 +1882,7 @@ void ccvalue_to_luaval(lua_State* L,const cocos2d::Value& inValue)
ccvaluemap_to_luaval(L, obj.asValueMap());
break;
case Value::Type::INT_KEY_MAP:
ccintvaluemap_to_luaval(L, obj.asIntKeyMap());
ccvaluemapintkey_to_luaval(L, obj.asIntKeyMap());
break;
default:
break;
@ -1947,7 +1947,7 @@ void ccvaluemap_to_luaval(lua_State* L,const cocos2d::ValueMap& inValue)
case Value::Type::INT_KEY_MAP:
{
lua_pushstring(L, key.c_str());
ccintvaluemap_to_luaval(L, obj.asIntKeyMap());
ccvaluemapintkey_to_luaval(L, obj.asIntKeyMap());
lua_rawset(L, -3);
}
break;
@ -1956,7 +1956,7 @@ void ccvaluemap_to_luaval(lua_State* L,const cocos2d::ValueMap& inValue)
}
}
}
void ccintvaluemap_to_luaval(lua_State* L, const cocos2d::IntValueMap& inValue)
void ccvaluemapintkey_to_luaval(lua_State* L, const cocos2d::ValueMapIntKey& inValue)
{
lua_newtable(L);
@ -2019,7 +2019,7 @@ void ccintvaluemap_to_luaval(lua_State* L, const cocos2d::IntValueMap& inValue)
case Value::Type::INT_KEY_MAP:
{
lua_pushstring(L, key.c_str());
ccintvaluemap_to_luaval(L, obj.asIntKeyMap());
ccvaluemapintkey_to_luaval(L, obj.asIntKeyMap());
lua_rawset(L, -3);
}
break;
@ -2092,7 +2092,7 @@ void ccvaluevector_to_luaval(lua_State* L, const cocos2d::ValueVector& inValue)
case Value::Type::INT_KEY_MAP:
{
lua_pushnumber(L, (lua_Number)index);
ccintvaluemap_to_luaval(L, obj.asIntKeyMap());
ccvaluemapintkey_to_luaval(L, obj.asIntKeyMap());
lua_rawset(L, -3);
++index;
}

View File

@ -166,7 +166,7 @@ bool luaval_to_ccmap_string_key(lua_State* L, int lo, cocos2d::Map<std::string,
extern bool luaval_to_ccvalue(lua_State* L, int lo, cocos2d::Value* ret);
extern bool luaval_to_ccvaluemap(lua_State* L, int lo, cocos2d::ValueMap* ret);
extern bool luaval_to_ccintvaluemap(lua_State* L, int lo, cocos2d::IntValueMap* ret);
extern bool luaval_to_ccvaluemapintkey(lua_State* L, int lo, cocos2d::ValueMapIntKey* ret);
extern bool luaval_to_ccvaluevector(lua_State* L, int lo, cocos2d::ValueVector* ret);
@ -245,6 +245,6 @@ void ccmap_string_key_to_luaval(lua_State* L, const cocos2d::Map<std::string, T>
void ccvalue_to_luaval(lua_State* L,const cocos2d::Value& inValue);
void ccvaluemap_to_luaval(lua_State* L,const cocos2d::ValueMap& inValue);
void ccintvaluemap_to_luaval(lua_State* L, const cocos2d::IntValueMap& inValue);
void ccvaluemapintkey_to_luaval(lua_State* L, const cocos2d::ValueMapIntKey& inValue);
void ccvaluevector_to_luaval(lua_State* L, const cocos2d::ValueVector& inValue);
#endif //__COCOS2DX_SCRIPTING_LUA_COCOS2DXSUPPORT_LUABAISCCONVERSIONS_H__

View File

@ -1026,7 +1026,7 @@ public:
LUA_TableViewDataSource(){}
virtual ~LUA_TableViewDataSource(){}
virtual Size tableCellSizeForIndex(TableView *table, long idx)
virtual Size tableCellSizeForIndex(TableView *table, ssize_t idx)
{
if (nullptr != table )
{
@ -1052,7 +1052,7 @@ public:
return Size::ZERO;
}
virtual TableViewCell* tableCellAtIndex(TableView *table, long idx)
virtual TableViewCell* tableCellAtIndex(TableView *table, ssize_t idx)
{
if (nullptr != table )
{
@ -1078,7 +1078,7 @@ public:
return NULL;
}
virtual long numberOfCellsInTableView(TableView *table)
virtual ssize_t numberOfCellsInTableView(TableView *table)
{
if (nullptr != table )
{
@ -1094,7 +1094,7 @@ public:
Double* numbers = dynamic_cast<Double*>(resultArray.getObjectAtIndex(0));
if (NULL != numbers)
{
return (long)numbers->getValue();
return (ssize_t)numbers->getValue();
}
}
}

View File

@ -129,7 +129,7 @@ public:
*
* @return number of cells
*/
virtual long numberOfCellsInTableView(TableView *table) = 0;
virtual ssize_t numberOfCellsInTableView(TableView *table) = 0;
};

View File

@ -41,13 +41,11 @@ add_executable(${APP_NAME}
${SAMPLE_SRC}
)
#get our resources
add_custom_command(TARGET ${APP_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/Resources ${CMAKE_CURRENT_BINARY_DIR})
if(WIN32 AND MSVC)
#get our resources
add_custom_command(TARGET ${APP_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/Resources ${CMAKE_CURRENT_BINARY_DIR})
#get our dlls
add_custom_command(TARGET ${APP_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
@ -62,6 +60,16 @@ if(WIN32 AND MSVC)
#Visual Studio Defaults to wrong type
set_target_properties(${APP_NAME} PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:WINDOWS")
set_target_properties(${APP_NAME} PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS")
else()
set(APP_BIN_DIR "${CMAKE_SOURCE_DIR}/bin/${APP_NAME}")
set_target_properties(${APP_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}")
pre_build(${APP_NAME}
COMMAND ${CMAKE_COMMAND} -E remove_directory ${APP_BIN_DIR}/Resources
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Resources ${APP_BIN_DIR}/Resources
)
endif()
target_link_libraries(${APP_NAME} audio cocos2d)

View File

@ -96,7 +96,7 @@ TableViewCell* TableViewTestLayer::tableCellAtIndex(TableView *table, ssize_t id
return cell;
}
long TableViewTestLayer::numberOfCellsInTableView(TableView *table)
ssize_t TableViewTestLayer::numberOfCellsInTableView(TableView *table)
{
return 20;
}

View File

@ -20,7 +20,7 @@ public:
virtual void tableCellTouched(cocos2d::extension::TableView* table, cocos2d::extension::TableViewCell* cell);
virtual cocos2d::Size tableCellSizeForIndex(cocos2d::extension::TableView *table, ssize_t idx);
virtual cocos2d::extension::TableViewCell* tableCellAtIndex(cocos2d::extension::TableView *table, ssize_t idx);
virtual long numberOfCellsInTableView(cocos2d::extension::TableView *table);
virtual ssize_t numberOfCellsInTableView(cocos2d::extension::TableView *table);
};
#endif // __TABLEVIEWTESTSCENE_H__

@ -1 +1 @@
Subproject commit 6e880d8843dd51fb5c4094f2672c7c846bb85401
Subproject commit c842ccaa4b31121ac5f7be99ca64cafeb8d422c5