Commit Graph

12455 Commits

Author SHA1 Message Date
minggo 8460fb53e7 remove duplicate codes (#16860) 2016-11-18 09:27:37 +08:00
CocosRobot 7c6f0598b2 [ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json automatically (#16861) 2016-11-18 09:27:20 +08:00
Adrien de Sentenac 460c68125f Use resolved file name (through dictionary lookup) in font atlas creation (#16797)
* Use resolved file name (through dictionary lookup) in font atlas creation, to prevent creating multiple atlases for the same file.
Add font tests with and without font name replacement (through dictionary lookup).

* Fix cpp-tests xcode and cmake project

* Additional fix for cmake project
2016-11-18 09:23:44 +08:00
pyrosphere 663bb4d7ed No CC_UNUSED_PARAM (#16812)
* Added -Wno-unused-parameter and removed all uses of the CC_UNUSED_PARAM macro

* Commented unused parameter names in .cpp files which previously used CC_UNUSED_PARAM

* Reverted -Wno-unused-param flag.
Moved deprecated touch methods definitions to .cpp file.
Commented more unused parameter names.

* Fixed some errors and warnings caused by the previous commit.

* Commented remaining unused parameter names in .cpp files.

* Fixed unused parameter warnings in headers.

* Fixed some more unused parameter warnings.

* Fixed some more unused parameters warnings.

* Fixed mistake in previous commit, missing ComAudioReader:: in method. Other warnings.

* Fixed build errors.

* Added missing file to CMakeLists
2016-11-16 09:48:37 +08:00
pyrosphere ae48e0bf69 Android setMultipleTouchEnabled (#16830)
* Added method to switch between single and multitouch on Android.

* Moved variable definitions to the beginning of the class. Handle single touch for ACTION_MOVE and ACTION_CANCEL.

* Cleaner code by using if/else instead of break
2016-11-16 09:41:07 +08:00
子龙山人 ee8305ed52 fix editbox can't input on macos 10.12 (#16842)
* fix editbox can't input on macos 10.12

fix editbox can't input characters on mac os 10.12

* update external to 114
2016-11-16 09:38:42 +08:00
Tate Allen f99dae383f Fixed math error (issue #16837) in Lua function radian2angle (#16848) 2016-11-16 09:35:47 +08:00
James Chen e1e6ac1760 Removes unused rapjson includes. (#16839) 2016-11-14 14:13:33 +08:00
yahont a429469d62 required check for nullptr with new(std::nothrow) (#16822)
* tequired check for new

* check for init()'s return value too; deleting unused texture
2016-11-14 10:05:26 +08:00
UQ Times 0d2e58b9da fix compile error if "USE_STD_UNORDERED_MAP == 0". (#16831) 2016-11-14 10:00:55 +08:00
子龙山人 2e2b9b81e4 fix missing chinese characters when using ttf label (#16832) 2016-11-14 09:51:30 +08:00
Wilson E. Alvarez fd6e10f0f5 Let FMOD autodetect the best output mode for Linux (#16819)
Thanks to filippovdaniil for the suggestion
2016-11-10 11:30:30 +08:00
CocosRobot d0705d9e25 [ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json automatically (#16828) 2016-11-09 17:33:47 +08:00
samael c6f98cd95b jsb.addRoot is not a function (#16509)
* jsb.addRoot is not a function

jsb.addRoot is not a function

* Update jsb_cocos2d.js

remove jsb._root
2016-11-09 15:19:32 +08:00
Josh Bodily c3c6681b9e Add Horizontal Text Alignment to UIEditBox (#16772)
* Add Horizontal Text Alignment to UIEditBox

* Fix compile error

* Fix win32 compile
2016-11-09 10:38:00 +08:00
yahont e9b39a99e2 cocos2dInternal cleaned of some warnings (#16818)
* cocos2dInternal cleaned of some warnings: unused parameters and signed-unsigned comparisons

* -Werror removed

* tab fixed

* indent fixed

* more warnings fixed
2016-11-09 10:34:50 +08:00
David DeSimone fb9c1f2de0 Fixed EditBox placeholder font not being set correctly for multiline text fields on iOS. (#16821) 2016-11-09 10:27:34 +08:00
Ce Zheng 4b3525f7a8 use STL emplace when possible (#16815)
* replaced some unordered_map::insert(std::make_pair(foo, bar)) with unordered_map::emplace(foo, bar)
* replaced some vector::push_back(std::make_pair(foo, bar)) with vector::emplace_back(foo, bar)

The old way will construct a std::pair first then call move constructor
when putting it into the container, while using emplace will construct
the pair in-place in the container. Also, the emplace way is shorter &
more concise.
2016-11-08 11:50:00 +08:00
CocosRobot 2d18d703a0 [ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json automatically (#16810) 2016-11-04 14:07:25 +08:00
David DeSimone 9204c87cfc Adding performance.now() to cocos2d-js. (#16766)
* Adding performance.now() to cocos2d-js. See https://developer.mozilla.org/en-US/docs/Web/API/Performance/now

* Fixing improper logic for converting from microseconds, to milliseconds with micro-precision

* Adding performance.now tests
2016-11-04 11:58:48 +08:00
minggo fa02f24f0d add fbs files needed to update flatbuffer (#16808) 2016-11-04 10:13:06 +08:00
n2omatt 6be4ec8ee5 Add new methods to get the number of actions running in a given node with a specific tag. (#16789)
* Add new methods to get the number of actions running in a
given node with a specific tag.

This is useful for cases that we want to know how many
animations with a **specific** tag is running in our target.
For example:

auto tag1Count = this->getNumberOfRunningActionsByTag(kMyTag1);
auto tag2Count = this->getNumberOfRunningActionsByTag(kMyTag2);

While this could be achieved (more or less) with callbacks
to increment the tagCount at start of action and decrement
at the end the proposed API is much more concise and less error
prone.

* Replace the old C casts to static_casts.

As discussed in #16789 issue thread @minggo asked
to change the old style of cast to newer, more safer
static_casts.

* Add the required parenthesis and normalize the spaces.

Normalize all the static_cast<Action *> to static_cast<Action*>
some places we have spaces, other places haven't.

Fix the missing parenthesis.
2016-11-04 09:41:03 +08:00
Josh Bodily e20c1e0a9a Misc. UIEditBoxImpl-winrt fixes (#16773)
* SENSITIVE doesn't imply password, fixes crash on static cast in
* onTextChanged
* Fix type fontName instead of pFontName
* Set attributes that affect text content before setting initial text
2016-11-04 09:38:48 +08:00
James Chen 7e14812240 fixed #16492: RapidJSON Crashes in Release mode on Android. (#16792)
* fixed #16492: RapidJSON Crashes in Release mode on Android.

* Updates external/config.json

* json/filestream.h -> json/filereadstream.h
2016-11-04 09:36:59 +08:00
James Chen f32effeb96 More: Uses c++11 multi-line string literal (#16803) 2016-11-04 09:36:26 +08:00
CocosRobot 9eb177c6cc [ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json automatically (#16802) 2016-11-03 15:29:09 +08:00
Josh Bodily 9f31a1e43c Add reason for edit end to UIEditBoxDelegate (#16771)
* Add reason for edit end to UIEditBoxDelegate

* Adds "NEXT" action button for iOS and Android for easier form
* navigation

* Fix compile error
2016-11-03 14:02:53 +08:00
Guy 925b4fa96f Update CCObjLoader.cpp (#16790)
In the case of a simple MTL file such as 

newmtl cube
  Ns 10.0000
  Ni 1.5000
  d 1.0000
  Tr 0.0000
  Tf 1.0000 1.0000 1.0000 
  illum 2
  Ka 0.0000 0.0000 0.0000
  Kd 0.5880 0.5880 0.5880
  Ks 0.0000 0.0000 0.0000
  Ke 0.0000 0.0000 0.0000
  map_Ka cube.png
  map_Kd cube.png

The entire istringstream would be consumed by LoadMTL and result in a 'not found' error due to the null check being in the wrong place
2016-11-02 10:22:48 -07:00
ggggamer 54d6321ff3 Support float line width (#16781)
glLineWidth use float but CCDrawNode use int
2016-11-02 17:48:26 +08:00
Bin Zhang 3b87e46280 Support compile & run project on Tizen by cocos command. (#16783)
* Add config files for build engine source code on tizen.

* Add config files for cpp-empty-test on tizen.

* Add missing files.

* Add config files for cpp-tests on tizen.

* Add Tizen config files for lua-bindings.

* Add Tizen config files for lua-empty-test.

* Solve the error when build lua-empty-test for Tizen.

* Add Tizen config files for lua-tests.

* Solve the error when build lua-tests for Tizen.

* Add tizen config files for templates.

* Update submodule cocos2d-console.
2016-11-02 17:41:26 +08:00
James Chen e183160efe fixed #16787: Removes unused code of 'if (sizeof(Vec2) == sizeof(Vec2)'. (#16791) 2016-11-02 17:27:49 +08:00
Wilson E. Alvarez d5dacd4f0e Use C++11 multiline string literal instead (#16765)
* Undo pull request #16742 while keeping fixed indentation on ccShader_UI_Gray.frag

* Removed unnecessary whitespace

* Switched implementation to C++11 string literal

Thanks to stevetranby for the suggestion
2016-11-02 14:13:34 +08:00
Paul Gardiner a888f42d7f Lua: have cc.Ray:intersects additionally return the distance (#16677)
cc.Ray:intersects now returns two results, an indication of hit or
not, plus the distance along the ray. The function can still be called
expecting a single argument and hence is backward compatible.

Also correct the debug error message
2016-11-02 09:45:24 +08:00
Josh Bodily 40b5c9f4b7 Mac edit box bug fixes (#16656)
* Don't allow multiline to overflow bounds of box
* Fix bug w/ performSelector
2016-10-31 15:16:18 +08:00
子龙山人 1a258f7ed4 Merge pull request #16776 from CocosRobot/update_lua_bindings_1477789224
[ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json automatically
2016-10-31 00:01:08 -07:00
pyrosphere 1667a5c444 Toggle between windowed/fullscreen on desktop (#16762)
* GLViewImpl methods for desktop window management - toggle between fullscreen/windowed

* Window management tests (mac)

* Added window management tests to Win32 and Linux

* Added const keyword. Removed platform macros.
2016-10-31 14:02:02 +08:00
chgowolf ef380298bb fix issue#16756 tileGid may overflow when use horizontal flip (#16758)
* tileGid may overflow when use horizontal flip

kTMXTileHorizontalFlag = 0x80000000
when use horizontal flip, gid will bigger chan 0x7FFFFFFF

* use unsigned int to convert string to gid
2016-10-31 10:42:09 +08:00
James Chen cc1b7808f0 fixed #16735: [native] The behavior of (setRotation + setSkewX) is wrong (#16736)
* fixed #16735: [native] The behavior of (setRotation + setSkewX) is wrong.
Since I removed some logic, this patch may also improve a little bit performance.

* Adds test case for issue #16735
2016-10-31 10:29:04 +08:00
CocosRobot#Set 57903077d0 [ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json automatically 2016-10-30 01:00:27 +00:00
Ricardo Quesada e0809d869c Sprite::capInsets -> Sprite::centerRect (#16770)
* Sprite::capInsets -> Sprite::centerRect

as requested by @minggo

* fixes flip issues in Sprite with slice 9
2016-10-29 17:52:33 -07:00
CocosRobot 3ab1be61a7 [ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json automatically (#16764) 2016-10-28 10:13:57 +08:00
James Chen 609750ef58 fixed #16754: [android] Background music which is playing could not be paused while game enters background. (#16755)
* fixed #16754: [android] Background music which is playing could not be paused while game enters background.

* Updates a comment of cocos/audio/android/AudioEngine-inl.h
2016-10-28 10:12:52 +08:00
SongChengJiang af8b9cc47c Support MultiView matrix array (#16723)
* Support MultiView matrix array

Support MultiView matrix array and add new interface in GLProgram to
support shader header definitions.

* support getMatrixStackSize

* optimize code

* remove indents

* rename resetMatrixStack(unsigned int stackCount)

* Add document to interfaces

* Supplement document of render interface
2016-10-28 09:33:31 +08:00
pandamicro e4170a7b02 Improve JS bindings (#16751)
* Fix tests for v3.12 web

* Improve scheduler wrapper

* Update web engine ref

* Fix leak: js_remove_object_reference can not remove non binding objects

* Fix ScriptingCore::evalString

* Add missed `__cppCreated` for JS create objects

* Fix manifest path issue
2016-10-28 09:29:56 +08:00
zloopnew ed2dac1ba4 Mesh* Sprite3D::getMesh() should return nullptr when _meshes.empty() is true (#16711) 2016-10-27 15:20:41 +08:00
Wilson E. Alvarez c0e1e91373 Performance tweak: Use range-based for-loops and allocate std::vector size() and *end() on the stack where favorable. (#16716)
* Use range-based for-loops and allocate std::vector size(), end(), cend(), rend(), crend() on the stack where favorable.

Other minor trivial changes were applied.

* Fixed Android compilation error

* Fixed windows-universal compilation error
2016-10-27 15:10:24 +08:00
CocosRobot 44f6865697 [ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json automatically (#16750) 2016-10-27 11:15:24 +08:00
niu2x 92af2b2b6f bug fix (#16747) 2016-10-27 09:46:07 +08:00
Ricardo Quesada 323ea7c0d4 Sprite scale9 (#16702)
* Adds slice9 support for Sprite.

how to use it:

// points coords
sprite->setCenterRect(Rect(x,y,w,h));

// normalized coords
sprite->setCenterRectNormalized(Rect(x,y,w,h));
starts scale9sprite in sprite

more slice 9 changes

sprite 9 slice works?

kind of works

correct anchor point

slice 9 works, at least with non-rotated atlases

streched works ok

better Y invert code.

cleaner, compatible with the previous code

yay, scaling workings...

need a better api now

sets scale correctly

yay! works as expected!

more fixes and tests

better test for box

setContentSize() changes size in non-9-slice mode sprites as well

setCenterRect() -> setCenterRectNormalized()

yet another test

adds setPositionNormalized()

adds setCenterRect() tests

remove devel team from xcode

tests: add one more tests

fun test!

improved test

yet another test for slice 9

* fixes anchorPoint issues

* adds documentation

* fix: using top-left coordinate for setRect

* sprite: fixes related to scale9 and tiled

* Sprite: slice 9 fixes

works Ok with rotated frames
uses `setCapInsets` instead of `setCenterRect` to be more familiar
with `UIScale9Sprite`

* fixes js and lua bindings for Autopolygon
2016-10-26 18:45:40 -07:00
James Chen 58acca108b Removes unused 'return' letter in builtin shaders. (#16742)
* Removes unused 'return' letter in builtin shader.

* Updates indention of ccShader_UI_Gray.frag.
2016-10-26 16:03:08 +08:00