/libs/cocos2d/CCLabelAtlas.h

http://github.com/kstenerud/ObjectAL-for-iPhone · C Header · 55 lines · 9 code · 7 blank · 39 comment · 0 complexity · 39c09399a23ccc22ce1e7ddac679f148 MD5 · raw file

  1. /*
  2. * cocos2d for iPhone: http://www.cocos2d-iphone.org
  3. *
  4. * Copyright (c) 2008-2010 Ricardo Quesada
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7. * of this software and associated documentation files (the "Software"), to deal
  8. * in the Software without restriction, including without limitation the rights
  9. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. * copies of the Software, and to permit persons to whom the Software is
  11. * furnished to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in
  14. * all copies or substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22. * THE SOFTWARE.
  23. *
  24. */
  25. #import "CCAtlasNode.h"
  26. #import "CCTextureAtlas.h"
  27. /** CCLabelAtlas is a subclass of CCAtlasNode.
  28. It can be as a replacement of CCLabel since it is MUCH faster.
  29. CCLabelAtlas versus CCLabel:
  30. - CCLabelAtlas is MUCH faster than CCLabel
  31. - CCLabelAtlas "characters" have a fixed height and width
  32. - CCLabelAtlas "characters" can be anything you want since they are taken from an image file
  33. A more flexible class is CCBitmapFontAtlas. It supports variable width characters and it also has a nice editor.
  34. */
  35. @interface CCLabelAtlas : CCAtlasNode <CCLabelProtocol> {
  36. // string to render
  37. NSString *string_;
  38. // the first char in the charmap
  39. char mapStartChar;
  40. }
  41. /** creates the CCLabelAtlas with a string, a char map file(the atlas), the width and height of each element and the starting char of the atlas */
  42. +(id) labelAtlasWithString:(NSString*) string charMapFile: (NSString*) charmapfile itemWidth:(int)w itemHeight:(int)h startCharMap:(char)c;
  43. /** initializes the CCLabelAtlas with a string, a char map file(the atlas), the width and height of each element and the starting char of the atlas */
  44. -(id) initWithString:(NSString*) string charMapFile: (NSString*) charmapfile itemWidth:(int)w itemHeight:(int)h startCharMap:(char)c;
  45. @end