본문 바로가기
프로그래밍/DirectX

DirectX-(1) Text 띄위기.

by Roland 2021. 11. 25.

DirectX-> 여러 클래스들을 모아둔 집합소.

 

상대경로.

.->현재 폴더

..->현재 폴더의 윗폴더.

 

프레임 : 1/60 보통 

 

Text.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#pragma once
 
class Text
{
public:
    Text();
    Text(float x, float y, BYTE r, BYTE g, BYTE b, string content);
    
public:
    void Render();
 
private:
    D3DXVECTOR2 Location;
    D3DXCOLOR Color;
    string Content;
};
cs

Text.CPP

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "stdafx.h"
#include "System/Device.h"
#include "Text.h"
 
// 생성자 
Text::Text()
{
    Location = { 5050 };
    Color = { 0001 };
    Content = "Hi Hello_World";
}
 
// 복사 생성자.
Text::Text(float x, float y, BYTE r, BYTE g, BYTE b, string content)
{
    Location = { x, y };
    Color = { r / 255.0f, g / 255.0f , b / 255.0f, 1.0f };
    Content = content;
}
// 렌더링
void Text::Render()
{
    RenderImGuiText(Location.x, Location.y, (BYTE)Color.r * 255, (BYTE)Color.g * 255, (BYTE)Color.b * 255, Content);
}
cs

위와 같이 텍스트가 출력된다.

'프로그래밍 > DirectX' 카테고리의 다른 글

VertexLine  (0) 2021.09.01
그래픽 파이프 라인(Graphic Pipe Line)  (0) 2021.09.01

댓글