1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-23 23:31:08 +01:00

Examples: Win32: Using wc.lpszClassName instead of duplicating the literal. + tweak README format.

This commit is contained in:
omar 2019-01-17 18:04:35 +01:00
parent b8020032f9
commit 295ada0364
5 changed files with 25 additions and 25 deletions

View File

@ -161,61 +161,61 @@ example_win32_directx11/
example_win32_directx12/
DirectX12 example, Windows only.
This is quite long and tedious, because: DirectX12.
= main.cpp + imgui_impl_win32.cpp + imgui_impl_dx12.cpp
This is quite long and tedious, because: DirectX12.
example_apple_metal/
OSX & iOS + Metal.
= main.m + imgui_impl_osx.mm + imgui_impl_metal.mm
It is based on the "cross-platform" game template provided with Xcode as of Xcode 9.
(NB: you may still want to use GLFW or SDL which will also support Windows, Linux along with OSX.)
= game template + imgui_impl_osx.mm + imgui_impl_metal.mm
example_apple_opengl2/
OSX + OpenGL2.
(NB: you may still want to use GLFW or SDL which will also support Windows, Linux along with OSX.)
= main.mm + imgui_impl_osx.mm + imgui_impl_opengl2.cpp
(NB: you may still want to use GLFW or SDL which will also support Windows, Linux along with OSX.)
example_glfw_opengl2/
GLFW + OpenGL2 example (legacy, fixed pipeline).
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_opengl2.cpp
**DO NOT USE OPENGL2 CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
**Prefer using OPENGL3 code (with gl3w/glew/glad, you can replace the OpenGL function loader)**
GLFW + OpenGL2 example (legacy, fixed pipeline).
This code is mostly provided as a reference to learn about Dear ImGui integration, because it is shorter.
If your code is using GL3+ context or any semi modern OpenGL calls, using this renderer is likely to
make things more complicated, will require your code to reset many OpenGL attributes to their initial
state, and might confuse your GPU driver. One star, not recommended.
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_opengl2.cpp
example_glfw_opengl3/
GLFW (Win32, Mac, Linux) + OpenGL3+/ES2/ES3 example (programmable pipeline, binding modern functions with GL3W).
GLFW (Win32, Mac, Linux) + OpenGL3+/ES2/ES3 example (programmable pipeline).
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
This uses more modern OpenGL calls and custom shaders.
Prefer using that if you are using modern OpenGL in your application (anything with shaders).
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
example_glfw_vulkan/
GLFW (Win32, Mac, Linux) + Vulkan example.
This is quite long and tedious, because: Vulkan.
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_vulkan.cpp
This is quite long and tedious, because: Vulkan.
example_sdl_opengl2/
SDL2 (Win32, Mac, Linux etc.) + OpenGL example (legacy, fixed pipeline).
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl2.cpp
**DO NOT USE OPENGL2 CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
**Prefer using OPENGL3 code (with gl3w/glew/glad, you can replace the OpenGL function loader)**
SDL2 (Win32, Mac, Linux etc.) + OpenGL example (legacy, fixed pipeline).
This code is mostly provided as a reference to learn about Dear ImGui integration, because it is shorter.
If your code is using GL3+ context or any semi modern OpenGL calls, using this renderer is likely to
make things more complicated, will require your code to reset many OpenGL attributes to their initial
state, and might confuse your GPU driver. One star, not recommended.
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl2.cpp
example_sdl_opengl3/
SDL2 (Win32, Mac, Linux, etc.) + OpenGL3+/ES2/ES3 example.
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl3.cpp
This uses more modern OpenGL calls and custom shaders.
Prefer using that if you are using modern OpenGL in your application (anything with shaders).
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl3.cpp
example_sdl_vulkan/
SDL2 (Win32, Mac, Linux, etc.) + Vulkan example.
This is quite long and tedious, because: Vulkan.
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_vulkan.cpp
This is quite long and tedious, because: Vulkan.
example_allegro5/
Allegro 5 example.

View File

@ -96,13 +96,13 @@ int main(int, char**)
// Create application window
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
RegisterClassEx(&wc);
HWND hwnd = CreateWindow(_T("ImGui Example"), _T("Dear ImGui DirectX10 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
HWND hwnd = CreateWindow(wc.lpszClassName, _T("Dear ImGui DirectX10 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
// Initialize Direct3D
if (CreateDeviceD3D(hwnd) < 0)
{
CleanupDeviceD3D();
UnregisterClass(_T("ImGui Example"), wc.hInstance);
UnregisterClass(wc.lpszClassName, wc.hInstance);
return 1;
}
@ -218,7 +218,7 @@ int main(int, char**)
CleanupDeviceD3D();
DestroyWindow(hwnd);
UnregisterClass(_T("ImGui Example"), wc.hInstance);
UnregisterClass(wc.lpszClassName, wc.hInstance);
return 0;
}

View File

@ -99,13 +99,13 @@ int main(int, char**)
// Create application window
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
RegisterClassEx(&wc);
HWND hwnd = CreateWindow(_T("ImGui Example"), _T("Dear ImGui DirectX11 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
HWND hwnd = CreateWindow(wc.lpszClassName, _T("Dear ImGui DirectX11 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
// Initialize Direct3D
if (CreateDeviceD3D(hwnd) < 0)
{
CleanupDeviceD3D();
UnregisterClass(_T("ImGui Example"), wc.hInstance);
UnregisterClass(wc.lpszClassName, wc.hInstance);
return 1;
}
@ -222,7 +222,7 @@ int main(int, char**)
CleanupDeviceD3D();
DestroyWindow(hwnd);
UnregisterClass(_T("ImGui Example"), wc.hInstance);
UnregisterClass(wc.lpszClassName, wc.hInstance);
return 0;
}

View File

@ -272,13 +272,13 @@ int main(int, char**)
// Create application window
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
RegisterClassEx(&wc);
HWND hwnd = CreateWindow(_T("ImGui Example"), _T("Dear ImGui DirectX12 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
HWND hwnd = CreateWindow(wc.lpszClassName, _T("Dear ImGui DirectX12 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
// Initialize Direct3D
if (CreateDeviceD3D(hwnd) < 0)
{
CleanupDeviceD3D();
UnregisterClass(_T("ImGui Example"), wc.hInstance);
UnregisterClass(wc.lpszClassName, wc.hInstance);
return 1;
}
@ -424,7 +424,7 @@ int main(int, char**)
CleanupDeviceD3D();
DestroyWindow(hwnd);
UnregisterClass(_T("ImGui Example"), wc.hInstance);
UnregisterClass(wc.lpszClassName, wc.hInstance);
return 0;
}

View File

@ -49,13 +49,13 @@ int main(int, char**)
// Create application window
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
RegisterClassEx(&wc);
HWND hwnd = CreateWindow(_T("ImGui Example"), _T("Dear ImGui DirectX9 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
HWND hwnd = CreateWindow(wc.lpszClassName, _T("Dear ImGui DirectX9 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
// Initialize Direct3D
LPDIRECT3D9 pD3D;
if ((pD3D = Direct3DCreate9(D3D_SDK_VERSION)) == NULL)
{
UnregisterClass(_T("ImGui Example"), wc.hInstance);
UnregisterClass(wc.lpszClassName, wc.hInstance);
return 0;
}
ZeroMemory(&g_d3dpp, sizeof(g_d3dpp));
@ -71,7 +71,7 @@ int main(int, char**)
if (pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &g_d3dpp, &g_pd3dDevice) < 0)
{
pD3D->Release();
UnregisterClass(_T("ImGui Example"), wc.hInstance);
UnregisterClass(wc.lpszClassName, wc.hInstance);
return 0;
}
@ -200,7 +200,7 @@ int main(int, char**)
if (g_pd3dDevice) g_pd3dDevice->Release();
if (pD3D) pD3D->Release();
DestroyWindow(hwnd);
UnregisterClass(_T("ImGui Example"), wc.hInstance);
UnregisterClass(wc.lpszClassName, wc.hInstance);
return 0;
}