Khaotic Engine Reborn
Loading...
Searching...
No Matches
font_shader_class Class Reference

Public Member Functions

 font_shader_class (const font_shader_class &)
 
bool initialize (ID3D11Device *, HWND)
 
void shutdown ()
 
bool render (ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, XMFLOAT4)
 

Detailed Description

Definition at line 20 of file font_shader_class.h.

Constructor & Destructor Documentation

◆ font_shader_class() [1/2]

font_shader_class::font_shader_class ( )

Definition at line 4 of file font_shader_class.cpp.

5{
6 vertex_shader_ = 0;
7 pixel_shader_ = 0;
8 layout_ = 0;
9 matrix_buffer_ = 0;
10 sample_state_ = 0;
11 pixel_buffer_ = 0;
12}

◆ font_shader_class() [2/2]

font_shader_class::font_shader_class ( const font_shader_class & other)

Definition at line 15 of file font_shader_class.cpp.

16{
17}

◆ ~font_shader_class()

font_shader_class::~font_shader_class ( )

Definition at line 20 of file font_shader_class.cpp.

21{
22}

Member Function Documentation

◆ initialize()

bool font_shader_class::initialize ( ID3D11Device * device,
HWND hwnd )

Definition at line 25 of file font_shader_class.cpp.

26{
27 Logger::Get().Log("Initializing font_shader_class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
28
29 bool result;
30 wchar_t vsFilename[128];
31 wchar_t psFilename[128];
32 int error;
33
34 // Set the filename of the vertex shader.
35 error = wcscpy_s(vsFilename, 128, L"src/hlsl/font.vs");
36 if (error != 0)
37 {
38 Logger::Get().Log("Error copying string", __FILE__, __LINE__, Logger::LogLevel::Error);
39 return false;
40 }
41
42 // Set the filename of the pixel shader.
43 error = wcscpy_s(psFilename, 128, L"src/hlsl/font.ps");
44 if (error != 0)
45 {
46 Logger::Get().Log("Error copying string", __FILE__, __LINE__, Logger::LogLevel::Error);
47 return false;
48 }
49
50 // initialize the vertex and pixel shaders.
51 result = initialize_shader(device, hwnd, vsFilename, psFilename);
52 if (!result)
53 {
54 Logger::Get().Log("Error initializing shader", __FILE__, __LINE__, Logger::LogLevel::Error);
55 return false;
56 }
57
58 Logger::Get().Log("font_shader_class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
59
60 return true;
61}
static Logger & Get()
Definition Logger.h:20
void Log(const std::string &message, const std::string &fileName, int lineNumber, LogLevel level=LogLevel::Info)
Definition Logger.h:158

◆ render()

bool font_shader_class::render ( ID3D11DeviceContext * deviceContext,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
ID3D11ShaderResourceView * texture,
XMFLOAT4 pixelColor )

Definition at line 71 of file font_shader_class.cpp.

73{
74 bool result;
75
76
77 // Set the shader parameters that it will use for rendering.
78 result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, pixelColor);
79 if (!result)
80 {
81 Logger::Get().Log("Error setting shader parameters", __FILE__, __LINE__, Logger::LogLevel::Error);
82 return false;
83 }
84
85 // Now render the prepared buffers with the shader.
86 render_shader(deviceContext, indexCount);
87
88 return true;
89}

◆ shutdown()

void font_shader_class::shutdown ( )

Definition at line 63 of file font_shader_class.cpp.

64{
65 // shutdown the vertex and pixel shaders as well as the related objects.
66 shutdown_shader();
67
68 return;
69}

The documentation for this class was generated from the following files: