mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
This commit is contained in:
parent
888834c636
commit
c6ec69c7c1
@ -339,9 +339,9 @@ static void ImGui_ImplSDL3_SetupPlatformHandles(ImGuiViewport* viewport, SDL_Win
|
|||||||
IM_UNUSED(window);
|
IM_UNUSED(window);
|
||||||
viewport->PlatformHandleRaw = nullptr;
|
viewport->PlatformHandleRaw = nullptr;
|
||||||
#if defined(__WIN32__) && !defined(__WINRT__)
|
#if defined(__WIN32__) && !defined(__WINRT__)
|
||||||
viewport->PlatformHandleRaw = (HWND)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.win32.hwnd", NULL);
|
viewport->PlatformHandleRaw = (HWND)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.win32.hwnd", nullptr);
|
||||||
#elif defined(__APPLE__) && defined(SDL_VIDEO_DRIVER_COCOA)
|
#elif defined(__APPLE__) && defined(SDL_VIDEO_DRIVER_COCOA)
|
||||||
viewport->PlatformHandleRaw = (void*)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.cocoa.window", NULL);
|
viewport->PlatformHandleRaw = (void*)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.cocoa.window", nullptr);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ int main(int, char**)
|
|||||||
printf("Error: SDL_CreateWindow(): %s\n", SDL_GetError());
|
printf("Error: SDL_CreateWindow(): %s\n", SDL_GetError());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
SDL_Renderer* renderer = SDL_CreateRenderer(window, NULL, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED);
|
SDL_Renderer* renderer = SDL_CreateRenderer(window, nullptr, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED);
|
||||||
if (renderer == nullptr)
|
if (renderer == nullptr)
|
||||||
{
|
{
|
||||||
SDL_Log("Error: SDL_CreateRenderer(): %s\n", SDL_GetError());
|
SDL_Log("Error: SDL_CreateRenderer(): %s\n", SDL_GetError());
|
||||||
|
@ -38,9 +38,9 @@ int main(int, char**)
|
|||||||
{
|
{
|
||||||
// Create application window
|
// Create application window
|
||||||
//ImGui_ImplWin32_EnableDpiAwareness();
|
//ImGui_ImplWin32_EnableDpiAwareness();
|
||||||
WNDCLASSEXW wc = { sizeof(wc), CS_OWNDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, L"ImGui Example", NULL };
|
WNDCLASSEXW wc = { sizeof(wc), CS_OWNDC, WndProc, 0L, 0L, GetModuleHandle(nullptr), nullptr, nullptr, nullptr, nullptr, L"ImGui Example", nullptr };
|
||||||
::RegisterClassExW(&wc);
|
::RegisterClassExW(&wc);
|
||||||
HWND hwnd = ::CreateWindowW(wc.lpszClassName, L"Dear ImGui Win32+OpenGL3 Example", WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
|
HWND hwnd = ::CreateWindowW(wc.lpszClassName, L"Dear ImGui Win32+OpenGL3 Example", WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, nullptr, nullptr, wc.hInstance, nullptr);
|
||||||
|
|
||||||
// Initialize OpenGL
|
// Initialize OpenGL
|
||||||
if (!CreateDeviceWGL(hwnd, &g_MainWindow))
|
if (!CreateDeviceWGL(hwnd, &g_MainWindow))
|
||||||
@ -74,7 +74,7 @@ int main(int, char**)
|
|||||||
// Load Fonts
|
// Load Fonts
|
||||||
// - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
|
// - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
|
||||||
// - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
|
// - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
|
||||||
// - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
|
// - If the file cannot be loaded, the function will return a nullptr. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
|
||||||
// - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
|
// - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
|
||||||
// - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use Freetype for higher quality font rendering.
|
// - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use Freetype for higher quality font rendering.
|
||||||
// - Read 'docs/FONTS.md' for more instructions and details.
|
// - Read 'docs/FONTS.md' for more instructions and details.
|
||||||
@ -84,8 +84,8 @@ int main(int, char**)
|
|||||||
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
|
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
|
||||||
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
|
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
|
||||||
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
|
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
|
||||||
//ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
|
//ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, nullptr, io.Fonts->GetGlyphRangesJapanese());
|
||||||
//IM_ASSERT(font != NULL);
|
//IM_ASSERT(font != nullptr);
|
||||||
|
|
||||||
// Our state
|
// Our state
|
||||||
bool show_demo_window = true;
|
bool show_demo_window = true;
|
||||||
@ -99,7 +99,7 @@ int main(int, char**)
|
|||||||
// Poll and handle messages (inputs, window resize, etc.)
|
// Poll and handle messages (inputs, window resize, etc.)
|
||||||
// See the WndProc() function below for our to dispatch events to the Win32 backend.
|
// See the WndProc() function below for our to dispatch events to the Win32 backend.
|
||||||
MSG msg;
|
MSG msg;
|
||||||
while (::PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
|
while (::PeekMessage(&msg, nullptr, 0U, 0U, PM_REMOVE))
|
||||||
{
|
{
|
||||||
::TranslateMessage(&msg);
|
::TranslateMessage(&msg);
|
||||||
::DispatchMessage(&msg);
|
::DispatchMessage(&msg);
|
||||||
@ -200,7 +200,7 @@ bool CreateDeviceWGL(HWND hWnd, WGL_WindowData* data)
|
|||||||
|
|
||||||
void CleanupDeviceWGL(HWND hWnd, WGL_WindowData* data)
|
void CleanupDeviceWGL(HWND hWnd, WGL_WindowData* data)
|
||||||
{
|
{
|
||||||
wglMakeCurrent(NULL, NULL);
|
wglMakeCurrent(nullptr, nullptr);
|
||||||
::ReleaseDC(hWnd, data->hDC);
|
::ReleaseDC(hWnd, data->hDC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user