2014년 4월 3일 목요일

Cocos2d-x 함수 사용

Sprite 생성 

CCTexture2D* texture;
texture = CCTextureCache::sharedTextureCache()->addImage("Images/white-512x512.png");
CCSprite* bricks = CCSprite::createWithTexture(texture, CCRectMake(0, 0, 64, 40)); 

2초후에 동작시키기 

CCFiniteTimeAction* action = CCSequence::create(
CCDelayTime::create(2),
CCCallFunc::create(this, callfunc_selector(TestScene3::startGame)),
NULL);
this->runAction(action); 

Touch 동작시키기

virtual void ccTouchesBegan(CCSet *pTouches, CCEvent* event);
virtual void ccTouchesMoved(CCSet *pTouches, CCEvent* event);
virtual void ccTouchesEnded(CCSet *pTouches, CCEvent* event);
virtual void ccTouchesCancelled(CCSet *pTouches, CCEvent* event);

this->setTouchEnabled(true); // 터치 활성화
void TestScene3::ccTouchesBegan(CCSet *pTouches, CCEvent* event){
CCSetIterator it = pTouches->begin();
CCTouch* touch = (CCTouch*)(*it);
CCPoint touchPoint = touch->getLocation();

CCRect rect = paddle->boundingBox();
if (rect.containsPoint(touchPoint)) { // 점을 포함하고 있는지 체크한다.
}

스캐쥴 사용

this->schedule(schedule_selector(TestScene3::gameLogic), 2.0f/60.0f); // 2/60 Interval로 gameLogic을 실행한다. 

 메뉴 처리

CCMenuItemImage *pMenuItem1 = CCMenuItemImage::create( "Images/btn-play-normal.png",
Images/btn-play-selected.png,
this,
menu_selector(HelloWorld::doClick1));
pMenuItem1->setTag(1);
CCMenu* pMenu = CCMenu::create(pMenuItem1, pMenuItem2, pMenuItem3, pMenuItem4, pMenuItem5, NULL);
pMenu->alignItemsVertically();
this->addChild(pMenu);

void HelloWorld::doClick1(CCObject *p){
CCMenuItem *tItem = (CCMenuItem*) p;
switch ( tItem->getTag () ){
if ( (CCSprite*)getChildByTag(1) == NULL ) {
}
}

문자열 출력하기 

CCLabelTTF *label = CCLabelTTF::create("callback 1 called", "Marker Felt", 16);
label->setPosition(ccp(120,160));
label->setColor(ccBLACK);
label->setTag(100);
addChild(label); 

문자열 Atlas 출력하기 

CCLabelAtlas *pLabel3 = CCLabelAtlas::create("1234", "fps_images.png",  16, 24, '.');
pLabel3->setPosition(ccp(size.width / 2, 50));
this->addChild(pLabel3);



화면 전환 

CCScene* pScene = TestScene2::scene();
CCDirector::sharedDirector()->pushScene( createTransition(14, 1, pScene));
CCDirector::sharedDirector()->replaceScene(pScene);
// pushScene, replaceScene 두가지.. 

plist사용하기

CCSpriteFrameCache *cache = CCSpriteFrameCache::sharedSpriteFrameCache();
cache->addSpriteFramesWithFile("animations/sample.plist");

CCArray* animFrames = CCArray::createWithCapacity(15);

char str[100] = {0};
for ( int i=1 ; i< 15 ; i ++){
sprintf(str, "grossini_dance_%02d.png", i);
CCSpriteFrame* frame = cache->spriteFrameByName(str);
animFrames->addObject(frame);
}

CCSprite *pMan= CCSprite::createWithSpriteFrameName("grossini_dance_01.png");
pMan->setPosition( ccp(240, 160));
this->addChild(pMan);

CCAnimation* animation = CCAnimation::createWithSpriteFrames(animFrames, 0.5f);
CCAnimate* animate = CCAnimate::create(animation);
CCAction* rep = CCRepeatForever::create(animate);
pMan->runAction(rep); 

2014년 4월 2일 수요일

Visual Studio 단축키

Visual Studio 단축키



F12 : 함수 정의로 이동
Ctrl + *    : 이전으로 돌아가기
Ctrl + -    : 이전

Alt + F8    : 소스코드 정리

Ctrl + F2  : 북마크 설정
F2          : 북마크로 이동

Ctrl + k + c : 주석처리
Ctrl + k + u : 주석해제

Ctrl + F3     : 현재 커서 문자열 찾기
F2             :  다음 찾기

Ctrl + tab    : 현재 파일 전환


2014년 4월 1일 화요일

Inno Setup

# Free Installer for Window programs.

http://www.jrsoftware.org/isinfo.php

Key features:
  • Support for every Windows release since 2000, including: Windows 8, Windows Server 2012, Windows 7, Windows Server 2008 R2, Windows Vista, Windows Server 2008, Windows XP, Windows Server 2003, and Windows 2000. (No service packs are required.)
  • Extensive support for installation of 64-bit applications on the 64-bit editions of Windows. Both the x64 and Itanium architectures are supported. (On the Itanium architecture, Service Pack 1 or later is required on Windows Server 2003 to install in 64-bit mode.)
  • Supports creation of a single EXE to install your program for easy online distribution. Disk spanning is also supported.
  • Standard Windows 2000/XP-style wizard interface.
  • Customizable setup types, e.g. Full, Minimal, Custom.
  • Complete uninstall capabilities.
  • Installation of files:
    Includes integrated support for "deflate", bzip2, and 7-Zip LZMA/LZMA2 file compression. The installer has the ability to compare file version info, replace in-use files, use shared file counting, register DLL/OCX's and type libraries, and install fonts.
  • Creation of shortcuts anywhere, including in the Start Menu and on the desktop.
  • Creation of registry and .INI entries.
  • Running other programs before, during or after install.
  • Support for multilingual installs, including right-to-left language support.
  • Support for passworded and encrypted installs.
  • Support for digitally signed installs and uninstalls.
  • Silent install and uninstall.
  • Unicode installs.
  • Integrated preprocessor option for advanced compile-time customization.
  • Integrated Pascal scripting engine option for advanced run-time install and uninstall customization.
  • Full source code is available (Borland Delphi 2.0-5.0 and 2009).
 # Istool
  1. Web site : http://sourceforge.net/projects/istool/files/1.%20ISTool/
  2. Download : http://sourceforge.net/projects/istool/files/1.%20ISTool/release-5.3.0/istool-5.3.0.exe
# API Help :  http://www.jrsoftware.org/ishelp/


> Example

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "dzremote"
#define MyAppVersion "0.5"
#define MyAppPublisher "MyCompany, Inc."
#define MyAppURL "http://www.MyCompany.co.kr/"
#define MyAppExeName "dzremotec.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{41009AD5-09AE-4B9B-8AF5-30E75C5DE52C}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputDir=C:\Users\hslee\Desktop
OutputBaseFilename=dzremote_setup_v0.05
Compression=lzma
SolidCompression=yes

[Languages]
Name: english; MessagesFile: compiler:Default.isl

[Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked

[Files]
Source: ..\..\share\dzremote_v0_05\dzremotec.exe; DestDir: {app}; Flags: ignoreversion
Source: ..\..\share\dzremote_v0_05\*.dll; DestDir: {app}; Flags: ignoreversion
Source: ..\..\share\dzremote_v0_05\platforms\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: {group}\{#MyAppName}; Filename: {app}\{#MyAppExeName}
Name: {commondesktop}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Tasks: desktopicon

[Run]
Filename: {app}\{#MyAppExeName}; Description: Run dzremote.exe; Flags: nowait postinstall skipifsilent; Tasks: ; Languages:

[UninstallDelete]
Name: {app}\*; Type: filesandordirs; Tasks: ; Languages: