검색결과 리스트
Game Programming에 해당되는 글 19건
- 2020.05.25 Log Verbosity override
- 2020.01.28 모든 메쉬 다시 저장
- 2019.04.16 Auto Attach 디버깅 툴(Visual Studio)
- 2018.07.02 NDK BUILD
- 2018.03.08 생성자/파괴자 내부에서 virtual 함수 사용이 안되는(virtual 대신 일반 함수처럼 동작됨) 이유
- 2011.12.09 여러 폰트를 사용중 같은 위치에 출력하고 싶을때 !!!
- 2011.06.14 Visual Studio 유용한 정규식 패턴
- 2011.01.11 D3D X파일 멀티애니메이션 모델 만드는 법
글
Log Verbosity override
Config/DefaultEngine.ini
[Core.Log]
LogCategoryName=NewVerbosityLevel
ex
[Core.Log]
LogFoobar=Log
로그 카테고리 선언 참고.
foobarLog.h
DECLARE_LOG_CATEGORY_EXTERN(LogFoobar, Display, All);
foobarLog.cpp
DEFINE_LOG_CATEGORY(LogFoobar);
글
모든 메쉬 다시 저장
"Engine/Binaries/Win64/UE4Editor-Cmd.exe" "project_path" -run=ResavePackages -unattended -nopause -buildmachine -autocheckout -autocheckin -projectonly -resaveclass="StaticMesh,SkeletalMesh"
글
글
NDK BUILD
https://developer.android.com/ndk/guides/ndk-build?hl=ko
글
생성자/파괴자 내부에서 virtual 함수 사용이 안되는(virtual 대신 일반 함수처럼 동작됨) 이유
https://stackoverflow.com/questions/962132/calling-virtual-functions-inside-constructors
https://isocpp.org/wiki/faq/strange-inheritance#calling-virtuals-from-ctors
1 . 생성자에서 부를 때 명확한 예
#include<string>
#include<iostream>
using namespace std;
class B {
public:
B(const string& ss) { cout << "B constructor\n"; f(ss); }
virtual void f(const string&) { cout << "B::f\n";}
};
class D : public B {
public:
D(const string & ss) :B(ss) { cout << "D constructor\n";}
void f(const string& ss) { cout << "D::f\n"; s = ss; }
private:
string s;
};
int main()
{
D d("Hello");
}
결과
B constructor
B::f
D constructor
만일 B::f 대신 D::f 를 허용한다면 D constructor 호출 이전이므로
s = ss; 에서 초기화되지 않은 string s 를 사용해야하므로 crash 가 발생할 수 있다.
C++ is protecting you from that danger. 의 차원에서 허용되지 않는다고 볼 수 있다.
2. 파괴자에서는 생성자 호출 순서의 역순으로 수행되므로
위의 클래스 예를 들어보면 D 의 파괴자 호출 후에 B 파괴자가 호출된다.
B 파괴자 내부에서 f(ss); 를 호출하여 D::f 를 호출 한다는 것도 성립할 수 없게 된다.(만일 D::f 가 호출된다면 이미 파괴된 string s 를 참조하려고 한다.)
글
여러 폰트를 사용중 같은 위치에 출력하고 싶을때 !!!
47.4 How can I draw a single line of text with different fonts using DrawString? |
The key is that you have to calculate the ascent height of the font. The font ascent as reported by FontFamily.GetCellAscent is in what is called 'Design Units'. The Cell Spacing design unit value of fonts is proportional to the actual height of the font on the device. We use this relationship to calculate cell ascent in device units. The rendering code has to just ensure that the x, y position passed to DrawString takes care of the ascent. |
private void HandlePaint(object sender, PaintEventArgs args) |
{ |
// clear the background |
Graphics g = args.Graphics; |
g.Clear(Color.AliceBlue); |
|
// create a pen |
Pen pen = new Pen(Color.Red, 1f); |
|
// the string to be drawn |
string s = "Side by side"; |
|
// the first font |
Font f1 = new Font("Arial", 10f); |
float strWidth1 = g.MeasureString(s, f1).Width; |
float fontHeight1 = f1.GetHeight(g); |
float fontAscentHeight1 = (fontHeight1/f1.FontFamily.GetLineSpacing(f1.Style))*f1.FontFamily.GetCellAscent(f1.Style); |
|
// the second font |
Font f2 = new Font("Times New Roman", 48); |
float fontHeight2 = f2.GetHeight(g); |
float fontAscentHeight2 = (fontHeight2/f2.FontFamily.GetLineSpacing(f2.Style))*f2.FontFamily.GetCellAscent(f2.Style); |
// draw the base line |
Point ptStart = new Point(0, this.ClientSize.Height/2); |
Point ptEnd = new Point(this.ClientSize.Width, this.ClientSize.Height/2); |
g.DrawLine(Pens.Black, ptStart, ptEnd); |
|
// draw string with first font |
g.DrawString(s, f1, Brushes.Red, new PointF(0, ptStart.Y - fontAscentHeight1)); |
// draw string with second font |
g.DrawString(s, f2, Brushes.Red, new PointF(strWidth1, ptStart.Y - fontAscentHeight2)); |
} |
참고 : http://msdn.microsoft.com/en-us/library/xwf9s90b.aspx
출처 : http://www.syncfusion.com/FAQ/windowsforms/faq_c39c.aspx
글
Visual Studio 유용한 정규식 패턴
- ".*[가-힣]+.*" : 한글이 하나이상 포함되어 있는 문자열 선택
visual studio 에서 찾아 바꾸기 정규식 사용시 () 태깅한 텍스트는 바꾸기 에서 $n 으로 대응됨. (n 은 1 에서 9가 들어갈수 있으며 0을 입력하면 전체를 의미함)
ex ) UE_LOG(Log, 로 시작하고
찾을 내용:
UE_LOG\(Log, ([\s\w\d,]+)TEXT\(\"([\s\w\d-_\(\)\[\]%*.,:=!]+)\"\)
바꿀 내용:
LOG($1"$2"
- msdn : https://msdn.microsoft.com/ko-kr/library/2k3te2cs.aspx 참고