Using CGContext to display a sprite sheet iPhone

后端 未结 2 1519
刺人心
刺人心 2020-12-15 02:30

So I have a spritesheet in png format, and have already worked out the coordinates for what I want to display. I\'m trying to create a method that will return a UIImage when

相关标签:
2条回答
  • 2020-12-15 02:32

    I think the call you want to use is CGImageCreateWithImageInRect

    newImage = [UIImage imageWithCGImage:CGImageCreateWithImageInRect( [spriteSheet CGImage] , imageRect )];
    
    0 讨论(0)
  • 2020-12-15 02:41

    you need to think of your co-ordinates backwards. The CGSize is fixed. Translate your xPos,yPos so that your sprite appears under the window.

    0 讨论(0)
提交回复
热议问题