Skip to content

Instantly share code, notes, and snippets.

@anzfactory
Last active August 29, 2015 13:56
Show Gist options
  • Save anzfactory/9343400 to your computer and use it in GitHub Desktop.
Save anzfactory/9343400 to your computer and use it in GitHub Desktop.
個人用マクロ集
//
// MyMacro.h
//
// Created by ANZ on 2014/07/07.
//
//
#ifndef cocos3rc1_MyMacro_h
#define cocos3rc1_MyMacro_h
// 画面遷移
#define COLOR_BACKGROUND3B cocos2d::Color3B(85, 85, 85)
#define DURATION_TRANSITION_SCENE .5f
#define MOVE_SCENE_FADE(__scene__) \
cocos2d::Director::getInstance()->replaceScene( \
cocos2d::TransitionFade::create( \
DURATION_TRANSITION_SCENE, \
static_cast< cocos2d::Scene* >(__scene__), \
COLOR_BACKGROUND3B \
)\
)
// Scale9Sprite作成
#define SCALE9_SPRITE_FILE "frame.png"
#define SCALE9_SPRITE_OUTSIDE_X 0.f
#define SCALE9_SPRITE_OUTSIDE_Y 0.f
#define SCALE9_SPRITE_OUTSIDE_WIDTH 100.f
#define SCALE9_SPRITE_OUTSIDE_HEIGHT 100.f
#define SCALE9_SPRITE_INSIDE_X 20.f
#define SCALE9_SPRITE_INSIDE_Y 20.f
#define SCALE9_SPRITE_INSIDE_WIDTH 60.f
#define SCALE9_SPRITE_INSIDE_HEIGHT 60.f
#define CREATE_SCALE9_SPRITE() \
cocos2d::extension::Scale9Sprite::create( \
SCALE9_SPRITE_FILE, \
cocos2d::Rect( \
SCALE9_SPRITE_OUTSIDE_X / CC_CONTENT_SCALE_FACTOR(), \
SCALE9_SPRITE_OUTSIDE_Y / CC_CONTENT_SCALE_FACTOR(), \
SCALE9_SPRITE_OUTSIDE_WIDTH / CC_CONTENT_SCALE_FACTOR(), \
SCALE9_SPRITE_OUTSIDE_HEIGHT / CC_CONTENT_SCALE_FACTOR() \
), \
cocos2d::Rect( \
SCALE9_SPRITE_INSIDE_X / CC_CONTENT_SCALE_FACTOR(), \
SCALE9_SPRITE_INSIDE_Y / CC_CONTENT_SCALE_FACTOR(), \
SCALE9_SPRITE_INSIDE_WIDTH / CC_CONTENT_SCALE_FACTOR(), \
SCALE9_SPRITE_INSIDE_HEIGHT / CC_CONTENT_SCALE_FACTOR() \
) \
)
// ログ
#define CCLOG_D(arg, ...) \
cocos2d::log("%s [L:%d]:\n-- %s", __PRETTY_FUNCTION__, __LINE__, cocos2d::StringUtils::format(arg, ##__VA_ARGS__).c_str())
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment