Archive for: 󈥪月 2013’

Cocos2d-x 背景画像座標設定の覚え書き

2013年10月20日 Posted by PURGE

典型的な関数に関する覚え書き。

    if ( !CCLayer::init() )
    {
        return false;
    }
    //実際の画面に表示されている領域(width/height)
    CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
    //基本的に0,0(x/y)
    CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();

    CCSprite* pBackground = CCSprite::create("Background.png");
    pBackground->setPosition(ccp(origin.x + visibleSize.width/2,
                                 origin.y + visibleSize.height/2));
    
    CCLog("origin.x:%f / orgin.y:%f",origin.x, origin.y);
    CCLog("visibleSize.width:%f / visibleSize.height:%f",visibleSize.width, visibleSize.height);
    CCLog("background.width:%f / background.height:%f",pBackground->getContentSize().width, pBackground->getContentSize().height);
    
    this->addChild(pBackground, 0);

実際試すと、座標設定が理解できるようになる。

Flex改行コード

2013年10月18日 Posted by PURGE

asファイル内での改行コード


\r\n

MXMLファイル内での改行コード


& # 13;

Cocos2d-x 縦画面の設定

2013年10月17日 Posted by PURGE

RootViewController.mm

// Override to allow orientations other than the default portrait orientation.
// This method is deprecated on ios6
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    //縦画面対応
    return UIInterfaceOrientationIsPortrait(interfaceOrientation);
    //return UIInterfaceOrientationIsLandscape( interfaceOrientation );
}

// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
- (NSUInteger) supportedInterfaceOrientations{
#ifdef __IPHONE_6_0
    //縦画面対応
    return UIInterfaceOrientationMaskPortrait;
    //return UIInterfaceOrientationMaskAllButUpsideDown;
#endif
}

- (BOOL) shouldAutorotate {
    return NO;
}

Cocos2d-xの画面遷移方法

2013年10月16日 Posted by PURGE

一番簡単な、画面遷移(トランジション付き)の方法の覚え書き。

bool ScreenSample::init()
{
    if ( !CCLayer::init() )
    {
        return false;
    }
    
    CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
    CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();
    
    CCMenuItemImage* pNextScreen = CCMenuItemImage::create("Next.png",
                                                           "NextSelected.png",
                                                           this, menu_selector(ScreenSample::nextScreenClicked));
	pNextScreen->setPosition(ccp(origin.x + visibleSize.width - pNextScreen->getContentSize().width/2 ,
                                origin.y + 100));
    
    CCMenu* pNext = CCMenu::create(pNextScreen, NULL);
    pNext->setPosition(CCPointZero);
    this->addChild(pNext, 3);
    
    return true;
}

void ScreenSample::nextScreenBtnClicked(CCObject* pSender)
{
    CCLog("Clicked!!!");
    CCScene* nextScene = NextScreen::scene();
    CCTransitionFlipX* transition = CCTransitionFlipX::create(0.5f, nextScene);
    //CCTransitionFade* transition = CCTransitionFade::create(0.5f, nextScene);
    //CCTransitionZoomFlipY* transition = CCTransitionZoomFlipY::create(0.5f, nextScene);

    CCDirector::sharedDirector()->replaceScene(transition);
}

今後、活用する。

銀行業務検定 証券3級のお勉強計画 試験10日前

2013年10月16日 Posted by PURGE

正直ブログ自体も更新せずに、かなりの時間が経ってしまった。
前回から既に20日位経ったのであろうか?
時間とは過ぎるのがとても早いものである。

その後であるが、現在3ヵ年分の過去問題を繰り返している。
最近は、1日20問位を丸暗記するようにしている。

現在の進捗としては、過去問6割程を理解しないままで、正答できるようにはなっている。
但し、このままでは、当日の正解率は4割くらいにしかならないであろう。

とりあえず、過去問を8割完全に正答できるようにしておかないと安心できない。

ちなみに、当ブログも全く更新していないので、当てにならない。
キーワードの羅列で終わってしまっている。残念。