Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6915115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:26:03+00:00 2026-05-27T09:26:03+00:00

im learning cocos2d [open gl wrapper for objective C on iPhone], and now playing

  • 0

im learning cocos2d [open gl wrapper for objective C on iPhone], and now playing with sprites have found this in a example,

 enum {  
easySprite =   0x0000000a,
mediumSprite = 0x0000000b,
hardSprite =   0x0000000c,
backButton =   0x0000000d,
magneticSprite = 0x0000000e,
magneticSprite2 = 0x0000000f
};

…

 -(id) init
 {...
  /second sprite
    TSprite *med = [TSprite spriteWithFile:@"butonB.png"]; //blue
    [med SetCanTrack:YES];
    [self addChild: med z:1 tag:mediumSprite];
    med.position=ccp(299,230);
    [TSprite track:med];

so the variable defined in the enum is used in the tag name of the created sprite object,

but i don understand

  1. why give values in hexa to the tags to use
  2. the enum with out tags

as I knew this enum in obj C and C

     typedef enum {
     JPG,
     PNG,
      GIF,
     PVR
     } kImageType;

thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:26:04+00:00Added an answer on May 27, 2026 at 9:26 am

    Enums are automatically assigned values, incremented from 0 but you can assign your own values.

    If you don’t specify any values they will be starting from 0 as in:

    typedef enum {
     JPG,
     PNG,
     GIF,
     PVR
     } kImageType;
    

    But you could assign them values:

    typedef enum {
     JPG = 0,
     PNG = 1,
     GIF = 2,
     PVR = 3
     } kImageType;
    

    or even

    typedef enum {
     JPG = 100,
     PNG = 0x01,
     GIF = 100,
     PVR = 0xff
     } kImageType;
    

    anything you want, repeating values are ok as well.

    I’m not sure why they are given those specific values but they might have some meaning related to use.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just learning Cocos2d and Objective-C, and I have some problems with touch detection.
I am learning Cocos2d and building an application where i have sprite at one
I am starting to learning Cocos2D for iPhone. I see the basic template has
I am learning cocos2d for iPhone and came across Munch Time (see also the
I am in the process of learning cocos2d-android. I have been following a tutorial
Learning WPF nowadays. Found something new today with .Net dependency properties. What they bring
Im learning lisp and im pretty new at this so i was wondering... if
Learning jquery, so please be kind :) Using PHP, I have a table with
Learning Ruby. Needed to create a hash of arrays. This works... but I don't
Learning C++ and see the class laid out like this: class CRectangle { int

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.