DNESS / cocos2d-iphone

Automatically exported from code.google.com/p/cocos2d-iphone
1 stars 0 forks source link

CCMenuItem uses setContentSize for CCSpriteFrames in sprite frames #850

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Using a CCSpriteFrame from a zwoptex 512x512 texture, in a sprite sheet
2. Checking for hit area, it'll use the texture's content size.

What is the expected output? What do you see instead?
It should use the size of the sprite instead of the size of the texture.

What cocos2d version are you using ?
0.99

What iPhoneSDK are you using ?
3.0

Debug or Release ?
Both

Does this happens on device ? or on the simulator ? or on both ?
Both

Please provide any additional information below.

Original issue reported on code.google.com by psioni...@gmail.com on 28 Apr 2010 at 9:12

GoogleCodeExporter commented 9 years ago
Could you post the code to reproduce it ? Thanks

Original comment by ricardoq...@gmail.com on 28 Apr 2010 at 10:41

GoogleCodeExporter commented 9 years ago
having a bunch of 480x320 frames from photoshop or whatever, with the buttons 
and their out/over states in 
the correct places..

1) create a 512x512 plist and png using zwoptex
2) create a ccmenuitemsprite with a ccsprite using the [[CCSpriteFrameCache 
sharedSpriteFrameCache] 
spriteFrameWithName: @"buttonimage.png"]
3) add it to a ccmenu.

no changing positions, so it'll use the offsets set up from zwoptex.

when the ccmenu goes to check the hit area, it'll go into the ccmenuitem "rect" 
function, which only responds 
using the contentsize.

as the contentsize of the ccsprite is 480x320, the hit area will be fullscreen, 
instead of the proper bounding 
box of the offset etc spriteframe.

i tried to figure out the proper offset maths today (would need to override the 
ccmenuitem's rect function in 
ccmenuitemsprite) but couldn't figure it out in a reasonable amount of time.

Original comment by psioni...@gmail.com on 29 Apr 2010 at 12:10

GoogleCodeExporter commented 9 years ago

Original comment by ricardoq...@gmail.com on 26 May 2010 at 6:20

GoogleCodeExporter commented 9 years ago

Original comment by ricardoq...@gmail.com on 14 Jul 2010 at 9:48

GoogleCodeExporter commented 9 years ago
Hi, I still find this important bug in the latest version, any news on when 
could it be fixed? Thanks!

Original comment by guidog...@gmail.com on 26 Jul 2010 at 1:55

GoogleCodeExporter commented 9 years ago
@guidogoni: could you attach the code to reproduce it ? If possible a simple 
project should be enough. thanks.

Original comment by ricardoq...@gmail.com on 26 Jul 2010 at 4:38

GoogleCodeExporter commented 9 years ago
Steps to reproduce:
1. Load a swoptex resource : [[CCSpriteFrameCache sharedSpriteFrameCache] 
addSpriteFramesWithFile:@"animation.plist"]
2. Create a CCSprite from the texture loaded : CCSPrite *sprite = [CCSprite 
spriteWithSpriteFrameName:@"animationFrame1.png"]
3. Size of image : [sprite contentSize] <---- this will return the size of the 
texture loaded in step1, not only the sprite used later. Exactly the same 
happens to the menu item, so it doesn't detect touch correctly

Original comment by guidog...@gmail.com on 30 Jul 2010 at 3:50

GoogleCodeExporter commented 9 years ago

Original comment by ricardoq...@gmail.com on 17 Mar 2011 at 7:02

GoogleCodeExporter commented 9 years ago
rescheduled for v1.1

Original comment by ricardoq...@gmail.com on 13 Jul 2011 at 9:44