mirror of
				https://github.com/ocornut/imgui.git
				synced 2025-10-26 12:27:30 +00:00 
			
		
		
		
	Examples: SDL+DX11: Changelog, readme, batch files, fixed vcxproj, minor stylistic fixes + minor sync of other main.cpp files. (#2632)
This commit is contained in:
		| @@ -1,4 +1,4 @@ | ||||
| // dear imgui: standalone example application for SDL2 + OpenGL | ||||
| // dear imgui: standalone example application for SDL2 + DirectX 11 | ||||
| // If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp. | ||||
| // (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.) | ||||
|  | ||||
| @@ -22,6 +22,7 @@ void CleanupDeviceD3D(); | ||||
| void CreateRenderTarget(); | ||||
| void CleanupRenderTarget(); | ||||
|  | ||||
| // Main code | ||||
| int main(int, char**) | ||||
| { | ||||
|     // Setup SDL | ||||
| @@ -31,14 +32,12 @@ int main(int, char**) | ||||
|         return -1; | ||||
|     } | ||||
|  | ||||
|     // Create window with graphics context | ||||
|     // Setup window | ||||
|     SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); | ||||
|     SDL_Window* window = SDL_CreateWindow("Dear ImGui SDL2+DirectX11 example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, window_flags); | ||||
|  | ||||
|     SDL_SysWMinfo wmInfo; | ||||
|     SDL_VERSION(&wmInfo.version); | ||||
|     SDL_GetWindowWMInfo(window, &wmInfo); | ||||
|  | ||||
|     SDL_SysWMinfo wmInfo; | ||||
|     SDL_VERSION(&wmInfo.version); | ||||
|     SDL_GetWindowWMInfo(window, &wmInfo); | ||||
|     HWND hwnd = (HWND)wmInfo.info.win.window; | ||||
|  | ||||
|     // Initialize Direct3D | ||||
| @@ -52,10 +51,8 @@ int main(int, char**) | ||||
|     IMGUI_CHECKVERSION(); | ||||
|     ImGui::CreateContext(); | ||||
|     ImGuiIO& io = ImGui::GetIO(); (void)io; | ||||
|     io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;       // Enable Keyboard Controls | ||||
|     //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;     // Enable Keyboard Controls | ||||
|     //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;      // Enable Gamepad Controls | ||||
|     //io.ConfigViewportsNoAutoMerge = true; | ||||
|     //io.ConfigViewportsNoTaskBarIcon = true; | ||||
|  | ||||
|     // Setup Dear ImGui style | ||||
|     ImGui::StyleColorsDark(); | ||||
| @@ -80,6 +77,7 @@ int main(int, char**) | ||||
|     //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); | ||||
|     //IM_ASSERT(font != NULL); | ||||
|  | ||||
|     // Our state | ||||
|     bool show_demo_window = true; | ||||
|     bool show_another_window = false; | ||||
|     ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); | ||||
| @@ -168,6 +166,7 @@ int main(int, char**) | ||||
| } | ||||
|  | ||||
| // Helper functions | ||||
|  | ||||
| bool CreateDeviceD3D(HWND hWnd) | ||||
| { | ||||
|     // Setup swap chain | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 omar
					omar