Port of YannickL's CCControlExtensions to cocos2d-x

oooh ok thanks :slight_smile:

Hi, all,
Could you please upload the demo code in the video? :slight_smile:
We are considering to merge this cool feature into our gles20 branch.

Thanks. It looks great.

I found an issue on CCControlButton. It crashes if you use “buttonWithTitleAndFontNameAndFontSize” method in CCControlButton.
It is due to missing CCScale9Sprite.

plz, upload the demo.

:wink:

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
It’s basically a remake of Zatacka (Achtung die Kurve) for iOS and Android. If you think it looks too similar to a few of the versions already out there, it’s because they might’ve kinda “borrowed” the style from my xbox version :slight_smile:

Anyway, so it contains the CCControlExtensions, as well as a few of my nice extensions to these extensions:

  • Snapping to integer values for the slider
  • checkboxes
  • “Passive” menus (which allow the controls to handle events)
  • Spacers
  • “Setting” controls, which can be tied to a value in CCUserDefaults

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 :slight_smile:

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 :wink:

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.cocos2d-x.org/boards/18/topics/11080

of course :slight_smile: if you have any questions about it, just drop me a mail

uploaded the game to github.

CCControlExtensions updated to the latest supplied by Angus Comrie.

Where can I find GameState.h?

any missing files should be available https://github.com/jandujar/zatacka-clone-cocos2d-x

solved the references to GameState inside cocos2d-x-extensions

thnak you and your hard woking, i git on the web, https://github.com/jandujar/cocos2d-x-extensions, i saw the source but it doesn’t include the move in state picture! can you give some tips,thanks.

I only copy the source from http://www.cocos2d-x.org/boards/18/topics/7963

I don’t understand your question

Jose Antonio Andujar wrote:

I only copy the source from http://www.cocos2d-x.org/boards/18/topics/7963
>
I don’t understand your question

cool, thanks.

What version of cocos2d-x would the zatacka game be using? (I had trouble building it with 2.1.5).

Also I think to be maximally useful, these extensions should have Lua bindings. Really, the scale9 capability should be built-in to cocos2d-x itself. :slight_smile:

Hi there!

I’ve got a problem with CCControlSwitch from cocos2d-x extension library: mask sprite doesn’t mask anything. Though it works perfect in the samples, but when I use the same code and assets in my project — it fails to draw properly.

I’ve attached a sample of my visual problem (you can see piece of red “off” sprite, which hasn’t been masked).

Any suggestions? Maybe something in environment should be checked?

Recently I’ve found that the point is in cocos2d-x sources version: migration from 2.1 to 2.2.3 has solved the issue.

Guys I use cocos2d-x 3.0. And in there you should use slider as follows:

#include "GUI/CCControlExtension/CCControlExtensions.h"

Also use libExtensions in your project. And here is the code:

cocos2d::extension::ControlSlider* slider = cocos2d::extension::ControlSlider::create(
	"images/buttons/container.png", "images/buttons/progress.png", "images/buttons/knob.png");
slider->setPosition(200, 200);
slider->setMinimumValue(0);
// slider->setSnappingInterval(1);
slider->setMaximumValue(10);
slider->setValue(7);
slider->addTargetWithActionForControlEvents(this, cccontrol_selector(IntroView::valueChangedCallback), cocos2d::extension::Control::EventType::VALUE_CHANGED);
addChild(slider);


void IntroView::valueChangedCallback(Ref* sender, cocos2d::extension::Control::EventType evnt)
{
	float value = static_cast<cocos2d::extension::ControlSlider*>(sender)->getValue();
	CCLOG(std::to_string(value).c_str());
}

The biggest problem here is the slider->setSnappingInterval(1);. There is no setSnappingInterval method. Why it is removed? cocos2d::extension::ControlSlider will not have discrete states any more?