Young-Hoon의 모든 글
SemVer
버저닝 정책
나만 알기 아까운 딥러닝 연재
Windows message pump
DirectX 렌더링 프로그램을 만들다 보면 main() 함수에 다음과 같은 코드를 볼 수 있다.
main()
{
...
while(1)
{
if(PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
{
if(msg.message == WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
renderer.Update();
renderer.Render();
}
}
...
}
다음과 같은 코드를 메세지 펌프 라고 부른다.
다른 메세지를 처리하는 중에 큐에서 메세지를 꺼내 처리하는 코드
이 단어는 Z emotion에 다닐 때 들은 것인데 오늘 문득 저게 떠올랐다, 갑자기?, 하지만 ‘메세지 펌프’ 라는 용어가 기억이 안나 한참을 검색하여 발견한 내용을 기억하기 위해 포스트로 적게 되었다.
윈도우에서 이벤트 메세지를 가져오는 함수는 두가지가 있다
GetMessage(…) 와 PeekMessage(…) 두 함수는 메세지 큐가 비어있을 때 리턴 여부에 있다.
GetMessage(…) 의 활용은 다음과 같다.
while(bRet = (GetMessage(&msg, hWnd, 0, 0) != 0)) // <<여기서 대기
{
if (bRet == -1)
{
// handle the error and possibly exit
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
출처 : https://abipictures.tistory.com/26
git submodule 사용법
서브모듈 추가
$git submodule add [url] [name]
*가끔 add_clone not function 이라는 에러 메세지가 나올때가 있는데 깃 버전이 낮아 발생하는 에러이니 버전 업데이트를 해보기 바란다.
서브모듈의 url 변경
.gitsubmodule 파일의 url 항목을 변경하고 다음 명령을 실행한다
git submodule sync --recursive <submodule_dir>
리포지토리 기록이 다를경우 새로 체크아웃 해야한다.
cd <submodule_dir>
git fetch
git checkout origin/master
git branch master -f
git checkout master
https://stackoverflow.com/questions/913701/how-to-change-the-remote-repository-for-a-git-submodule
gitignore 적용되지 않을때
.gitignore 파일에 새로운 항목을 추가했을때 untracked file 항목에 그대로 남아있을 때가 있다.
그럴때 git cache를 초기화 해주면 된다.
$git rm -r --cached .
$git add .
$git commit -m "fixed untracked files"
캐시 명령어 끝에 점(.) 을 꼭 붙여 주어야 한다.
출처 : https://doubly12f.tistory.com/148
SVN commands
Monobehavior와 생성자
Unity3D 의 Monobehavior 클래스에는 생성자 개념이 존재 하지 않는다.
해서 Mono를 상속받은 클래스가 Monobehavior의 멤버 함수 ‘AddComponent<T>(class) 키워드에 의해 GameObject에 추가 된다 하더라도 별도로 선언해준 생성자나 소멸자는 호출 되지 않는다.
Built-in extra asset
private const string kStandardSpritePath = "UI/Skin/UISprite.psd";
private const string kBackgroundSpriteResourcePath = "UI/Skin/Background.psd";
private const string kInputFieldBackgroundPath = "UI/Skin/InputFieldBackground.psd";
private const string kKnobPath = "UI/Skin/Knob.psd";
private const string kCheckmarkPath = "UI/Skin/Checkmark.psd";
Image image = buttonRoot.AddComponent<Image>();
image.sprite = AssetDatabase.GetBuiltinExtraResource<Sprite>(kStandardSpritePath);
https://forum.unity.com/threads/accessing-ui-build-in-sprites-in-c.305075/
singleton class vs static class
static class 를 사용하려 하다 문득 singleton과의 차이점이 궁금하여 찾아보았다. 아래 4가지가 내가 여러 포스트에서 본 것을 정리해둔 것 같다.
- Singleton objects are stored in Heap, but static objects are stored in stack.
- We can clone (if the designer did not disallow it) the singleton object, but we can not clone the static class object .
- Singleton classes follow the OOP (object oriented principles), static classes do not.
- We can implement an
interfacewith a Singleton class, but a class’s static methods (or e.g. a C#static class) cannot.
https://stackoverflow.com/questions/519520/difference-between-static-class-and-singleton-pattern
참고해볼 다른 포스트
https://postpiglet.netlify.app/posts/csharp-singletone-vs-staticclass/