mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
TAB to spaces
This commit is contained in:
parent
5ca563b5a5
commit
a09f426b89
@ -137,7 +137,7 @@ static void ImImpl_RenderDrawLists(ImDrawList** const cmd_lists, int cmd_lists_c
|
|||||||
{
|
{
|
||||||
const ImDrawCmd* pcmd = &cmd_list->commands[cmd_i];
|
const ImDrawCmd* pcmd = &cmd_list->commands[cmd_i];
|
||||||
const D3D11_RECT r = { (LONG)pcmd->clip_rect.x, (LONG)pcmd->clip_rect.y, (LONG)pcmd->clip_rect.z, (LONG)pcmd->clip_rect.w };
|
const D3D11_RECT r = { (LONG)pcmd->clip_rect.x, (LONG)pcmd->clip_rect.y, (LONG)pcmd->clip_rect.z, (LONG)pcmd->clip_rect.w };
|
||||||
g_pd3dDeviceImmediateContext->PSSetShaderResources(0, 1, (ID3D11ShaderResourceView**)&pcmd->texture_id);
|
g_pd3dDeviceImmediateContext->PSSetShaderResources(0, 1, (ID3D11ShaderResourceView**)&pcmd->texture_id);
|
||||||
g_pd3dDeviceImmediateContext->RSSetScissorRects(1, &r);
|
g_pd3dDeviceImmediateContext->RSSetScissorRects(1, &r);
|
||||||
g_pd3dDeviceImmediateContext->Draw(pcmd->vtx_count, vtx_offset);
|
g_pd3dDeviceImmediateContext->Draw(pcmd->vtx_count, vtx_offset);
|
||||||
vtx_offset += pcmd->vtx_count;
|
vtx_offset += pcmd->vtx_count;
|
||||||
@ -323,8 +323,8 @@ void CleanupDevice()
|
|||||||
|
|
||||||
// InitImGui
|
// InitImGui
|
||||||
if (g_pFontSampler) g_pFontSampler->Release();
|
if (g_pFontSampler) g_pFontSampler->Release();
|
||||||
if (ID3D11ShaderResourceView* font_texture_view = (ID3D11ShaderResourceView*)ImGui::GetIO().Font->TexID)
|
if (ID3D11ShaderResourceView* font_texture_view = (ID3D11ShaderResourceView*)ImGui::GetIO().Font->TexID)
|
||||||
font_texture_view->Release();
|
font_texture_view->Release();
|
||||||
if (g_pVB) g_pVB->Release();
|
if (g_pVB) g_pVB->Release();
|
||||||
|
|
||||||
// InitDeviceD3D
|
// InitDeviceD3D
|
||||||
@ -381,41 +381,41 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
void LoadFontTexture(ImFont* font)
|
void LoadFontTexture(ImFont* font)
|
||||||
{
|
{
|
||||||
IM_ASSERT(font && font->IsLoaded());
|
IM_ASSERT(font && font->IsLoaded());
|
||||||
|
|
||||||
// Create texture
|
// Create texture
|
||||||
D3D11_TEXTURE2D_DESC desc;
|
D3D11_TEXTURE2D_DESC desc;
|
||||||
ZeroMemory(&desc, sizeof(desc));
|
ZeroMemory(&desc, sizeof(desc));
|
||||||
desc.Width = font->TexWidth;
|
desc.Width = font->TexWidth;
|
||||||
desc.Height = font->TexHeight;
|
desc.Height = font->TexHeight;
|
||||||
desc.MipLevels = 1;
|
desc.MipLevels = 1;
|
||||||
desc.ArraySize = 1;
|
desc.ArraySize = 1;
|
||||||
desc.Format = DXGI_FORMAT_A8_UNORM;
|
desc.Format = DXGI_FORMAT_A8_UNORM;
|
||||||
desc.SampleDesc.Count = 1;
|
desc.SampleDesc.Count = 1;
|
||||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||||
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
||||||
desc.CPUAccessFlags = 0;
|
desc.CPUAccessFlags = 0;
|
||||||
|
|
||||||
ID3D11Texture2D *pTexture = NULL;
|
ID3D11Texture2D *pTexture = NULL;
|
||||||
D3D11_SUBRESOURCE_DATA subResource;
|
D3D11_SUBRESOURCE_DATA subResource;
|
||||||
subResource.pSysMem = font->TexPixels;
|
subResource.pSysMem = font->TexPixels;
|
||||||
subResource.SysMemPitch = desc.Width * 1;
|
subResource.SysMemPitch = desc.Width * 1;
|
||||||
subResource.SysMemSlicePitch = 0;
|
subResource.SysMemSlicePitch = 0;
|
||||||
g_pd3dDevice->CreateTexture2D(&desc, &subResource, &pTexture);
|
g_pd3dDevice->CreateTexture2D(&desc, &subResource, &pTexture);
|
||||||
|
|
||||||
// Create texture view
|
// Create texture view
|
||||||
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
|
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
|
||||||
ZeroMemory(&srvDesc, sizeof(srvDesc));
|
ZeroMemory(&srvDesc, sizeof(srvDesc));
|
||||||
srvDesc.Format = DXGI_FORMAT_A8_UNORM;
|
srvDesc.Format = DXGI_FORMAT_A8_UNORM;
|
||||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
|
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
|
||||||
srvDesc.Texture2D.MipLevels = desc.MipLevels;
|
srvDesc.Texture2D.MipLevels = desc.MipLevels;
|
||||||
srvDesc.Texture2D.MostDetailedMip = 0;
|
srvDesc.Texture2D.MostDetailedMip = 0;
|
||||||
ID3D11ShaderResourceView* font_texture_view = NULL;
|
ID3D11ShaderResourceView* font_texture_view = NULL;
|
||||||
g_pd3dDevice->CreateShaderResourceView(pTexture, &srvDesc, &font_texture_view);
|
g_pd3dDevice->CreateShaderResourceView(pTexture, &srvDesc, &font_texture_view);
|
||||||
pTexture->Release();
|
pTexture->Release();
|
||||||
|
|
||||||
// Store ID
|
// Store ID
|
||||||
font->TexID = (void *)font_texture_view;
|
font->TexID = (void *)font_texture_view;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitImGui()
|
void InitImGui()
|
||||||
@ -469,7 +469,7 @@ void InitImGui()
|
|||||||
io.Font->LoadDefault();
|
io.Font->LoadDefault();
|
||||||
//io.Font->LoadFromFileTTF("myfont.ttf", font_size_px, ImFont::GetGlyphRangesDefault());
|
//io.Font->LoadFromFileTTF("myfont.ttf", font_size_px, ImFont::GetGlyphRangesDefault());
|
||||||
//io.Font->DisplayOffset.y += 0.0f;
|
//io.Font->DisplayOffset.y += 0.0f;
|
||||||
LoadFontTexture(io.Font);
|
LoadFontTexture(io.Font);
|
||||||
|
|
||||||
// Create texture sampler
|
// Create texture sampler
|
||||||
{
|
{
|
||||||
@ -570,10 +570,10 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE, LPWSTR, int)
|
|||||||
show_test_window ^= ImGui::Button("Test Window");
|
show_test_window ^= ImGui::Button("Test Window");
|
||||||
show_another_window ^= ImGui::Button("Another Window");
|
show_another_window ^= ImGui::Button("Another Window");
|
||||||
|
|
||||||
static ImFont* font2 = NULL;
|
static ImFont* font2 = NULL;
|
||||||
if (!font2) { font2 = new ImFont(); font2->LoadFromFileTTF("../../extra_fonts/ArialUni.ttf", 30.0f); LoadFontTexture(font2); }
|
if (!font2) { font2 = new ImFont(); font2->LoadFromFileTTF("../../extra_fonts/ArialUni.ttf", 30.0f); LoadFontTexture(font2); }
|
||||||
ImGui::Image(font2->TexID, ImVec2((float)font2->TexWidth, (FLOAT)font2->TexHeight));
|
ImGui::Image(font2->TexID, ImVec2((float)font2->TexWidth, (FLOAT)font2->TexHeight));
|
||||||
//ImGui::GetWindowDrawList()->AddText(font2, 30.0f, ImGui::GetCursorScreenPos(), 0xFFFFFFFF, "Another font");
|
//ImGui::GetWindowDrawList()->AddText(font2, 30.0f, ImGui::GetCursorScreenPos(), 0xFFFFFFFF, "Another font");
|
||||||
|
|
||||||
// Calculate and show frame rate
|
// Calculate and show frame rate
|
||||||
static float ms_per_frame[120] = { 0 };
|
static float ms_per_frame[120] = { 0 };
|
||||||
|
@ -69,11 +69,11 @@ static void ImImpl_RenderDrawLists(ImDrawList** const cmd_lists, int cmd_lists_c
|
|||||||
g_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
|
g_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
|
||||||
g_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
|
g_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
|
||||||
g_pd3dDevice->SetRenderState( D3DRS_SCISSORTESTENABLE, true );
|
g_pd3dDevice->SetRenderState( D3DRS_SCISSORTESTENABLE, true );
|
||||||
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
|
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
|
||||||
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_DIFFUSE );
|
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_DIFFUSE );
|
||||||
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
|
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
|
||||||
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
|
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
|
||||||
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
|
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
|
||||||
g_pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_POINT );
|
g_pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_POINT );
|
||||||
g_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT );
|
g_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT );
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ static void ImImpl_RenderDrawLists(ImDrawList** const cmd_lists, int cmd_lists_c
|
|||||||
{
|
{
|
||||||
const ImDrawCmd* pcmd = &cmd_list->commands[cmd_i];
|
const ImDrawCmd* pcmd = &cmd_list->commands[cmd_i];
|
||||||
const RECT r = { (LONG)pcmd->clip_rect.x, (LONG)pcmd->clip_rect.y, (LONG)pcmd->clip_rect.z, (LONG)pcmd->clip_rect.w };
|
const RECT r = { (LONG)pcmd->clip_rect.x, (LONG)pcmd->clip_rect.y, (LONG)pcmd->clip_rect.z, (LONG)pcmd->clip_rect.w };
|
||||||
g_pd3dDevice->SetTexture( 0, (LPDIRECT3DTEXTURE9)pcmd->texture_id );
|
g_pd3dDevice->SetTexture( 0, (LPDIRECT3DTEXTURE9)pcmd->texture_id );
|
||||||
g_pd3dDevice->SetScissorRect(&r);
|
g_pd3dDevice->SetScissorRect(&r);
|
||||||
g_pd3dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, vtx_offset, pcmd->vtx_count/3);
|
g_pd3dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, vtx_offset, pcmd->vtx_count/3);
|
||||||
vtx_offset += pcmd->vtx_count;
|
vtx_offset += pcmd->vtx_count;
|
||||||
@ -130,8 +130,8 @@ void CleanupDevice()
|
|||||||
if (g_pVB) g_pVB->Release();
|
if (g_pVB) g_pVB->Release();
|
||||||
|
|
||||||
// InitDeviceD3D
|
// InitDeviceD3D
|
||||||
if (LPDIRECT3DTEXTURE9 tex = (LPDIRECT3DTEXTURE9)ImGui::GetIO().Font->TexID)
|
if (LPDIRECT3DTEXTURE9 tex = (LPDIRECT3DTEXTURE9)ImGui::GetIO().Font->TexID)
|
||||||
tex->Release();
|
tex->Release();
|
||||||
if (g_pd3dDevice) g_pd3dDevice->Release();
|
if (g_pd3dDevice) g_pd3dDevice->Release();
|
||||||
if (g_pD3D) g_pD3D->Release();
|
if (g_pD3D) g_pD3D->Release();
|
||||||
}
|
}
|
||||||
@ -176,27 +176,27 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
void LoadFontTexture(ImFont* font)
|
void LoadFontTexture(ImFont* font)
|
||||||
{
|
{
|
||||||
IM_ASSERT(font && font->IsLoaded());
|
IM_ASSERT(font && font->IsLoaded());
|
||||||
|
|
||||||
LPDIRECT3DTEXTURE9 pTexture = NULL;
|
LPDIRECT3DTEXTURE9 pTexture = NULL;
|
||||||
if (D3DXCreateTexture(g_pd3dDevice, font->TexWidth, font->TexHeight, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8, D3DPOOL_DEFAULT, &pTexture) < 0)
|
if (D3DXCreateTexture(g_pd3dDevice, font->TexWidth, font->TexHeight, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8, D3DPOOL_DEFAULT, &pTexture) < 0)
|
||||||
{
|
{
|
||||||
IM_ASSERT(0);
|
IM_ASSERT(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy pixels
|
// Copy pixels
|
||||||
D3DLOCKED_RECT tex_locked_rect;
|
D3DLOCKED_RECT tex_locked_rect;
|
||||||
if (pTexture->LockRect(0, &tex_locked_rect, NULL, 0) != D3D_OK)
|
if (pTexture->LockRect(0, &tex_locked_rect, NULL, 0) != D3D_OK)
|
||||||
{
|
{
|
||||||
IM_ASSERT(0);
|
IM_ASSERT(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int y = 0; y < font->TexHeight; y++)
|
for (int y = 0; y < font->TexHeight; y++)
|
||||||
memcpy((unsigned char *)tex_locked_rect.pBits + tex_locked_rect.Pitch * y, font->TexPixels + font->TexWidth * y, font->TexWidth);
|
memcpy((unsigned char *)tex_locked_rect.pBits + tex_locked_rect.Pitch * y, font->TexPixels + font->TexWidth * y, font->TexWidth);
|
||||||
pTexture->UnlockRect(0);
|
pTexture->UnlockRect(0);
|
||||||
|
|
||||||
font->TexID = (void *)pTexture;
|
font->TexID = (void *)pTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitImGui()
|
void InitImGui()
|
||||||
@ -242,7 +242,7 @@ void InitImGui()
|
|||||||
io.Font->LoadDefault();
|
io.Font->LoadDefault();
|
||||||
//io.Font->LoadFromFileTTF("myfont.ttf", font_size_px, ImFont::GetGlyphRangesDefault());
|
//io.Font->LoadFromFileTTF("myfont.ttf", font_size_px, ImFont::GetGlyphRangesDefault());
|
||||||
//io.Font->DisplayOffset.y += 0.0f;
|
//io.Font->DisplayOffset.y += 0.0f;
|
||||||
LoadFontTexture(io.Font);
|
LoadFontTexture(io.Font);
|
||||||
}
|
}
|
||||||
|
|
||||||
INT64 ticks_per_second = 0;
|
INT64 ticks_per_second = 0;
|
||||||
@ -328,10 +328,10 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE, LPWSTR, int)
|
|||||||
show_test_window ^= ImGui::Button("Test Window");
|
show_test_window ^= ImGui::Button("Test Window");
|
||||||
show_another_window ^= ImGui::Button("Another Window");
|
show_another_window ^= ImGui::Button("Another Window");
|
||||||
|
|
||||||
static ImFont* font2 = NULL;
|
static ImFont* font2 = NULL;
|
||||||
if (!font2) { font2 = new ImFont(); font2->LoadFromFileTTF("../../extra_fonts/ArialUni.ttf", 30.0f); LoadFontTexture(font2); }
|
if (!font2) { font2 = new ImFont(); font2->LoadFromFileTTF("../../extra_fonts/ArialUni.ttf", 30.0f); LoadFontTexture(font2); }
|
||||||
ImGui::Image(font2->TexID, ImVec2((float)font2->TexWidth, (FLOAT)font2->TexHeight));
|
ImGui::Image(font2->TexID, ImVec2((float)font2->TexWidth, (FLOAT)font2->TexHeight));
|
||||||
//ImGui::GetWindowDrawList()->AddText(font2, 30.0f, ImGui::GetCursorScreenPos(), 0xFFFFFFFF, "Another font");
|
//ImGui::GetWindowDrawList()->AddText(font2, 30.0f, ImGui::GetCursorScreenPos(), 0xFFFFFFFF, "Another font");
|
||||||
|
|
||||||
// Calculate and show frame rate
|
// Calculate and show frame rate
|
||||||
static float ms_per_frame[120] = { 0 };
|
static float ms_per_frame[120] = { 0 };
|
||||||
|
@ -92,7 +92,7 @@ static void ImImpl_RenderDrawLists(ImDrawList** const cmd_lists, int cmd_lists_c
|
|||||||
const ImDrawCmd* pcmd_end = cmd_list->commands.end();
|
const ImDrawCmd* pcmd_end = cmd_list->commands.end();
|
||||||
for (const ImDrawCmd* pcmd = cmd_list->commands.begin(); pcmd != pcmd_end; pcmd++)
|
for (const ImDrawCmd* pcmd = cmd_list->commands.begin(); pcmd != pcmd_end; pcmd++)
|
||||||
{
|
{
|
||||||
glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->texture_id);
|
glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->texture_id);
|
||||||
glScissor((int)pcmd->clip_rect.x, (int)(height - pcmd->clip_rect.w), (int)(pcmd->clip_rect.z - pcmd->clip_rect.x), (int)(pcmd->clip_rect.w - pcmd->clip_rect.y));
|
glScissor((int)pcmd->clip_rect.x, (int)(height - pcmd->clip_rect.w), (int)(pcmd->clip_rect.z - pcmd->clip_rect.x), (int)(pcmd->clip_rect.w - pcmd->clip_rect.y));
|
||||||
glDrawArrays(GL_TRIANGLES, vtx_offset, pcmd->vtx_count);
|
glDrawArrays(GL_TRIANGLES, vtx_offset, pcmd->vtx_count);
|
||||||
vtx_offset += pcmd->vtx_count;
|
vtx_offset += pcmd->vtx_count;
|
||||||
@ -241,15 +241,15 @@ void InitGL()
|
|||||||
|
|
||||||
void LoadFontTexture(ImFont* font)
|
void LoadFontTexture(ImFont* font)
|
||||||
{
|
{
|
||||||
IM_ASSERT(font && font->IsLoaded());
|
IM_ASSERT(font && font->IsLoaded());
|
||||||
|
|
||||||
GLuint tex_id;
|
GLuint tex_id;
|
||||||
glGenTextures(1, &tex_id);
|
glGenTextures(1, &tex_id);
|
||||||
glBindTexture(GL_TEXTURE_2D, tex_id);
|
glBindTexture(GL_TEXTURE_2D, tex_id);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, font->TexWidth, font->TexHeight, 0, GL_RED, GL_UNSIGNED_BYTE, font->TexPixels);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, font->TexWidth, font->TexHeight, 0, GL_RED, GL_UNSIGNED_BYTE, font->TexPixels);
|
||||||
font->TexID = (void *)(intptr_t)tex_id;
|
font->TexID = (void *)(intptr_t)tex_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitImGui()
|
void InitImGui()
|
||||||
@ -284,7 +284,7 @@ void InitImGui()
|
|||||||
io.Font->LoadDefault();
|
io.Font->LoadDefault();
|
||||||
//io.Font->LoadFromFileTTF("myfont.ttf", font_size_px, ImFont::GetGlyphRangesDefault());
|
//io.Font->LoadFromFileTTF("myfont.ttf", font_size_px, ImFont::GetGlyphRangesDefault());
|
||||||
//io.Font->DisplayOffset.y += 0.0f;
|
//io.Font->DisplayOffset.y += 0.0f;
|
||||||
LoadFontTexture(io.Font);
|
LoadFontTexture(io.Font);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateImGui()
|
void UpdateImGui()
|
||||||
@ -344,10 +344,10 @@ int main(int argc, char** argv)
|
|||||||
show_test_window ^= ImGui::Button("Test Window");
|
show_test_window ^= ImGui::Button("Test Window");
|
||||||
show_another_window ^= ImGui::Button("Another Window");
|
show_another_window ^= ImGui::Button("Another Window");
|
||||||
|
|
||||||
static ImFont* font2 = NULL;
|
static ImFont* font2 = NULL;
|
||||||
if (!font2) { font2 = new ImFont(); font2->LoadFromFileTTF("../../extra_fonts/ArialUni.ttf", 30.0f); LoadFontTexture(font2); }
|
if (!font2) { font2 = new ImFont(); font2->LoadFromFileTTF("../../extra_fonts/ArialUni.ttf", 30.0f); LoadFontTexture(font2); }
|
||||||
ImGui::Image(font2->TexID, ImVec2((float)font2->TexWidth, (float)font2->TexHeight));
|
ImGui::Image(font2->TexID, ImVec2((float)font2->TexWidth, (float)font2->TexHeight));
|
||||||
//ImGui::GetWindowDrawList()->AddText(font2, 30.0f, ImGui::GetCursorScreenPos(), 0xFFFFFFFF, "Another font");
|
//ImGui::GetWindowDrawList()->AddText(font2, 30.0f, ImGui::GetCursorScreenPos(), 0xFFFFFFFF, "Another font");
|
||||||
|
|
||||||
// Calculate and show frame rate
|
// Calculate and show frame rate
|
||||||
static float ms_per_frame[120] = { 0 };
|
static float ms_per_frame[120] = { 0 };
|
||||||
|
@ -252,10 +252,10 @@ int main(int argc, char** argv)
|
|||||||
show_test_window ^= ImGui::Button("Test Window");
|
show_test_window ^= ImGui::Button("Test Window");
|
||||||
show_another_window ^= ImGui::Button("Another Window");
|
show_another_window ^= ImGui::Button("Another Window");
|
||||||
|
|
||||||
static ImFont* font2 = NULL;
|
static ImFont* font2 = NULL;
|
||||||
if (!font2) { font2 = new ImFont(); font2->LoadFromFileTTF("../../extra_fonts/ArialUni.ttf", 30.0f); LoadFontTexture(font2); }
|
if (!font2) { font2 = new ImFont(); font2->LoadFromFileTTF("../../extra_fonts/ArialUni.ttf", 30.0f); LoadFontTexture(font2); }
|
||||||
ImGui::Image(font2->TexID, ImVec2((float)font2->TexWidth, (float)font2->TexHeight));
|
ImGui::Image(font2->TexID, ImVec2((float)font2->TexWidth, (float)font2->TexHeight));
|
||||||
//ImGui::GetWindowDrawList()->AddText(font2, 30.0f, ImGui::GetCursorScreenPos(), 0xFFFFFFFF, "Another font");
|
//ImGui::GetWindowDrawList()->AddText(font2, 30.0f, ImGui::GetCursorScreenPos(), 0xFFFFFFFF, "Another font");
|
||||||
|
|
||||||
// Calculate and show frame rate
|
// Calculate and show frame rate
|
||||||
static float ms_per_frame[120] = { 0 };
|
static float ms_per_frame[120] = { 0 };
|
||||||
|
@ -7358,7 +7358,7 @@ void ImGui::ShowTestWindow(bool* opened)
|
|||||||
|
|
||||||
if (ImGui::TreeNode("Images"))
|
if (ImGui::TreeNode("Images"))
|
||||||
{
|
{
|
||||||
ImGui::TextWrapped("Below we are displaying the font texture (which is the only texture we have access to in this demo). Use the 'ImTextureID' type as storage to pass pointers or identifier to your own texture data.\nHover the texture for a zoomed view.");
|
ImGui::TextWrapped("Below we are displaying the font texture (which is the only texture we have access to in this demo). Use the 'ImTextureID' type as storage to pass pointers or identifier to your own texture data. Hover the texture for a zoomed view!");
|
||||||
ImVec2 tex_screen_pos = ImGui::GetCursorScreenPos();
|
ImVec2 tex_screen_pos = ImGui::GetCursorScreenPos();
|
||||||
float tex_w = (float)ImGui::GetIO().Font->TexWidth;
|
float tex_w = (float)ImGui::GetIO().Font->TexWidth;
|
||||||
float tex_h = (float)ImGui::GetIO().Font->TexHeight;
|
float tex_h = (float)ImGui::GetIO().Font->TexHeight;
|
||||||
|
Loading…
Reference in New Issue
Block a user