Commit Graph

151 Commits

Author SHA1 Message Date
James Chen f7e003758f issue #4448: Respond to move event if dragging is enabled, no matter whether mouse is in the content of cocos2d::extension::ScrollView. 2014-03-19 17:11:34 +08:00
James Chen 02ee3a52eb closed #4448: Elastic bounce back effect support for cocos2d::extension::ScrollView. 2014-03-19 17:11:34 +08:00
Jeong YunWon 2f1a7ebf42 Elastic bounceback for ScrollView
Add iOS-like elastic bounceback.
If you scroll content of scroll view out of insets,
its content will be scrolled 0.35 of user scrolled distance.
2014-03-18 18:51:07 +09:00
Ricardo Quesada d78304599d Cache working OK.
Performance increased in 20% for static objects.
2014-02-28 16:10:48 -08:00
Ricardo Quesada 6920bec6ef transform object returns the MV
code cleaner.
the kmGL code is altogether
2014-02-28 11:20:53 -08:00
Ricardo Quesada eb66ddd931 visit and draw improved.
`visit()` and `draw()` are improved.
they both receive:
 - `Renderer`
 - `kmMat4` for transformation
 - `bool` whether or not the transform changed from the previous frame

Although `draw` and `visit` are not using the 3 new parameters,
they will start using it in the coming days (or weeks, or months).

Those parameters are needed for:
 - `Renderer` shouldn't be a singleton. There should be one renderer per Director. There could be more than one renderer
 - we should get rid of `kmGLXXX` functions since nodoby knows what is happening. the `kmMat4` is for that.
 - whenever possible, we should try to optimize the multiplications. the `dirty` flag is for that.

We need those changes, so, it is better to change the API now, and not right after v3.0-final is released.
2014-02-27 21:43:54 -08:00
James Chen e59a14f205 Merge pull request #5058 from zhiqiangxu/develop
ScrollView should implement ActionTweenDelegate
2014-02-20 20:33:04 +08:00
James Chen be507f6fda Merge pull request #5059 from zhiqiangxu/useless_code_in_scrollview
delete useless code in deaccelerateScrolling
2014-02-20 20:20:28 +08:00
James Chen 5e6130c92c issue #4058: Get rid of Object ,rename it to Ref. 2014-02-20 10:53:49 +08:00
Ricardo Quesada 7da8c84a75 Renames EGLView -> GLView 2014-01-30 16:51:43 -08:00
Ricardo Quesada 8ecaf49f93 GLView improvements
it is not longer a singleton
it is possible to specify the size
2014-01-23 15:36:55 -08:00
James Chen 9f793f8a9b Warning fixes: 1) getZOrder —> getLocalZOrder. 2) long —> int 2014-01-20 15:03:30 +08:00
Ricardo Quesada 5fcbf42356 GlobalZOrder is used for render priority...
...and not vertexZ

Node::setGlobalZOrder() is used to change that.

Node::setZOrder() -> Node::setLocalZOrder();
2014-01-18 11:38:06 -08:00
Ricardo Quesada 8931d968c0 Renderer uses a float as a key
Instead of using a 64-bit int key with viewport, opaque and depth,
it only uses a 32-bit float with only the depth.
Saves time in:
 - No need to convert the 32-bit float into 24-bit int
 - keys are shorter
2014-01-17 16:08:29 -08:00
Ricardo Quesada 1b5b9da102 compiles on Android
compiles on Android
2014-01-16 21:58:14 -08:00
Ricardo Quesada d0dbf34319 removes "include "cocos2d.h" from cocos2d files 2014-01-16 21:35:58 -08:00
xuzhiqiang 6dc6101357 more useless code 2014-01-14 22:40:02 +08:00
xuzhiqiang 8f76080b15 more useless code 2014-01-14 22:30:38 +08:00
xuzhiqiang f59c969216 delete useless code in deaccelerateScrolling 2014-01-14 21:22:55 +08:00
xuzhiqiang 3a86ec1ead fix compile 2014-01-14 20:36:37 +08:00
xuzhiqiang a2afff85a8 fix compile 2014-01-14 20:33:02 +08:00
xuzhiqiang 1d30bd0d80 fix compile 2014-01-14 20:27:14 +08:00
xuzhiqiang 562fdcf98b CCScrollView should inherit CCActionTweenDelegate 2014-01-14 20:03:12 +08:00
James Chen e93b567000 ScrollView::intWithView supports be invoked several times. 2014-01-07 22:16:24 +08:00
James Chen 5c217f70d1 ScrollView uses new renderer now. 2014-01-07 17:46:24 +08:00
James Chen d1ad635ad8 Merge pull request #4497 from zhiqiangxu/develop
closed #3559: Useless conversion in ScrollView::onTouchBegan
2014-01-01 17:55:41 -08:00
James Chen ed93f90ccc Removes unneeded ‘override’ codes, uses `using Node::addChild;` to prevent compiler warnings. 2013-12-23 16:58:26 +08:00
minggo 756f8f7a11 Merge pull request #4482 from dabingnn/develop_gridNode
Develop grid node
2013-12-19 18:30:42 -08:00
Ricardo Quesada 59fee6b8d2 replaces std::for_each with for()
replaces `std::for_each` with C++11 `for( : )`
2013-12-19 13:34:41 -08:00
Huabing.Xu d51ad36613 Merge branch 'develop' into develop_gridNode
* develop: (67 commits)
  Adds const in ShaderTest2.h
  Skew works again!
  [AUTO] : updating submodule reference to latest autogenerated bindings
  [AUTO] : updating submodule reference to latest autogenerated bindings
  Reverts submodule.
  Updates submodule of bindings-generator.
  Adds `std::for_each` test in invocation
  Reverts bindings-generator.
  fixed not render
  iterator in Sprite fixes
  update vs project for removes unneeded files
  getNodeToParentTransform fixes
  Node cleanup
  [AUTO] : updating submodule reference to latest autogenerated bindings
  Improves SpriteTest
  [AUTO] : updating submodule reference to latest autogenerated bindings
  Android and Linux fixes
  removes `using namespace std` from header file
  Removes unneeded files
  change play arguments
  ...

Conflicts:
	cocos/2d/CCNode.cpp
	samples/Cpp/TestCpp/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp
2013-12-19 17:20:22 +08:00
James Chen d16fa07661 Removes Vector<T>::forEach, please use std::for_each instead. The same as Vector<T>::sort. 2013-12-17 17:45:29 +08:00
xuzhiqiang e8f55069e3 reduce useless convert 2013-12-16 18:20:10 +08:00
Huabing.Xu 5509bd48ef remove _grid 2013-12-12 16:21:21 +08:00
James Chen 499a0404d4 issue #2790: Renames some functions in Vector<T>. Makes it more like stl vector. 2013-12-05 10:35:10 +08:00
James Chen f6676bd7ef issue #2790: [] -> getObjectAtIndex. 2013-12-04 16:02:51 +08:00
James Chen 1d5984b29a issue #2790: Vector::makeObjectsPerformCallback —> Vector::forEach 2013-12-04 16:01:02 +08:00
James Chen 59c2647bd6 Prevents warning of invoking ScrollView::setTouchEnabled. Layer::setTouchEnabled should not be a virtual function. 2013-11-20 11:35:04 +08:00
James Chen 48ce5e39fe EventDispatcher is managed by Director now, like Scheduler and ActionManager. 2013-10-26 15:04:01 +08:00
James Chen 262b54eef2 issue #3069: Updating ScrollView. 2013-10-25 16:06:52 +08:00
James Chen 1f3863e787 Event Dispatcher refactor commit. TestCpp could run. 2013-10-25 10:53:45 +08:00
James Chen cfaef2a01a Adding onEnterHook, onXXXHook for Node. 2013-10-25 10:53:45 +08:00
lite3 c6f9f0e406 do not change anchor point of child. 2013-10-22 11:30:53 +08:00
minggo 4c9771ba3c rename some class names to obey cocos2d-x coding style 2013-09-20 19:19:31 +08:00
James Chen c90291e01d ScrollView::_touches is std::vector now, so it should not be inited by NULL pointer. 2013-09-12 21:02:30 +08:00
James Chen 6f37529236 [dispatcher] Adding 'Node::updateEventPriorityIndex' and making 'Node::addEventId(removeEventId)' method to be private. 2013-09-12 20:47:15 +08:00
James Chen 6a2536b5bd [Dispatcher] Fixing logic errors in CCScrollView after using EventDispatcher. 2013-09-12 16:03:03 +08:00
James Chen 5d95711865 [EventDispatcher] Fixing compilation error after changing of Touch(It doesn't inherit from Object). 2013-09-12 14:42:56 +08:00
James Chen da1101beeb [Dispatcher] New event dispatcher, first commit. 2013-09-11 22:09:34 +08:00
James Chen b8c82ae5a9 [develop] Warning fixes. 2013-09-08 11:26:38 +08:00
Ricardo Quesada d7590affda Merge branch 'develop' into dictionary_array_fixes
Conflicts:
	cocos2dx/cocoa/CCArray.cpp
	cocos2dx/cocoa/CCArray.h
	cocos2dx/label_nodes/CCLabel.cpp
	extensions/CCArmature/datas/CCDatas.cpp
	extensions/CCArmature/display/CCDisplayManager.cpp
2013-08-21 21:27:44 -07:00
minggo d9da52ce86 Merge pull request #3454 from minggo/array-support-sort
Array can be use in stl::sort() when not using vector inside
2013-08-21 20:50:03 -07:00
Ricardo Quesada a3eb0a058e Merge branch 'develop' into dictionary_array_fixes
Conflicts:
	cocos2dx/platform/mac/CCFileUtilsMac.mm
	extensions/CCBReader/CCBAnimationManager.cpp
	extensions/CCBReader/CCBReader.cpp
	extensions/CCBReader/CCBSequenceProperty.cpp
	extensions/GUI/CCScrollView/CCScrollView.cpp
2013-08-21 20:27:19 -07:00
Ricardo Quesada 2e221ee6cc Array & Dictionary fixes
In many places `Dictionary` and `Array` are not being initialized. In fact `Dictionary` doesn't  have the `init()` method creating potential leaks.
Also in objects like `Armature` and the new `LabelTTF`, the `Array` object is not being used a pointer. So it doesn't use the 2 phase initialization, creating potential leaks.

This patch fixes all those issues.

Signed-off-by: Ricardo Quesada <ricardoquesada@gmail.com>
2013-08-21 20:12:09 -07:00
minggo 2de8963a0a fix warnings caused by deprecating some functions of Array 2013-08-22 10:45:47 +08:00
James Chen 1ee7790f0e Initializing Array after it was constructed. 2013-08-22 10:15:47 +08:00
xbruce d2684338a5 Update CCScrollView.cpp
change release mode
2013-08-20 14:58:26 +08:00
minggo f97f7edeb6 Merge pull request #3440 from ricardoquesada/better_array
Better array
2013-08-19 23:39:36 -07:00
James Chen 7e3d3b3d3e Merge pull request #2950 from zcgit/develop
a potential bug in Layer.
2013-08-19 19:02:53 -07:00
Ricardo Quesada 511ec1cc5d Compiles with improved CCArray
Compiles both with std::vector or ccCArray
2013-08-19 17:09:28 -07:00
James Chen 58a3560bca More enum class: ScrollView::Direction, TableView::VerticalFillOrder 2013-07-26 22:55:41 +08:00
Ricardo Quesada 5d499d351d Some more changes to make the code more c++ friendly:
- nodeToParentTransform -> getNodeToParentTransform() (the same for its friends)
   - Deprecates the old methods
   - adds 'consts' to those methods
- boundingBox() -> getBoundingBox()
   - the new one is const
   - Deprecates the old method.
- Adds overrides keywords in CCNodeRGBA and CCArmature
- AffineMatrix are mutables
2013-07-16 18:16:04 -07:00
Ricardo Quesada 9958e0d7f9 Adds more readability to the class internals.
Changes:
  - creator (static) methods, and singleton methods (static) are always at the top of the class
  - Constructors, destructros, and init methods comes next
  - Then the instance methods for the class
  - Then the overriden methods
  - and finally the ivars

Also, overriden methos have the "override" context keyword
2013-07-15 12:43:22 -07:00
minggo 6abe6fce78 closed #2393: fix conflicts 2013-07-12 18:04:32 +08:00
minggo 5d9fea1416 issue #2393:mark PointZero RectZero and SizeZero as deprecated 2013-07-12 14:47:36 +08:00
minggo 15096b0716 issue #2393:mark CCPointMake CCSizeMake CCRectMake as deprecated 2013-07-12 14:30:26 +08:00
minggo bb758df0d0 issue #2393:mark ccp as deprecated 2013-07-12 14:11:55 +08:00
James Chen 2c1b26acf8 issue #2397: EGLView::sharedOpenGLView() --> EGLView::getInstance() 2013-07-12 13:11:21 +08:00
Ricardo Quesada cf262c28e2 getInstance() / destroyInstance() are used...
... instead of sharedXXX / purgeXXX.
They are more C++ friendly, and also easier to remember.

common files + Mac files + iOS files + tests/samples files were updated.

The old methods are deprecated now.
2013-07-11 15:24:23 -07:00
minggo c37af8fa77 issue #2393:mark functions in CCPointExtensions deprecated 2013-07-11 16:38:58 +08:00
James Chen 9b9fe67d25 issue #2387: Using static_cast instead of C style cast in iteration of CCArray. 2013-07-09 14:29:51 +08:00
zcgit 912a52a677 a potential bug in ScrollView
check _touches in setTouchEnabled
2013-06-21 18:00:56 +08:00
samuele3hu e36c6f544a issue #2276: Modify ScrollView and LuaScrollView class 2013-06-21 14:17:41 +08:00
samuele3hu 15c69563e2 issue #2276: Add ScrollView lua binding and test sample 2013-06-20 22:39:30 +08:00
James Chen cb67ed0227 issue #2129: Removing CC prefix for extension module. 2013-06-20 14:15:53 +08:00
James Chen c0d44cb2e4 fixed #2129: Rename m_iVar to _var, remove CC prefixes. 2013-06-15 14:03:30 +08:00
James Chen c0a6f0c74f fixed #2149: "const CCSize& CCScrollView::getContentSize()" --> "const CCSize& CCScrollView::getContentSize() const". 2013-05-13 15:07:47 +08:00
Pranav Tekchand 0a996804fa Merge branch 'master' of https://github.com/cocos2d/cocos2d-x 2013-04-30 21:06:18 +05:30
Pranav Tekchand 4360c3bff8 Support negative scaling of CCScrollView.
Not checking for it in CCScrollView::getViewRect causes intersectsRect calls (eg: to check if the touch was within the bounds) to return false.
2013-04-30 20:47:38 +05:30
Ed Bartley c7222c2b14 CCScrollView should set the TouchPriority from the CCLayer, thus allowing the developer to set a custom TouchPriority with a call to setTouchPriority(…); 2013-04-25 09:30:24 -04:00
James Chen 6c15c75c78 fixed #1862: CCScrollView::setContainer may cause dangling pointer when NULL is passed into. 2013-04-15 09:52:46 +08:00
sjchao 4690a45f3e change a method name
change method name from isScissorEnable() to isScissorEnabled() in
class CCEGLViewProtocal
2013-03-29 17:19:47 +08:00
sjchao f1f31deb98 Fix the display bug when a scrollView nested in another scrollView 2013-03-29 16:05:28 +08:00
Sam Clegg 38878b084b Fix all compiler warnings produced by gcc.
This allows the linux and NaCl builds (and perhaps others)
to be compiles with -Wall and -Werror, and it makes the build
output much less noisy.
2013-03-05 17:01:00 -08:00
James Chen 9c906bbe30 fixed #1712: fix an issue of lacking table view cells after touch ended. 2013-02-18 09:45:01 +08:00
James Chen cda7da3d43 fixed #1712: Adding default dpi for marmalade and mac since i don't know how to get DPI for these platforms. 2013-02-17 17:13:06 +08:00
James Chen ac17f67686 issue #1712: Adding getting dpi support for iOS and Android. 2013-02-16 19:36:21 +08:00
James Chen 0a9a952edc fixed #1711: Wrong clipping rectangle of CCScrollView when the scale of its ancestors isn't equal to 1. 2013-02-16 14:18:13 +08:00
Heewon Song 10375ae660 Fix for CCScrollView clipping bug
fix : wrong cliping rect when ancestors scale is not 1
2013-02-14 18:43:27 +09:00
James Chen 6565fa92cc fixed #1649: Changed return type to const reference for member variable access. 2013-01-14 15:51:53 +08:00
minggo a75f8b7e7a fixed #1593:remove all deprecated methods expect CCBAnimationManager 2012-12-06 18:51:33 +08:00
James Chen c1eded787a Merge pull request #1724 from FlowerpotGames/gles20
fixed #1599: CCScrollView and CCTableView updates.
2012-12-05 18:28:30 -08:00
Ed Bartley 73239a07e0 * Fixed improper behavior of horizontally scrolling ScrollView 2012-12-05 09:55:06 -05:00
Ed Bartley 9f04817235 * CCScrollView did not scroll correctly if the container items do not fill the ScrollView. The issue can be observed by modifying TableViewTestLayer::numberOfCellsInTableView(…) in the ExtensionsTest/TableViewTest project from 20 cells to 2 cells. 2012-12-04 15:32:13 -05:00
James Chen ebd522e3fa issue #1564: Return a new object instead of 'const reference' for some get methods. 2012-11-20 16:34:55 +08:00
James Chen cb2f3efc2c fixed #1495: CCScrollView display area and touch area are wrong if its parent's postion isn't at CCPointZero in world. 2012-10-08 14:12:34 +08:00
James Chen a6acd90c29 fixed #1458: Updated copyright information for some files which are relative to CCTableView. 2012-09-10 14:13:55 +08:00
James Chen 1460f4e42f issue #1458: Updated project configuration for all platforms.
CCTableView::viewWithSource --> CCTableView::create, adding TableViewTest.
2012-09-10 13:39:12 +08:00
James Chen 554b1709c3 issue #1458: Adding CCScrollView::updateInset. 2012-09-09 22:46:31 +08:00
James Chen d9cc8fa346 issue #1458: Adding CCTableView support. Updated win32 project configuration. 2012-09-09 22:34:32 +08:00
Walzer cc3d850892 fixed #1416, add object orientated APIs for CCGeometry, replace "CCFloat" with "float" 2012-08-01 15:30:12 +08:00