class Player : public CCSprite { public: enum Direction { Left, Right, Up, Down }; };
のように定義しておくと、
switchでは
switch(_player->direction) { break; case Player::Right: { _player->initWithSpriteFrameName("Player_right_1.png"); } break; case Player::Left: { _player->initWithSpriteFrameName("Player_left_1.png"); } break; case Player::Up: { _player->initWithSpriteFrameName("Player_up_1.png"); } break; case Player::Down: { _player->initWithSpriteFrameName("Player_down_1.png"); } break; default: { _player->initWithSpriteFrameName("Player_right_1.png"); } }
と記載する。
Player::Direction->Right
でも
Player::Direction::Right
でも、
Player::Direction.Right
なく、
Player::Right
でした。
苦労してしまった・・・