Merge remote-tracking branch 'upstream/master' into 2015-01-truetype

Conflicts:
	imgui.cpp
	imgui.h
This commit is contained in:
ocornut
2015-01-15 18:07:44 +00:00
6 changed files with 129 additions and 88 deletions

View File

@ -543,6 +543,10 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE, LPWSTR, int)
InitImGui();
bool show_test_window = true;
bool show_another_window = false;
ImVec4 clear_col(0.8f, 0.6f, 0.6f, 1.0f);
// Enter the message loop
MSG msg;
ZeroMemory(&msg, sizeof(msg));
@ -554,20 +558,17 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE, LPWSTR, int)
DispatchMessage(&msg);
continue;
}
UpdateImGui();
static bool show_test_window = true;
static bool show_another_window = false;
// 1. Show a simple window
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets appears in a window automatically called "Debug"
{
static float f;
ImGui::Text("Hello, world!");
ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
show_test_window ^= ImGui::Button("Test Window");
show_another_window ^= ImGui::Button("Another Window");
ImGui::ColorEdit3("clear color", (float*)&clear_col);
if (ImGui::Button("Test Window")) show_test_window ^= 1;
if (ImGui::Button("Another Window")) show_another_window ^= 1;
// Calculate and show frame rate
static float ms_per_frame[120] = { 0 };
@ -597,8 +598,7 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE, LPWSTR, int)
}
// Rendering
float clearColor[4] = { 204 / 255.f, 153 / 255.f, 153 / 255.f };
g_pd3dDeviceImmediateContext->ClearRenderTargetView(g_mainRenderTargetView, clearColor);
g_pd3dDeviceImmediateContext->ClearRenderTargetView(g_mainRenderTargetView, (float*)&clear_col);
ImGui::Render();
g_pSwapChain->Present(0, 0);
}

View File

@ -303,6 +303,10 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE, LPWSTR, int)
InitImGui();
bool show_test_window = true;
bool show_another_window = false;
ImVec4 clear_col(0.8f, 0.6f, 0.6f, 1.0f);
// Enter the message loop
MSG msg;
ZeroMemory(&msg, sizeof(msg));
@ -314,20 +318,17 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE, LPWSTR, int)
DispatchMessage(&msg);
continue;
}
UpdateImGui();
static bool show_test_window = true;
static bool show_another_window = false;
// 1. Show a simple window
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets appears in a window automatically called "Debug"
{
static float f;
ImGui::Text("Hello, world!");
ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
show_test_window ^= ImGui::Button("Test Window");
show_another_window ^= ImGui::Button("Another Window");
ImGui::ColorEdit3("clear color", (float*)&clear_col);
if (ImGui::Button("Test Window")) show_test_window ^= 1;
if (ImGui::Button("Another Window")) show_another_window ^= 1;
// Calculate and show frame rate
static float ms_per_frame[120] = { 0 };
@ -360,7 +361,8 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE, LPWSTR, int)
g_pd3dDevice->SetRenderState(D3DRS_ZENABLE, false);
g_pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, false);
g_pd3dDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, false);
g_pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(204, 153, 153), 1.0f, 0);
D3DCOLOR clear_col_dx = D3DCOLOR_RGBA((int)(clear_col.x*255.0f), (int)(clear_col.y*255.0f), (int)(clear_col.z*255.0f), (int)(clear_col.w*255.0f));
g_pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, clear_col_dx, 1.0f, 0);
if (g_pd3dDevice->BeginScene() >= 0)
{
ImGui::Render();

View File

@ -322,6 +322,10 @@ int main(int argc, char** argv)
InitGL();
InitImGui();
bool show_test_window = true;
bool show_another_window = false;
ImVec4 clear_col(0.8f, 0.6f, 0.6f, 1.0f);
while (!glfwWindowShouldClose(window))
{
ImGuiIO& io = ImGui::GetIO();
@ -330,17 +334,15 @@ int main(int argc, char** argv)
glfwPollEvents();
UpdateImGui();
static bool show_test_window = true;
static bool show_another_window = false;
// 1. Show a simple window
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets appears in a window automatically called "Debug"
{
static float f;
ImGui::Text("Hello, world!");
ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
show_test_window ^= ImGui::Button("Test Window");
show_another_window ^= ImGui::Button("Another Window");
ImGui::ColorEdit3("clear color", (float*)&clear_col);
if (ImGui::Button("Test Window")) show_test_window ^= 1;
if (ImGui::Button("Another Window")) show_another_window ^= 1;
// Calculate and show frame rate
static float ms_per_frame[120] = { 0 };
@ -371,7 +373,7 @@ int main(int argc, char** argv)
// Rendering
glViewport(0, 0, (int)io.DisplaySize.x, (int)io.DisplaySize.y);
glClearColor(0.8f, 0.6f, 0.6f, 1.0f);
glClearColor(clear_col.x, clear_col.y, clear_col.z, clear_col.w);
glClear(GL_COLOR_BUFFER_BIT);
ImGui::Render();
glfwSwapBuffers(window);

View File

@ -232,6 +232,10 @@ int main(int argc, char** argv)
InitGL();
InitImGui();
bool show_test_window = true;
bool show_another_window = false;
ImVec4 clear_col(0.8f, 0.6f, 0.6f, 1.0f);
while (!glfwWindowShouldClose(window))
{
ImGuiIO& io = ImGui::GetIO();
@ -239,17 +243,15 @@ int main(int argc, char** argv)
glfwPollEvents();
UpdateImGui();
static bool show_test_window = true;
static bool show_another_window = false;
// 1. Show a simple window
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets appears in a window automatically called "Debug"
{
static float f;
ImGui::Text("Hello, world!");
ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
show_test_window ^= ImGui::Button("Test Window");
show_another_window ^= ImGui::Button("Another Window");
ImGui::ColorEdit3("clear color", (float*)&clear_col);
if (ImGui::Button("Test Window")) show_test_window ^= 1;
if (ImGui::Button("Another Window")) show_another_window ^= 1;
// Calculate and show frame rate
static float ms_per_frame[120] = { 0 };
@ -280,7 +282,7 @@ int main(int argc, char** argv)
// Rendering
glViewport(0, 0, (int)io.DisplaySize.x, (int)io.DisplaySize.y);
glClearColor(0.8f, 0.6f, 0.6f, 1.0f);
glClearColor(clear_col.x, clear_col.y, clear_col.z, clear_col.w);
glClear(GL_COLOR_BUFFER_BIT);
ImGui::Render();
glfwSwapBuffers(window);