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

Public Member Functions

 bitmap_class (const bitmap_class &)
 
bool initialize (ID3D11Device *, ID3D11DeviceContext *, int, int, char *, int, int)
 
void shutdown ()
 
bool render (ID3D11DeviceContext *)
 
int get_index_count ()
 
ID3D11ShaderResourceView * get_texture ()
 
void set_render_location (int, int)
 

Detailed Description

Definition at line 21 of file bitmap_class.h.

Constructor & Destructor Documentation

◆ bitmap_class() [1/2]

bitmap_class::bitmap_class ( )

Definition at line 3 of file bitmap_class.cpp.

4{
5 vertex_buffer_ = 0;
6 index_buffer_ = 0;
7 texture_ = 0;
8}

◆ bitmap_class() [2/2]

bitmap_class::bitmap_class ( const bitmap_class & other)

Definition at line 11 of file bitmap_class.cpp.

12{
13}

◆ ~bitmap_class()

bitmap_class::~bitmap_class ( )

Definition at line 16 of file bitmap_class.cpp.

17{
18}

Member Function Documentation

◆ get_index_count()

int bitmap_class::get_index_count ( )

Definition at line 86 of file bitmap_class.cpp.

87{
88 return index_count_;
89}

◆ get_texture()

ID3D11ShaderResourceView * bitmap_class::get_texture ( )

Definition at line 91 of file bitmap_class.cpp.

92{
93 return texture_->GetTexture();
94}

◆ initialize()

bool bitmap_class::initialize ( ID3D11Device * device,
ID3D11DeviceContext * deviceContext,
int screenWidth,
int screenHeight,
char * textureFilename,
int renderX,
int renderY )

Definition at line 21 of file bitmap_class.cpp.

22{
23 Logger::Get().Log("Initializing bitmap class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
24
25 bool result;
26
27 // Store the screen size.
28 screen_width_ = screenWidth;
29 screen_height_ = screenHeight;
30
31 // Store where the bitmap should be rendered to.
32 render_x_ = renderX;
33 render_y_ = renderY;
34
35 // initialize the vertex and index buffer that hold the geometry for the bitmap quad.
36 result = initialize_buffers(device);
37 if (!result)
38 {
39 Logger::Get().Log("Failed to initialize buffers", __FILE__, __LINE__, Logger::LogLevel::Error);
40 return false;
41 }
42
43 // Load the texture for this bitmap.
44 result = load_texture(device, deviceContext, textureFilename);
45 if (!result)
46 {
47 Logger::Get().Log("Failed to load texture", __FILE__, __LINE__, Logger::LogLevel::Error);
48 return false;
49 }
50
51 Logger::Get().Log("Bitmap class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
52
53 return true;
54}
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 bitmap_class::render ( ID3D11DeviceContext * deviceContext)

Definition at line 67 of file bitmap_class.cpp.

68{
69 bool result;
70
71
72 // Update the buffers if the position of the bitmap has changed from its original position.
73 result = update_buffers(deviceContext);
74 if (!result)
75 {
76 Logger::Get().Log("Failed to update buffers", __FILE__, __LINE__, Logger::LogLevel::Error);
77 return false;
78 }
79
80 // Put the vertex and index buffers on the graphics pipeline to prepare them for drawing.
81 render_buffers(deviceContext);
82
83 return true;
84}

◆ set_render_location()

void bitmap_class::set_render_location ( int x,
int y )

Definition at line 356 of file bitmap_class.cpp.

357{
358 render_x_ = x;
359 render_y_ = y;
360 return;
361}

◆ shutdown()

void bitmap_class::shutdown ( )

Definition at line 56 of file bitmap_class.cpp.

57{
58 // Release the bitmap texture.
59 release_texture();
60
61 // Release the vertex and index buffers.
62 shutdown_buffers();
63
64 return;
65}

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