mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 20:07:01 +00:00
Examples: Win32: Using wc.lpszClassName instead of duplicating the literal. + tweak README format.
This commit is contained in:
parent
b8020032f9
commit
295ada0364
@ -161,61 +161,61 @@ example_win32_directx11/
|
|||||||
|
|
||||||
example_win32_directx12/
|
example_win32_directx12/
|
||||||
DirectX12 example, Windows only.
|
DirectX12 example, Windows only.
|
||||||
This is quite long and tedious, because: DirectX12.
|
|
||||||
= main.cpp + imgui_impl_win32.cpp + imgui_impl_dx12.cpp
|
= main.cpp + imgui_impl_win32.cpp + imgui_impl_dx12.cpp
|
||||||
|
This is quite long and tedious, because: DirectX12.
|
||||||
|
|
||||||
example_apple_metal/
|
example_apple_metal/
|
||||||
OSX & iOS + 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.
|
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.)
|
(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/
|
example_apple_opengl2/
|
||||||
OSX + 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
|
= 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/
|
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.)**
|
**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)**
|
**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.
|
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
|
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
|
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.
|
state, and might confuse your GPU driver. One star, not recommended.
|
||||||
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_opengl2.cpp
|
|
||||||
|
|
||||||
example_glfw_opengl3/
|
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.
|
This uses more modern OpenGL calls and custom shaders.
|
||||||
Prefer using that if you are using modern OpenGL in your application (anything with 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/
|
example_glfw_vulkan/
|
||||||
GLFW (Win32, Mac, Linux) + Vulkan example.
|
GLFW (Win32, Mac, Linux) + Vulkan example.
|
||||||
This is quite long and tedious, because: Vulkan.
|
|
||||||
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_vulkan.cpp
|
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_vulkan.cpp
|
||||||
|
This is quite long and tedious, because: Vulkan.
|
||||||
|
|
||||||
example_sdl_opengl2/
|
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.)**
|
**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)**
|
**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.
|
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
|
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
|
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.
|
state, and might confuse your GPU driver. One star, not recommended.
|
||||||
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl2.cpp
|
|
||||||
|
|
||||||
example_sdl_opengl3/
|
example_sdl_opengl3/
|
||||||
SDL2 (Win32, Mac, Linux, etc.) + OpenGL3+/ES2/ES3 example.
|
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.
|
This uses more modern OpenGL calls and custom shaders.
|
||||||
Prefer using that if you are using modern OpenGL in your application (anything with 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/
|
example_sdl_vulkan/
|
||||||
SDL2 (Win32, Mac, Linux, etc.) + Vulkan example.
|
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
|
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_vulkan.cpp
|
||||||
|
This is quite long and tedious, because: Vulkan.
|
||||||
|
|
||||||
example_allegro5/
|
example_allegro5/
|
||||||
Allegro 5 example.
|
Allegro 5 example.
|
||||||
|
@ -96,13 +96,13 @@ int main(int, char**)
|
|||||||
// Create application window
|
// Create application window
|
||||||
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
|
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
|
||||||
RegisterClassEx(&wc);
|
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
|
// Initialize Direct3D
|
||||||
if (CreateDeviceD3D(hwnd) < 0)
|
if (CreateDeviceD3D(hwnd) < 0)
|
||||||
{
|
{
|
||||||
CleanupDeviceD3D();
|
CleanupDeviceD3D();
|
||||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
UnregisterClass(wc.lpszClassName, wc.hInstance);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ int main(int, char**)
|
|||||||
|
|
||||||
CleanupDeviceD3D();
|
CleanupDeviceD3D();
|
||||||
DestroyWindow(hwnd);
|
DestroyWindow(hwnd);
|
||||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
UnregisterClass(wc.lpszClassName, wc.hInstance);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -99,13 +99,13 @@ int main(int, char**)
|
|||||||
// Create application window
|
// Create application window
|
||||||
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
|
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
|
||||||
RegisterClassEx(&wc);
|
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
|
// Initialize Direct3D
|
||||||
if (CreateDeviceD3D(hwnd) < 0)
|
if (CreateDeviceD3D(hwnd) < 0)
|
||||||
{
|
{
|
||||||
CleanupDeviceD3D();
|
CleanupDeviceD3D();
|
||||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
UnregisterClass(wc.lpszClassName, wc.hInstance);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ int main(int, char**)
|
|||||||
|
|
||||||
CleanupDeviceD3D();
|
CleanupDeviceD3D();
|
||||||
DestroyWindow(hwnd);
|
DestroyWindow(hwnd);
|
||||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
UnregisterClass(wc.lpszClassName, wc.hInstance);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -272,13 +272,13 @@ int main(int, char**)
|
|||||||
// Create application window
|
// Create application window
|
||||||
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
|
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
|
||||||
RegisterClassEx(&wc);
|
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
|
// Initialize Direct3D
|
||||||
if (CreateDeviceD3D(hwnd) < 0)
|
if (CreateDeviceD3D(hwnd) < 0)
|
||||||
{
|
{
|
||||||
CleanupDeviceD3D();
|
CleanupDeviceD3D();
|
||||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
UnregisterClass(wc.lpszClassName, wc.hInstance);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,7 +424,7 @@ int main(int, char**)
|
|||||||
|
|
||||||
CleanupDeviceD3D();
|
CleanupDeviceD3D();
|
||||||
DestroyWindow(hwnd);
|
DestroyWindow(hwnd);
|
||||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
UnregisterClass(wc.lpszClassName, wc.hInstance);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -49,13 +49,13 @@ int main(int, char**)
|
|||||||
// Create application window
|
// Create application window
|
||||||
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
|
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
|
||||||
RegisterClassEx(&wc);
|
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
|
// Initialize Direct3D
|
||||||
LPDIRECT3D9 pD3D;
|
LPDIRECT3D9 pD3D;
|
||||||
if ((pD3D = Direct3DCreate9(D3D_SDK_VERSION)) == NULL)
|
if ((pD3D = Direct3DCreate9(D3D_SDK_VERSION)) == NULL)
|
||||||
{
|
{
|
||||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
UnregisterClass(wc.lpszClassName, wc.hInstance);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ZeroMemory(&g_d3dpp, sizeof(g_d3dpp));
|
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)
|
if (pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &g_d3dpp, &g_pd3dDevice) < 0)
|
||||||
{
|
{
|
||||||
pD3D->Release();
|
pD3D->Release();
|
||||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
UnregisterClass(wc.lpszClassName, wc.hInstance);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ int main(int, char**)
|
|||||||
if (g_pd3dDevice) g_pd3dDevice->Release();
|
if (g_pd3dDevice) g_pd3dDevice->Release();
|
||||||
if (pD3D) pD3D->Release();
|
if (pD3D) pD3D->Release();
|
||||||
DestroyWindow(hwnd);
|
DestroyWindow(hwnd);
|
||||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
UnregisterClass(wc.lpszClassName, wc.hInstance);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user