'잡다한것들전부'에 해당되는 글 207건

  1. 2014.01.04 유니티 유/무료 강좌
  2. 2014.01.04 NGUI: Events
  3. 2014.01.02 영어와 숫자만 가능하게 처리하기
  4. 2014.01.02 TextInputTest 예제 소스
  5. 2014.01.01 pc 마인드 맵 프로그램
  6. 2014.01.01 네이버 나눔고딕코딩 다운
  7. 2014.01.01 유니티 모바일 에서의 처리
  8. 2014.01.01 SendMessage 유니티 메시지 전달
  9. 2014.01.01 특정 vector3 값 만 바꿀때
  10. 2014.01.01 유니티 모노디벨롭 배경색깔 변경하기.

유니티 유/무료 강좌

|

http://www.unity3dstudy.com/


무료강좌에도 괜찮은 내용이 꾀 있는 것 같고 여유가 된다면 유료 강좌도 들을만 할 것 같다.


Trackback 0 And Comment 0

NGUI: Events

|

NGUI: Events

 

You can add the following functions to your scripts placed on widgets or in-game objects with a collider, provided they are drawn with a camera that has the UICamera script attached:

  • void OnHover (bool isOver) – Sent out when the mouse hovers over the collider or moves away from it.Not sent on touch-based devices.
  • void OnPress (bool isDown) – Sent when a mouse button (or touch event) gets pressed over the collider (with ‘true’) and when it gets released (with ‘false’, sent to the same collider even if it’s released elsewhere).
  • void OnClick() — Sent to a mouse button or touch event gets released on the same collider as OnPress. UICamera.currentTouchID tells you which button was clicked.
  • void OnDoubleClick () — Sent when the click happens twice within a fourth of a second. UICamera.currentTouchID tells you which button was clicked.
  • void OnSelect (bool selected) – Same as OnClick, but once a collider is selected it will not receive any further OnSelect events until you select some other collider.
  • void OnDrag (Vector2 delta) – Sent when the mouse or touch is moving in between of OnPress(true) and OnPress(false).
  • void OnDrop (GameObject drag) – Sent out to the collider under the mouse or touch when OnPress(false) is called over a different collider than triggered the OnPress(true) event. The passed parameter is the game object of the collider that received the OnPress(true) event.
  • void OnInput (string text) – Sent to the same collider that received OnSelect(true) message after typing something. You likely won’t need this, but it’s used by UIInput
  • void OnTooltip (bool show) – Sent after the mouse hovers over a collider without moving for longer thantooltipDelay, and when the tooltip should be hidden. Not sent on touch-based devices.
  • void OnScroll (float delta) is sent out when the mouse scroll wheel is moved.
  • void OnKey (KeyCode key) is sent when keyboard or controller input is used.

Inside your event functions you can always figure out who sent the event (UICamera.currentCamera), RaycastHit that resulted in this event (UICamera.lastHit), as well as the on-screen position of the touch or mouse (UICamera.lastTouchPosition). You can also determine the ID of the touch event (UICamera.currentTouchID), which is ‘-1′ for the left mouse button, ‘-2′ for right, and ‘-3′ for middle.

For example, the following script will print “Hello World!” when the collider it’s attached to gets clicked on.


'잡다한것들전부 > ' 카테고리의 다른 글

유니티 개발시 필요한 라이프 사이클  (0) 2014.01.04
유니티 유/무료 강좌  (0) 2014.01.04
NGUI: Events  (0) 2014.01.04
pc 마인드 맵 프로그램  (0) 2014.01.01
네이버 나눔고딕코딩 다운  (0) 2014.01.01
유니티 모바일 에서의 처리  (0) 2014.01.01
Trackback 0 And Comment 0

영어와 숫자만 가능하게 처리하기

|

//id 형식 체크

bool id_check(const char * text) {

const char c = *text;


if((c < '0' || c > '9') && (c < 'a' || c > 'z') && (c < 'A' || c > 'Z')) {

CCMessageBox("id는 영어와 숫자만 가능합니다","아이디체크");

return (false);             

}

return true;

}

'잡다한것들전부 > ' 카테고리의 다른 글

cocos2d-x 로딩 관련  (0) 2014.01.06
cocos2d-x 샘플 소스 소개  (0) 2014.01.06
영어와 숫자만 가능하게 처리하기  (0) 2014.01.02
TextInputTest 예제 소스  (0) 2014.01.02
string::find와 string::npos 관계  (0) 2013.12.24
sd 카드 접근  (0) 2013.12.23
Trackback 0 And Comment 0

TextInputTest 예제 소스

|

cocos2d-x 샘플소스


모든 클래스는 TestScene 상속받음

runThisTest() 함수 실행



runThisTest 에서는 replaceScene 실행함

예)
void TextInputTestScene::runThisTest()
{
    CCLayer* pLayer = nextTextInputTest();
    addChild(pLayer);

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

씬전환은 init 함수에서 바로 하면 에러가 난다. ->씬이 만들어지기전에 전환을 해버려서 에러
반드시 업데이트는 한번 돌리고 나서 해야된다.







TextFieldTTFDefaultTest 클래스에 딜리게이트 추가


class TextFieldTTFDefaultTest : public KeyboardNotificationLayer, public CCTextFieldDelegate

{


// CCTextFieldDelegate

    virtual bool onTextFieldAttachWithIME(CCTextFieldTTF * sender);

    virtual bool onTextFieldDetachWithIME(CCTextFieldTTF * sender);

    virtual bool onTextFieldInsertText(CCTextFieldTTF * sender, const char * text, int nLen);

    virtual bool onTextFieldDeleteBackward(CCTextFieldTTF * sender, const char * delText, int nLen);

    virtual bool onDraw(CCTextFieldTTF * sender);


}



void TextFieldTTFDefaultTest::onEnter()

{

//CCTextFieldTTF 생성

CCTextFieldTTF * pTextField = CCTextFieldTTF::textFieldWithPlaceHolder("<click here for input>",

FONT_NAME,

FONT_SIZE);

addChild(pTextField);


//딜리게이트 추가

pTextField->setDelegate(this);



}


TextInputTest.zip


정리한것 TextInputLayer


TextInputLayer.zip


TextInputDevide.zip



'잡다한것들전부 > ' 카테고리의 다른 글

cocos2d-x 샘플 소스 소개  (0) 2014.01.06
영어와 숫자만 가능하게 처리하기  (0) 2014.01.02
TextInputTest 예제 소스  (0) 2014.01.02
string::find와 string::npos 관계  (0) 2013.12.24
sd 카드 접근  (0) 2013.12.23
c 와 c++ 관련 자료  (0) 2013.12.19
Trackback 0 And Comment 0

pc 마인드 맵 프로그램

|

마인드 맵 프로그램

실제로 마인드 맵을 할지 안할지는 잘 모르겠지만

무료로 서비스되는 소프트웨어가 있어서 소개합니다.


http://www.xmindkorea.net/



마인드맵

문서의 서식이나 규정에 상관없이 머리속에 생각나는 그대로 생각하고 정리하는 프로그램




X마인드 실행 후
원하시는 양식을 선택 하셔서 결정, Insert키와 Delete키로 자신이 원하는 곳에 새로운 컴포넌트 생성이 가능하며

각 사각형 박스에서... 
F2 : 자신이 원하시는 내용을 정리 해 넣을수 있습니다.
      또는 해당 박스에서 그냥 글씨를 입력하셔도 바로 수정이 가능 합니다.

F4 : 메모창을 띠워 해당 컴포넌트 창에 메모를 삽입 가능합니다.





























































'잡다한것들전부 > ' 카테고리의 다른 글

유니티 유/무료 강좌  (0) 2014.01.04
NGUI: Events  (0) 2014.01.04
pc 마인드 맵 프로그램  (0) 2014.01.01
네이버 나눔고딕코딩 다운  (0) 2014.01.01
유니티 모바일 에서의 처리  (0) 2014.01.01
SendMessage 유니티 메시지 전달  (0) 2014.01.01
Trackback 0 And Comment 0

네이버 나눔고딕코딩 다운

|

http://dev.naver.com/projects/nanumfont/

'잡다한것들전부 > ' 카테고리의 다른 글

NGUI: Events  (0) 2014.01.04
pc 마인드 맵 프로그램  (0) 2014.01.01
네이버 나눔고딕코딩 다운  (0) 2014.01.01
유니티 모바일 에서의 처리  (0) 2014.01.01
SendMessage 유니티 메시지 전달  (0) 2014.01.01
특정 vector3 값 만 바꿀때  (0) 2014.01.01
Trackback 0 And Comment 0

유니티 모바일 에서의 처리

|

유니티 사용시 모바일에서의 환경을 설정해야 되는 경우가 있다.

게임의 방향이 가로인지 세로인지. 그리고 게임 실행중에 꺼지지 않게 한다던가.


그런 옵션들은 Manager 클래스를 하나 만들어서 Start에다가 입력한다.



// Use this for initialization

        void Start () {

            //mobile

        Screen.orientation = ScreenOrientation.Landscape;

        Screen.sleepTimeout = SleepTimeout.NeverSleep;

        }




Screen.orientation = ScreenOrientation.Landscape; -> 단말기의 가로 모드로 설정한다.

Screen.sleepTimeout = SleepTimeout.NeverSleep; -> 단말기 화면을 계속 켜지게 만든다.

Trackback 0 And Comment 0

SendMessage 유니티 메시지 전달

|


SendMessage()는 다른 오브젝트에 연결된 스크립트의 특정 함수를 호출하는 함수이다.


SendMessage()로 호출할 함수는 큰 따옴표("")로 묶어서 입력하며 다음과 같은 형식으로 사용한다.

<오브젝트>.SendMessage("함수명",<옵션>);

<오브젝트>.SendMessage("함수명",인수,<옵션>);


SendMessage()로 전달되는 인수는 하나만 가능하므로 여러 개의 값을 전달할때는 배열로 전달하여 처리한다.

<옵션>은

SendMessageOptions.DontRequireReceiver;

SendMessageOptions.RequireReceiver;


두가지가 있으며, DontRequireReceiver 옵션은 함수의 처리 결과를 호출 프로그램에 전달할 필요가 없는 경우 사용한다(반환값이 void일 경우)

DontRequireReceiver 은 호출 함수가 실행이 끝날때 까지 기다리지 않고 곧바로 다음 처리를 진행하므로 게임의 전체적인 실행 속도가 빠르다는 이점이 있다.



예)


	// Calls the function ApplyDamage with a value of 5
	gameObject.SendMessage ("ApplyDamage", 5.0);
	
	// Every script attached to the game object 
	// that has an ApplyDamage function will be called.
	function ApplyDamage (damage : float) {
		print (damage);
	}






Trackback 0 And Comment 0

특정 vector3 값 만 바꿀때

|

Vector3 g1Pos = ground1.transform.position;

g1Pos.z = g1Pos.z + sizeZ;

ground1.transform.position = g1Pos;

Trackback 0 And Comment 0

유니티 모노디벨롭 배경색깔 변경하기.

|

디버깅할때는 비쥬얼스튜디오가 아닌 모노 디벨롭으로하는데 흰색 배경이 눈이 아파서 테마를 변경해서 사용해야 눈이 편안하다.


Tools -> options -> Text Editor -> Syntax Highlighting 에서 color scheme 에서 테마 고를 수 있습니다.


Trackback 0 And Comment 0