Skip to content
This repository has been archived by the owner on Jul 29, 2020. It is now read-only.

Commit

Permalink
d3d9ex fix (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
Localplayer authored and kwilcz committed Jun 3, 2019
1 parent 85e613b commit 84cbab9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Antario/Utils/Font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ Font::Font(const char* strFontName, int height, bool bAntialias, LPDIRECT3DDEVIC
/* Prerender ASCII printable char textures so it wont have to do it later on. Leave special chars for runtime. */
GenerateAsciiChars();

/* Create vertex buffer for rendering purposes */
this->pDevice->CreateVertexBuffer(sizeof(Vertex) * 12, NULL, D3DFVF_TLVERTEX,
D3DPOOL_MANAGED, &pVertexBuffer, nullptr);

/* Create vertex buffer for rendering purposes */
this->pDevice->CreateVertexBuffer(sizeof(Vertex) * 12, D3DUSAGE_DYNAMIC, D3DFVF_TLVERTEX,
D3DPOOL_DEFAULT, &pVertexBuffer, nullptr);
SetupRenderStates();

/* Get height of the string */
Expand Down Expand Up @@ -95,8 +95,8 @@ void Font::OnLostDevice()
void Font::OnResetDevice(LPDIRECT3DDEVICE9 pDevice)
{
this->pDevice = pDevice;
this->pDevice->CreateVertexBuffer(sizeof(Vertex) * 12, NULL, D3DFVF_TLVERTEX,
D3DPOOL_MANAGED, &pVertexBuffer, nullptr);
this->pDevice->CreateVertexBuffer(sizeof(Vertex) * 12, D3DUSAGE_DYNAMIC, D3DFVF_TLVERTEX,
D3DPOOL_DEFAULT, &pVertexBuffer, nullptr);
SetupRenderStates();
}

Expand Down Expand Up @@ -269,7 +269,7 @@ void Font::CreateCharTexture(T ch)

/* create new texture for our glyph */
IDirect3DTexture9* tx = nullptr;
HRESULT error = D3DXCreateTexture(pDevice, bmp.width, bmp.rows, 1, 0, glyph.colored ? D3DFMT_A8R8G8B8 : D3DFMT_A8, D3DPOOL_MANAGED, &tx);
HRESULT error = D3DXCreateTexture(pDevice, bmp.width, bmp.rows, 1, D3DUSAGE_DYNAMIC, glyph.colored ? D3DFMT_A8R8G8B8 : D3DFMT_A8, D3DPOOL_DEFAULT, &tx);
///TODO: Catch the errors

/* Render to texture by copying bitmap data to locked rect */
Expand Down Expand Up @@ -410,4 +410,4 @@ template void Font::CreateCharTexture<int>(int ch);
template void Font::CreateCharTexture<char>(char ch);
template void Font::CreateCharTexture<wchar_t>(wchar_t ch);
template void Font::CreateCharTexture<char16_t>(char16_t ch);
template void Font::CreateCharTexture<char32_t>(char32_t ch);
template void Font::CreateCharTexture<char32_t>(char32_t ch);

0 comments on commit 84cbab9

Please sign in to comment.