Forums » Extensions and Tools » Port of YannickL's CCControlExtensions to cocos2d-x »
| Angus Comrie | Port of YannickL's CCControlExtensions to cocos2d-x | ||||
|---|---|---|---|---|---|
|
Added by Angus Comrie over 1 year ago
I've ported the very nice set of extensions to cocos2d made by YannickL (https://github.com/YannickL/CCControlExtension) to cocos2d-x. The controls are: I have made a few adjustments to YannickL's code: The slider now has a the ability to "snap" to certain intervals. For example, if the slider goes from 1-10, you could make it snap to integers only. In addition, the touch detection has been cleaned up a bit to allow for more intuitive slides. If anyone wants to have a look, they're attached here. You can use the images from YannickL's github for testing. You can create slider with the following code:
Some pics: And finally an example of it in action: CCControlExtension.zip (33.9 kB) |
||||
| SangTaik Jung | RE: Port of YannickL's CCControlExtensions to cocos2d-x | ||||
|
Added by SangTaik Jung about 1 year ago
your good job is very helpful. where I get the file and folder? Thank you for your work. |
||||
| Angus Comrie | RE: Port of YannickL's CCControlExtensions to cocos2d-x | ||||
|
Added by Angus Comrie about 1 year ago
this should do the trick, I think this is the unmodified version of CCScale9Sprite (I've made some changes to it, so I had to dig around for the original.) Good luck, and let me know if you get it working ccscale9sprite.zip (2.6 kB) |
||||
| SangTaik Jung | RE: Port of YannickL's CCControlExtensions to cocos2d-x | ||||
|
Added by SangTaik Jung about 1 year ago
ok I make a CCScale9Sprite class now. invoke() method
Semantic Issue: Left hand operand to ->* must be a pointer to class compatible with the right hand operand, but is 'cocos2d::CCObject *' Why? do you know this error? hm. What is CCInvocation class? |
||||
| Angus Comrie | RE: Port of YannickL's CCControlExtensions to cocos2d-x | ||||
|
Added by Angus Comrie about 1 year ago
that's odd, I've never seen that error before. The invocation object is basically a collection of a target and a function pointer. The invoke method just calls the function belonging to the target object, passing in the object that called the invoke as the argument. I'm not sure, but you might need some extra brackets on the (*m_action), but the code works fine for me in VS2010. |
||||
| SangTaik Jung | RE: Port of YannickL's CCControlExtensions to cocos2d-x | ||||
|
Added by SangTaik Jung about 1 year ago
ok I make a CCScale9Sprite.cpp. CCScale9Sprite.cpp (12.9 kB) |
||||
| SangTaik Jung | RE: Port of YannickL's CCControlExtensions to cocos2d-x | ||||
|
Added by SangTaik Jung about 1 year ago
this is header file using tip
core function is setContentSize( ); I want to make a rect for stretch, but spriteWithXXXX is not work. I don't know Why. Value is corrected and setAnchorPoint is not work. please help me anyone. CCScale9Sprite.h (9 kB) |
||||
| SangTaik Jung | RE: Port of YannickL's CCControlExtensions to cocos2d-x | ||||
|
Added by SangTaik Jung about 1 year ago
Thanks Angus Comrie. I want to make a better this class. but I am not expert. have a sentence me for better. Thank you. |
||||
| Angus Comrie | RE: Port of YannickL's CCControlExtensions to cocos2d-x | ||||
|
Added by Angus Comrie about 1 year ago
I think you have to call it like:
CCScale9Sprite::scale9SpriteWithFile("ButtonNormal.png", CCRect(24, 10, 48, 44));
the CCRect specifies the region that can be stretched, |
||||
| blue eur | RE: Port of YannickL's CCControlExtensions to cocos2d-x | ||||
|
Added by blue eur about 1 year ago
Thanks for this extension, I would like to use the scale 9 feature. What are the file that I have to use ? I can't find the scale9sprite files in the zip here : http://cocos2d-x.org/projects/cocos2d-x/assets/1 so I'm not sure of what to use. |
||||
| Angus Comrie | RE: Port of YannickL's CCControlExtensions to cocos2d-x | ||||
|
Added by Angus Comrie about 1 year ago
The scale9 sprite source files are in the third post on this page |
||||
| blue eur | RE: Port of YannickL's CCControlExtensions to cocos2d-x | ||||
|
Added by blue eur about 1 year ago
oooh ok thanks |
||||
| James Chen | RE: Port of YannickL's CCControlExtensions to cocos2d-x | ||||
|
Added by James Chen about 1 year ago
Hi, all, |
||||
| winipcfg winipcfg | RE: Port of YannickL's CCControlExtensions to cocos2d-x | ||||
|
Added by winipcfg winipcfg about 1 year ago
Thanks. It looks great. I found an issue on CCControlButton. It crashes if you use "buttonWithTitleAndFontNameAndFontSize" method in CCControlButton. |
||||
| Jose Antonio Andujar | RE: Port of YannickL's CCControlExtensions to cocos2d-x | ||||
|
Added by Jose Antonio Andujar about 1 year ago
plz, upload the demo.
http://www.jandusoft.com |
||||
| Angus Comrie | RE: Port of YannickL's CCControlExtensions to cocos2d-x | ||||
|
Added by Angus Comrie about 1 year ago
Sorry for the delay. I have attached the source code for my little game: http://www.youtube.com/watch?v=izYhpK7Z_zo EDIT: for some reason, it's not uploading. Can someone try to upload it from here: http://dl.dropbox.com/u/2522035/HelloWorld.rar Anyway, so it contains the CCControlExtensions, as well as a few of my nice extensions to these extensions: The actual game shows how to handle multiple touches, how to scale the UI for different devices (I probably went a bit overboard here, because it automatically selects the best asset size based on the screen size, as well as the available asset sizes (240p, 320p, 480p, etc. It's dynamic). It's also quite fun to play on a tablet! Free to use/abuse however you want, just not for a snake-based game I'm pretty sure my coding style is not ideal, and I'm also sure there are better ways to get some things done, but it works |
||||
| Jose Antonio Andujar | RE: Port of YannickL's CCControlExtensions to cocos2d-x | ||||
|
Added by Jose Antonio Andujar about 1 year ago
can I upload your game to github? giving you the credits of course. Or maybe you can upload it. I will upload your extensions to my cocos2d-x-extensions branch. http://www.jandusoft.com |
||||
| Angus Comrie | RE: Port of YannickL's CCControlExtensions to cocos2d-x | ||||
|
Added by Angus Comrie about 1 year ago
of course |
||||
| Jose Antonio Andujar | RE: Port of YannickL's CCControlExtensions to cocos2d-x | ||||
|
Added by Jose Antonio Andujar about 1 year ago
uploaded the game to github. http://www.jandusoft.com |
||||
| Jose Antonio Andujar | RE: Port of YannickL's CCControlExtensions to cocos2d-x | ||||
|
Added by Jose Antonio Andujar about 1 year ago
CCControlExtensions updated to the latest supplied by Angus Comrie. http://www.jandusoft.com |
||||
| winipcfg winipcfg | RE: Port of YannickL's CCControlExtensions to cocos2d-x | ||||
|
Added by winipcfg winipcfg about 1 year ago
Where can I find GameState.h? |
||||
| Angus Comrie | RE: Port of YannickL's CCControlExtensions to cocos2d-x | ||||
|
Added by Angus Comrie about 1 year ago
any missing files should be available https://github.com/jandujar/zatacka-clone-cocos2d-x |
||||
| Jose Antonio Andujar | RE: Port of YannickL's CCControlExtensions to cocos2d-x | ||||
|
Added by Jose Antonio Andujar about 1 year ago
solved the references to GameState inside cocos2d-x-extensions http://www.jandusoft.com |
||||
| yunhai shen | please help,thank you! how can i have a button with a state changed when the mouse move on it in win32 | ||||
|
Added by yunhai shen 12 months ago
thnak you and your hard woking, i git on the web, https://github.com/jandujar/cocos2d-x-extensions, i saw the source <void CCButton::initWithFile> but it doesn't include the move in state picture! can you give some tips,thanks. |
||||
| Jose Antonio Andujar | RE: Port of YannickL's CCControlExtensions to cocos2d-x | ||||
|
Added by Jose Antonio Andujar 12 months ago
I only copy the source from http://www.cocos2d-x.org/boards/18/topics/7963 I don't understand your question http://www.jandusoft.com |
||||
| worm wang | RE: Port of YannickL's CCControlExtensions to cocos2d-x | ||||
|
Jose Antonio Andujar wrote:
cool, thanks. |
(1-25/25)
