응애맘마조

221201 강의 본문

공부/2D강의

221201 강의

TH.Wert 2022. 12. 2. 00:38
D3DXMatrixLookAtLH(&view, &Vector3(0, 0, 0), &Vector3(0, 0, 1), &Vector3(0, 1, 0));
D3DXMatrixOrthoOffCenterLH(&proj, 0.0f, (float)WinMaxWidth, 0.0f, (float)WinMaxHeight, 0, 1);

어제 해결되지 못했던 문제가 있었습니다. 디렉터리 설정에 문제가 있었습니다. 그러면 해결 됩니다.

오늘은 드디어 출력이 되는 날입니다.

//GUIDemo.h

#pragma once

#include "stdafx.h"

class GUIDemo : public IObject
{
public:
	virtual void Init() override;
	virtual void Destroy() override;
	virtual void Update() override;
	virtual void Render() override;
	virtual void PostRender() override;
	virtual void GUI() override;

	void PrintFPS();
	void PrintMousePose();
};

GUIDemo.h입니다. ImGui를 출력하기 위해서 만들었습니다. 코드에 대한 설명은 따로 없었습니다.

//GUIDemo.cpp

#include "GUIDemo.h"

void GUIDemo::Init() {}

void GUIDemo::Destroy() {}

void GUIDemo::Update() {}

void GUIDemo::Render() {}

void GUIDemo::PostRender() {}

void GUIDemo::GUI()
{
	static bool temp = true;
	ImGui::ShowDemoWindow(&temp);
	PrintFPS();
	PrintMousePose();
	Graphics::Get()->GUI();
}

void GUIDemo::PrintFPS()
{
	static bool bOpen = true;
	ImGui::SetNextWindowPos({ WinMaxWidth - 100, 15 });
	ImGui::SetNextWindowSize(ImVec2(200, 15));
	ImGui::Begin
	(
		"FPS",
		&bOpen,
		ImGuiWindowFlags_NoBackground |
		ImGuiWindowFlags_NoTitleBar |
		ImGuiWindowFlags_NoResize |
		ImGuiWindowFlags_NoMove
	);
	{
		string frame = "FPS : " + to_string((int)ImGui::GetIO().Framerate);
		ImGui::Text(frame.c_str());
	}
	ImGui::End();
}

void GUIDemo::PrintMousePose()
{
	static bool bOpen = true;
	ImGui::SetNextWindowPos({ WinMaxWidth - 100, 30 });
	ImGui::SetNextWindowSize(ImVec2(200, 60));
	ImGui::Begin
	(
		"MousePos",
		&bOpen,
		ImGuiWindowFlags_NoBackground |
		ImGuiWindowFlags_NoTitleBar |
		ImGuiWindowFlags_NoResize |
		ImGuiWindowFlags_NoMove
	);
	{
		string x = "X : " + to_string((int)Mouse::Get()->GetPosition().x);
		string y = "Y : " + to_string((int)Mouse::Get()->GetPosition().y);

		ImGui::TextColored(ImVec4(1, 0, 0, 1), x.c_str());
		ImGui::Text(y.c_str());
	}
	ImGui::End();
}

마지막으로 올리는 GUIDemo.cpp입니다. FPS와 마우스 커서 위치를 출력하는 목적으로 만들었습니다.
Init, Destroy, Update, Render, PostRender에는 따로 코드 내용이 없습니다.

사실..원래 이렇게 하고 실행을 했을때 출력이 되어야 정상인데 D3DXMatrixLookAtLH부분에서 '&에 l-value가 있어야 합니다.' 라는 오류가 뜹니다. 실행 부분도 잘 안되고 있는데 내일쯤이나 가능할 것 같습니다.

이후에는 언리얼 엔진에 대해서 짤막하게 했었습니다. 내일 처음부터 다시 한다고 해서 처음부터 작성해보겠습니다.

읽어주셔서 감사합니다.

'공부 > 2D강의' 카테고리의 다른 글

221205 강의  (0) 2022.12.05
221202 강의  (0) 2022.12.02
221130 강의  (2) 2022.12.01
221129 강의  (0) 2022.11.30
221128 강의  (0) 2022.11.29