Why am I getting this warning and how can I fix it?
I'm using Kobold2D v2.1.0 (Uses cocos2d-iphone v2.1 and OpenGL ES 2.0)
My code:
CCMenuItemSprite *flareButton = [CCMenuItemSprite itemFromNormalSprite:flareSprite selectedSprite:flareSelectedSprite target:self selector:#selector(flareSelected)];
Can you also tell me how I can avoid these deprecations in the future by looking at a reference of any kind. Thanks
Look into ccDeprecated.m - you'll find all deprecated methods there as well as the correct (changed) way to use the function.
Deprecated in cocos2d means in almost all cases that the name of the function, the parameter list or its location have changed. You can also disable deprecation warnings in Build Settings and just ignore it for at least until the next major cocos2d update.
You can try with:
CCMenuItemSprite *flareButton = [CCMenuItemSprite itemWithNormalSprite:flareSprite selectedSprite:flareSprite target:self selector:#selector(flareSelected)];
Change From to With on itemFromNormalSprite: will be itemWithNormalSprite:
Related
When i try to use CosmicMind's motion animation framework, I receive an error whenever I try an example. For example, taken straight from the Sample's repo:
dateLabel.animate(.delay(1),
.duration(0.5),
.background(color: Color.cyan.base),
.completion({ [weak self] in
self?.dateLabel.animate(.delay(1),
.duration(0.5),
.background(color: Color.deepPurple.base))
}))
throws the error 'Extra argument in call'
I can't animate anything because I always receive this error. What can i do to fix it?
Thanks!
I had tested the animation with Material 2.8.1 and all worked correctly. Please make sure you are using the latest Material version. All the best!
I am trying to use a Gtk::ScaleButton in Gtkmm 3. My problem is the constructor. It needs as last parameter (see here: https://developer.gnome.org/gtkmm/stable/classGtk_1_1ScaleButton.html#a96753b6cb6b8adb0ed3727ba3eb8cfb7 ) a vector of ustrings. I guess (i can't find it in the docs what it means exactly) i have to give it the path to the +/- Images. I want to use the Gtk Stock items for +/-. How can i achieve this?
Currently i give it an empty vector, which results in a glibmm warning:
std::vector<Glib::ustring> icons;
Gtk::ScaleButton * scale = Gtk::manage(new Gtk::ScaleButton(Gtk::ICON_SIZE_SMALL_TOOLBAR, 0.0, 10.0, 1.0, icons));
Warning:
glibmm-WARNING **: Glib::ConstructParams::ConstructParams(): object class "gtkmm__GtkScaleButton" has no property named "min"
How can i avoid the warning and give it stock icons?
You must be one of the first people to ever try using this Gtk::ScaleButton constructor from gtkmm. It seems to have been broken for several years.
I've fixed it in gtkmm: https://git.gnome.org/browse/gtkmm/commit/?id=26f94d231da9481d74acdd94e56168ed6b38609a
But it will be some time until that is widely available via Linux distro packages. In the meantime you can try using
Gtk::ScaleButton* button = Glib::wrap(gtk_scale_button_new(whatever));
See https://developer.gnome.org/gtkmm-tutorial/stable/sec-basics-gobj-and-wrap.html.en
However, I don't know how it's actually meant to behave, so you might encounter other bugs. You might actually want to use the derived Gtk::VolumeButton instead.
andlabs is correct that the GTK+ documentation describes the icons better:
https://developer.gnome.org/gtk3/stable/GtkScaleButton.html#GtkScaleButton--icons
and those should indeed probably be the standard icon names:
http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
How to set sclar in new version VTK. How to convert new version VTK below code?
StructuredPoints->GetPointData()->SetScalars(scalars);
Without knowing what version you are referring too, I think both methods you are using are still available in VTK:
GetPointData
SetScalars
I'm not actually using the accelerometer in my app, but this warning is the only one I get during the build process. I'd like to correct it or eliminate it. This warning directs me to the CCLayer.m cocos2d original files. There a 4 warnings about the UIAccelerometer deprecations.
(LINES 91 & 93 is where the warnings start) ! UIAccelerometer is deprecated in iOS 5.0 - UIAccelerometer has been replaced by the CoreMotion framework
85:-(void) setIsAccelerometerEnabled:(BOOL)enabled
86:{
87: if( enabled != isAccelerometerEnabled_ ) {
88: isAccelerometerEnabled_ = enabled;
89: if( isRunning_ ) {
90: if( enabled )
91: [[UIAccelerometer sharedAccelerometer] setDelegate:self];
92: else
93: [[UIAccelerometer sharedAccelerometer] setDelegate:nil];
94: }
95: }
96:}
When I dig deeper into the warnings it brings me deeper into the UIAccelerometer.h UIKit
Have others had this problem? How to deal with it? Should I just ignore it? Any suggestions would be greatly appreciated. Thanks, Justin
Cocos2d-iphone as of version 2.1 has not been updated to be fully compatible with iOS 7.
As far as accelerometer is concerned you can safely comment out all references to / uses of UIAccelerometer. If you do need accelerometer in your app use CMMotionManager.
Alternatively you can use Kobold2D whose github version includes the necessary fixes to cocos2d-iphone.
I'm personally not the biggest fan of how Kobold2d "solved" the issue. They're wrapping the code with pragmas that disable the warning. Personally, I'd prefer to offer that it's better to replace the deprecated code with CoreMotion class.
To maintain the usability of a singleton class; use this answer: How do I initialize CMMotionManager globaly to be used by different classes?
then in CCLayer.h at line 32 import MotionManagerSingleton.h
Next in CCLayer.m replace everything that looks like UIAccelerometer with the new call to this class and it works quite well.
Looked in the CCMenu.h and it looks like it responds to the exact method Xcode (4.5.2) is saying it doesn't respond to. I've tried overriding the method and extending CCMenu, but it always throws the same message.
When I build and run my project, it seems to work fine. Should I ignore this warning and continue with my game? Another question: Is there a simple way to 'update' this code to a non-deprecated or outdated method? Here's the cocos2d-iphone-extensions version I'm using. Also, it's cocos2d 2.1.
The error is generated on line 76 of the .m file.
CCMenuAdvanced.h:
https://github.com/cocos2d/cocos2d-iphone-extensions/blob/master/Extensions/CCMenuAdvanced/CCMenuAdvanced.h
CCMenuAdvanced.m:
https://github.com/cocos2d/cocos2d-iphone-extensions/blob/master/Extensions/CCMenuAdvanced/CCMenuAdvanced.m
You are getting this warning because -(id) initWithItems: (CCMenuItem*) item vaList: (va_list) args is not present in the header file (CCMenuAdvanced.h).
You need to use + (id) menuWithItems: (CCMenuItem*) firstItem vaList: (va_list) args; from CCMenu (superclass of CCMenuAdvanced).