Reputation: 31
I'm trying to compile some example code from the Cocos2d for iPhone 0.99 Beginner's Guide.:
-(void)draw
{
if(isSelected)
{
[self.mySprite setOpacity:100];
glColor4f(255 / 255.0f, 0 / 255.0f, 0 / 255.0f, 255 / 255.0f);
glPointSize( 30.0 );
ccDrawPoint( self.mySprite.position);
}
[super draw];
}
Apart from this not actually drawing a rectangular highlight on top of the sprite when isSelected = YES, the gl functions are also giving me warnings:
Upvotes: 2
Views: 1103
Reputation: 31
Make sure to #import
You can use: ccDrawSolidRect(<#CGPoint origin#>, <#CGPoint destination#>, <#ccColor4F color#>)
This is probably a neater way to have a highlighted rectangle than using ccDrawPoint().
Hope this helps.
Upvotes: 0
Reputation: 2725
Are you using Cocos2D 2.x? Try ccDrawColor4F
instead of glColor4f
and ccPointSize
instead of glPointSize
.
Upvotes: 5