mirror of https://github.com/axmolengine/axmol.git
commit
965ea379a7
|
@ -215,8 +215,8 @@ protected:
|
|||
|
||||
bool _isRackShow = false;
|
||||
cocos2d::Color4F _rackColor = cocos2d::Color4F::WHITE;
|
||||
int _rackLength = 50;
|
||||
int _rackWidth = 20;
|
||||
float _rackLength = 50.0f;
|
||||
float _rackWidth = 20.0f;
|
||||
|
||||
cocos2d::Vector<BoneNode*> _childBones;
|
||||
cocos2d::Vector<SkinNode*> _boneSkins;
|
||||
|
|
|
@ -2798,7 +2798,7 @@ static int tolua_cocos2d_Spawn_create(lua_State* tolua_S)
|
|||
if (argc > 0)
|
||||
{
|
||||
Vector<FiniteTimeAction*> array;
|
||||
uint32_t i = 1;
|
||||
int i = 1;
|
||||
|
||||
if (1 == argc && tolua_istable(tolua_S, 2, 0, &tolua_err))
|
||||
{
|
||||
|
@ -2890,7 +2890,7 @@ int lua_cocos2d_CardinalSplineBy_create(lua_State* tolua_S)
|
|||
}
|
||||
|
||||
CC_SAFE_DELETE_ARRAY(arr);
|
||||
CardinalSplineBy* tolua_ret = CardinalSplineBy::create(dur, points, ten);
|
||||
CardinalSplineBy* tolua_ret = CardinalSplineBy::create((float)dur, points, (float)ten);
|
||||
if (NULL != tolua_ret)
|
||||
{
|
||||
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
|
||||
|
@ -2954,7 +2954,7 @@ int tolua_cocos2d_CatmullRomBy_create(lua_State* tolua_S)
|
|||
}
|
||||
|
||||
CC_SAFE_DELETE_ARRAY(arr);
|
||||
CatmullRomBy* tolua_ret = CatmullRomBy::create(dur, points);
|
||||
CatmullRomBy* tolua_ret = CatmullRomBy::create((float)dur, points);
|
||||
if (NULL != tolua_ret)
|
||||
{
|
||||
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
|
||||
|
@ -3018,7 +3018,7 @@ int tolua_cocos2d_CatmullRomTo_create(lua_State* tolua_S)
|
|||
}
|
||||
|
||||
CC_SAFE_DELETE_ARRAY(arr);
|
||||
CatmullRomTo* tolua_ret = CatmullRomTo::create(dur, points);
|
||||
CatmullRomTo* tolua_ret = CatmullRomTo::create((float)dur, points);
|
||||
if (NULL != tolua_ret)
|
||||
{
|
||||
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
|
||||
|
@ -3079,7 +3079,7 @@ int tolua_cocos2d_BezierBy_create(lua_State* tolua_S)
|
|||
config.endPosition = arr[2];
|
||||
CC_SAFE_DELETE_ARRAY(arr);
|
||||
|
||||
BezierBy* tolua_ret = BezierBy::create(t, config);
|
||||
BezierBy* tolua_ret = BezierBy::create((float)t, config);
|
||||
if (NULL != tolua_ret)
|
||||
{
|
||||
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
|
||||
|
@ -3139,7 +3139,7 @@ int tolua_cocos2d_BezierTo_create(lua_State* tolua_S)
|
|||
config.endPosition = arr[2];
|
||||
CC_SAFE_DELETE_ARRAY(arr);
|
||||
|
||||
BezierTo* tolua_ret = BezierTo::create(t, config);
|
||||
BezierTo* tolua_ret = BezierTo::create((float)t, config);
|
||||
if (NULL != tolua_ret)
|
||||
{
|
||||
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
|
||||
|
@ -3194,7 +3194,7 @@ static int tolua_cocos2dx_DrawNode_drawPolygon(lua_State* tolua_S)
|
|||
goto tolua_lerror;
|
||||
}
|
||||
#endif
|
||||
size_t size = lua_tonumber(tolua_S, 3);
|
||||
int size = lua_tointeger(tolua_S, 3);
|
||||
if ( size > 0 )
|
||||
{
|
||||
cocos2d::Vec2* points = new (std::nothrow) cocos2d::Vec2[size];
|
||||
|
@ -3287,7 +3287,7 @@ int tolua_cocos2dx_DrawNode_drawSolidPoly(lua_State* tolua_S)
|
|||
if (NULL == points)
|
||||
return 0;
|
||||
|
||||
for (int i = 0; i < size; i++)
|
||||
for (unsigned int i = 0; i < size; i++)
|
||||
{
|
||||
lua_pushnumber(tolua_S,i + 1);
|
||||
lua_gettable(tolua_S,2);
|
||||
|
@ -3366,7 +3366,7 @@ int tolua_cocos2dx_DrawNode_drawPoly(lua_State* tolua_S)
|
|||
if (NULL == points)
|
||||
return 0;
|
||||
|
||||
for (int i = 0; i < size; i++)
|
||||
for (unsigned int i = 0; i < size; i++)
|
||||
{
|
||||
lua_pushnumber(tolua_S,i + 1);
|
||||
lua_gettable(tolua_S,2);
|
||||
|
@ -3464,7 +3464,7 @@ int tolua_cocos2dx_DrawNode_drawCardinalSpline(lua_State* tolua_S)
|
|||
ok &= luaval_to_color4f(tolua_S, 5, &arg3, "cc.DrawNode:drawCardinalSpline");
|
||||
if(!ok)
|
||||
return 0;
|
||||
self->drawCardinalSpline(config, arg1, arg2, arg3);
|
||||
self->drawCardinalSpline(config, (float)arg1, arg2, arg3);
|
||||
return 0;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode:drawCardinalSpline",argc, 4);
|
||||
|
@ -3574,7 +3574,7 @@ int tolua_cocos2dx_DrawNode_drawPoints(lua_State* tolua_S)
|
|||
if (NULL == points)
|
||||
return 0;
|
||||
|
||||
for (int i = 0; i < size; i++)
|
||||
for (unsigned int i = 0; i < size; i++)
|
||||
{
|
||||
lua_pushnumber(tolua_S,i + 1);
|
||||
lua_gettable(tolua_S,2);
|
||||
|
@ -3614,7 +3614,7 @@ int tolua_cocos2dx_DrawNode_drawPoints(lua_State* tolua_S)
|
|||
if (nullptr == points)
|
||||
return 0;
|
||||
|
||||
for (int i = 0; i < size; i++)
|
||||
for (unsigned int i = 0; i < size; i++)
|
||||
{
|
||||
lua_pushnumber(tolua_S,i + 1);
|
||||
lua_gettable(tolua_S,2);
|
||||
|
@ -6153,8 +6153,8 @@ static int lua_cocos2dx_Label_createWithTTF00(lua_State* L)
|
|||
return 0;
|
||||
|
||||
|
||||
int alignment = tolua_tonumber(L, 4, 1);
|
||||
int lineSize = tolua_tonumber(L, 5, 0);
|
||||
int alignment = (int)tolua_tonumber(L, 4, 1);
|
||||
int lineSize = (int)tolua_tonumber(L, 5, 0);
|
||||
cocos2d::Label* ret = cocos2d::Label::createWithTTF(ttfConfig, text, static_cast<TextHAlignment>(alignment), lineSize);
|
||||
int ID = ret ? (int)(ret->_ID) : -1;
|
||||
int* luaID = ret ? &(ret->_luaID) : nullptr;
|
||||
|
@ -6197,7 +6197,7 @@ static int lua_cocos2dx_Label_createWithTTF01(lua_State* L)
|
|||
{
|
||||
std::string text = tolua_tostring(L, 2, "");
|
||||
std::string fontFile = tolua_tostring(L, 3, "");
|
||||
float fontSize = tolua_tonumber(L, 4, 0);
|
||||
float fontSize = (float)tolua_tonumber(L, 4, 0);
|
||||
cocos2d::Size dimensions = cocos2d::Size::ZERO;
|
||||
if (lua_istable(L, 5))
|
||||
{
|
||||
|
@ -6420,7 +6420,7 @@ static int lua_cocos2dx_Console_addCommand(lua_State* tolua_S)
|
|||
handler = ( toluafix_ref_function(tolua_S,3,0));
|
||||
ScriptHandlerMgr::getInstance()->addCustomHandler((void*)cobj, handler);
|
||||
|
||||
struct Console::Command outValue = {
|
||||
Console::Command outValue = {
|
||||
name,
|
||||
help,
|
||||
[=](int fd, const std::string& args)
|
||||
|
@ -6642,7 +6642,7 @@ int lua_cocos2dx_TMXLayer_setTiles(lua_State* tolua_S)
|
|||
return 0;
|
||||
}
|
||||
|
||||
for (int i = 1 ; i <= len; i++)
|
||||
for (size_t i = 1 ; i <= len; i++)
|
||||
{
|
||||
arg0[i - 1] = (uint32_t)tolua_tofieldnumber(tolua_S, 2, i, 0);
|
||||
}
|
||||
|
@ -7513,7 +7513,7 @@ int lua_cocos2dx_AutoPolygon_generatePolygon(lua_State* tolua_S)
|
|||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_AutoPolygon_generatePolygon'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cocos2d::PolygonInfo* ret = new (std::nothrow) cocos2d::PolygonInfo(cocos2d::AutoPolygon::generatePolygon(arg0, arg1, arg2));
|
||||
cocos2d::PolygonInfo* ret = new (std::nothrow) cocos2d::PolygonInfo(cocos2d::AutoPolygon::generatePolygon(arg0, arg1, (float)arg2));
|
||||
object_to_luaval<cocos2d::PolygonInfo>(tolua_S, "cc.PolygonInfo",(cocos2d::PolygonInfo*)ret);
|
||||
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
|
||||
return 1;
|
||||
|
@ -7533,7 +7533,7 @@ int lua_cocos2dx_AutoPolygon_generatePolygon(lua_State* tolua_S)
|
|||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_AutoPolygon_generatePolygon'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cocos2d::PolygonInfo* ret = new (std::nothrow) cocos2d::PolygonInfo(cocos2d::AutoPolygon::generatePolygon(arg0, arg1, arg2, arg3));
|
||||
cocos2d::PolygonInfo* ret = new (std::nothrow) cocos2d::PolygonInfo(cocos2d::AutoPolygon::generatePolygon(arg0, arg1, (float)arg2, (float)arg3));
|
||||
object_to_luaval<cocos2d::PolygonInfo>(tolua_S, "cc.PolygonInfo",(cocos2d::PolygonInfo*)ret);
|
||||
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
|
||||
return 1;
|
||||
|
@ -8255,7 +8255,7 @@ int tolua_cocos2d_Mat4_createRotationZ(lua_State* tolua_S)
|
|||
ok &= luaval_to_mat4(tolua_S, 1, &mat);
|
||||
if (!ok)
|
||||
return 0;
|
||||
angle = lua_tonumber(tolua_S, 2);
|
||||
angle = (float)lua_tonumber(tolua_S, 2);
|
||||
cocos2d::Mat4::createRotationZ(angle, &mat);
|
||||
mat4_to_luaval(tolua_S, mat);
|
||||
return 1;
|
||||
|
@ -8785,7 +8785,7 @@ static int tolua_cocos2d_bytearray_intv(lua_State *L)
|
|||
}
|
||||
lua_pop(L, 1);
|
||||
lua_newtable(L);
|
||||
for (auto idx = 0; idx < arg.size(); idx++)
|
||||
for (size_t idx = 0; idx < arg.size(); idx++)
|
||||
{
|
||||
lua_pushnumber(L, arg[idx]);
|
||||
lua_rawseti(L, 1, idx + 1);
|
||||
|
|
|
@ -219,7 +219,7 @@ Vec3 jump(const Vec3* pV1, const Vec3* pV2, float height, float t)
|
|||
pOut.x = pV1->x + t * (pV2->x - pV1->x);
|
||||
pOut.y = pV1->y + t * (pV2->y - pV1->y);
|
||||
pOut.z = pV1->z + t * (pV2->z - pV1->z);
|
||||
pOut.y += height * sinf(M_PI * t);
|
||||
pOut.y += height * sinf((float)M_PI * t);
|
||||
return pOut;
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,7 @@ void NavMeshBaseTestDemo::moveAgents(const cocos2d::Vec3 &des)
|
|||
void NavMeshBaseTestDemo::update(float delta)
|
||||
{
|
||||
for (auto iter : _agents){
|
||||
float speed = iter.first->getCurrentVelocity().length() * 0.2;
|
||||
float speed = iter.first->getCurrentVelocity().length() * 0.2f;
|
||||
iter.second->setSpeed(0.0f < speed ? speed : 0.0f);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ bool UIEditBoxTest::init()
|
|||
_editName->setPlaceHolder("Name:");
|
||||
_editName->setPlaceholderFontColor(Color3B::WHITE);
|
||||
_editName->setMaxLength(8);
|
||||
_editName->setFontSize(editBoxSize.height/2);
|
||||
_editName->setFontSize((int)editBoxSize.height/2);
|
||||
_editName->setText("v👐👊💝");
|
||||
_editName->setReturnType(ui::EditBox::KeyboardReturnType::DONE);
|
||||
_editName->setDelegate(this);
|
||||
|
@ -93,7 +93,7 @@ bool UIEditBoxTest::init()
|
|||
_editPassword->setMaxLength(6);
|
||||
_editPassword->setInputFlag(ui::EditBox::InputFlag::PASSWORD);
|
||||
_editPassword->setInputMode(ui::EditBox::InputMode::SINGLE_LINE);
|
||||
_editPassword->setFontSize(editBoxSize.height/2);
|
||||
_editPassword->setFontSize((int)editBoxSize.height/2);
|
||||
_editPassword->setDelegate(this);
|
||||
_editPassword->setVisible(true);
|
||||
addChild(_editPassword);
|
||||
|
@ -190,7 +190,7 @@ bool UIEditBoxTestToggleVisibility::init()
|
|||
addChild(_TTFShowEditReturn);
|
||||
|
||||
|
||||
auto editBoxSize = Size(visibleSize.width - 100, visibleSize.height * 0.1);
|
||||
auto editBoxSize = Size(visibleSize.width - 100, visibleSize.height * 0.1f);
|
||||
|
||||
// top
|
||||
std::string pNormalSprite = "extensions/green_edit.png";
|
||||
|
@ -200,7 +200,7 @@ bool UIEditBoxTestToggleVisibility::init()
|
|||
_editName->setPlaceHolder("Name:");
|
||||
_editName->setPlaceholderFontColor(Color3B::WHITE);
|
||||
_editName->setMaxLength(8);
|
||||
_editName->setFontSize(editBoxSize.height/2);
|
||||
_editName->setFontSize((int)editBoxSize.height/2);
|
||||
_editName->setText("v👐👊💝");
|
||||
_editName->setReturnType(ui::EditBox::KeyboardReturnType::DONE);
|
||||
_editName->setDelegate(this);
|
||||
|
@ -225,7 +225,7 @@ bool UIEditBoxTestToggleVisibility::init()
|
|||
_editPassword->setMaxLength(6);
|
||||
_editPassword->setInputFlag(ui::EditBox::InputFlag::PASSWORD);
|
||||
_editPassword->setInputMode(ui::EditBox::InputMode::SINGLE_LINE);
|
||||
_editPassword->setFontSize(editBoxSize.height/2);
|
||||
_editPassword->setFontSize((float)editBoxSize.height/2);
|
||||
_editPassword->setDelegate(this);
|
||||
_editPassword->setVisible(true);
|
||||
addChild(_editPassword);
|
||||
|
@ -307,27 +307,27 @@ bool UIEditBoxTestTextHorizontalAlignment::init() {
|
|||
const auto glview = Director::getInstance()->getOpenGLView();
|
||||
const auto visibleOrigin = glview->getVisibleOrigin();
|
||||
const auto visibleSize = glview->getVisibleSize();
|
||||
const auto editBoxSize = Size(visibleSize.width - 100, visibleSize.height * 0.1);
|
||||
const auto editBoxSize = Size(visibleSize.width - 100, visibleSize.height * 0.1f);
|
||||
|
||||
const auto createEditBox = [this, editBoxSize, visibleOrigin, visibleSize](const std::string& text,
|
||||
const TextHAlignment alignment,
|
||||
const int position_y) {
|
||||
ui::EditBox* editbox = ui::EditBox::create(editBoxSize + Size(0,40), ui::Scale9Sprite::create("extensions/green_edit.png"));
|
||||
editbox->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2-50, position_y));
|
||||
editbox->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2-50, (float)position_y));
|
||||
editbox->setFontColor(Color3B::RED);
|
||||
editbox->setPlaceHolder(text.c_str());
|
||||
editbox->setPlaceholderFontColor(Color3B::WHITE);
|
||||
editbox->setPlaceholderFontSize(editBoxSize.height/2);
|
||||
editbox->setFontSize(editBoxSize.height/2);
|
||||
editbox->setPlaceholderFontSize((int)editBoxSize.height/2);
|
||||
editbox->setFontSize((int)editBoxSize.height/2);
|
||||
editbox->setText(text.c_str());
|
||||
editbox->setTextHorizontalAlignment(alignment);
|
||||
editbox->setReturnType(ui::EditBox::KeyboardReturnType::DONE);
|
||||
addChild(editbox);
|
||||
};
|
||||
|
||||
createEditBox("horizontal left text", TextHAlignment::LEFT, visibleOrigin.y+visibleSize.height*3/4);
|
||||
createEditBox("horizontal center text", TextHAlignment::CENTER, visibleOrigin.y+visibleSize.height/2);
|
||||
createEditBox("horizontal right text", TextHAlignment::RIGHT, visibleOrigin.y+visibleSize.height/4);
|
||||
createEditBox("horizontal left text", TextHAlignment::LEFT, (int)(visibleOrigin.y+visibleSize.height*3/4));
|
||||
createEditBox("horizontal center text", TextHAlignment::CENTER, (int)(visibleOrigin.y+visibleSize.height/2));
|
||||
createEditBox("horizontal right text", TextHAlignment::RIGHT, (int)(visibleOrigin.y+visibleSize.height/4));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -341,15 +341,15 @@ bool UIEditBoxTestPressedAndDisabled::init() {
|
|||
auto glview = Director::getInstance()->getOpenGLView();
|
||||
auto visibleOrigin = glview->getVisibleOrigin();
|
||||
auto visibleSize = glview->getVisibleSize();
|
||||
const auto editBoxSize = Size(visibleSize.width - 100, visibleSize.height * 0.1);
|
||||
const auto editBoxSize = Size(visibleSize.width - 100, visibleSize.height * 0.1f);
|
||||
|
||||
ui::EditBox* editbox = ui::EditBox::create(editBoxSize + Size(0,40), "extensions/yellow_edit.png", "extensions/orange_edit.png");
|
||||
editbox->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height*3/4));
|
||||
editbox->setFontColor(Color3B::GREEN);
|
||||
editbox->setPlaceHolder("Test Pressed Image");
|
||||
editbox->setPlaceholderFontColor(Color3B::WHITE);
|
||||
editbox->setPlaceholderFontSize(editBoxSize.height/2);
|
||||
editbox->setFontSize(editBoxSize.height/2);
|
||||
editbox->setPlaceholderFontSize((int)editBoxSize.height/2);
|
||||
editbox->setFontSize((int)editBoxSize.height/2);
|
||||
editbox->setReturnType(ui::EditBox::KeyboardReturnType::DONE);
|
||||
addChild(editbox);
|
||||
|
||||
|
@ -358,8 +358,8 @@ bool UIEditBoxTestPressedAndDisabled::init() {
|
|||
editbox->setFontColor(Color3B::GREEN);
|
||||
editbox->setPlaceHolder("Test Disabled Image - green");
|
||||
editbox->setPlaceholderFontColor(Color3B::WHITE);
|
||||
editbox->setPlaceholderFontSize(editBoxSize.height/2);
|
||||
editbox->setFontSize(editBoxSize.height/2);
|
||||
editbox->setPlaceholderFontSize((int)editBoxSize.height/2);
|
||||
editbox->setFontSize((int)editBoxSize.height/2);
|
||||
editbox->setReturnType(ui::EditBox::KeyboardReturnType::DONE);
|
||||
addChild(editbox);
|
||||
editbox->setEnabled(false);
|
||||
|
@ -369,8 +369,8 @@ bool UIEditBoxTestPressedAndDisabled::init() {
|
|||
editbox->setFontColor(Color3B::GREEN);
|
||||
editbox->setPlaceHolder("Disabled Gray effect");
|
||||
editbox->setPlaceholderFontColor(Color3B::WHITE);
|
||||
editbox->setPlaceholderFontSize(editBoxSize.height/2);
|
||||
editbox->setFontSize(editBoxSize.height/2);
|
||||
editbox->setPlaceholderFontSize((int)editBoxSize.height/2);
|
||||
editbox->setFontSize((int)editBoxSize.height/2);
|
||||
editbox->setReturnType(ui::EditBox::KeyboardReturnType::DONE);
|
||||
addChild(editbox);
|
||||
editbox->setEnabled(false);
|
||||
|
|
Loading…
Reference in New Issue