mirror of
				https://github.com/ocornut/imgui.git
				synced 2025-11-04 01:34:32 +00:00 
			
		
		
		
	Examples: SDL3: Update for API changes: SDL_Init() returns 0 on failure.
This commit is contained in:
		@@ -2,7 +2,7 @@
 | 
				
			|||||||
// This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..)
 | 
					// This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..)
 | 
				
			||||||
// (Info: SDL3 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.)
 | 
					// (Info: SDL3 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// (**IMPORTANT: SDL 3.0.0 is NOT YET RELEASED AND CURRENTLY HAS A FAST CHANGING API. THIS CODE BREAKS OFTEN**)
 | 
					// (**IMPORTANT: SDL 3.0.0 is NOT YET RELEASED AND CURRENTLY HAS A FAST CHANGING API. THIS CODE BREAKS OFTEN AS SDL3 CHANGES.**)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Implemented features:
 | 
					// Implemented features:
 | 
				
			||||||
//  [X] Platform: Clipboard support.
 | 
					//  [X] Platform: Clipboard support.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,7 @@
 | 
				
			|||||||
// This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..)
 | 
					// This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..)
 | 
				
			||||||
// (Info: SDL3 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.)
 | 
					// (Info: SDL3 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// (**IMPORTANT: SDL 3.0.0 is NOT YET RELEASED AND CURRENTLY HAS A FAST CHANGING API. THIS CODE BREAKS OFTEN**)
 | 
					// (**IMPORTANT: SDL 3.0.0 is NOT YET RELEASED AND CURRENTLY HAS A FAST CHANGING API. THIS CODE BREAKS OFTEN AS SDL3 CHANGES.**)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Implemented features:
 | 
					// Implemented features:
 | 
				
			||||||
//  [X] Platform: Clipboard support.
 | 
					//  [X] Platform: Clipboard support.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,8 @@
 | 
				
			|||||||
// dear imgui: Renderer Backend for SDL_Renderer for SDL3
 | 
					// dear imgui: Renderer Backend for SDL_Renderer for SDL3
 | 
				
			||||||
// (Requires: SDL 3.0.0+)
 | 
					// (Requires: SDL 3.0.0+)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// (**IMPORTANT: SDL 3.0.0 is NOT YET RELEASED AND CURRENTLY HAS A FAST CHANGING API. THIS CODE BREAKS OFTEN AS SDL3 CHANGES.**)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Note how SDL_Renderer is an _optional_ component of SDL3.
 | 
					// Note how SDL_Renderer is an _optional_ component of SDL3.
 | 
				
			||||||
// For a multi-platform app consider using e.g. SDL+DirectX on Windows and SDL+OpenGL on Linux/OSX.
 | 
					// For a multi-platform app consider using e.g. SDL+DirectX on Windows and SDL+OpenGL on Linux/OSX.
 | 
				
			||||||
// If your application will want to render any non trivial amount of graphics other than UI,
 | 
					// If your application will want to render any non trivial amount of graphics other than UI,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,8 @@
 | 
				
			|||||||
// dear imgui: Renderer Backend for SDL_Renderer for SDL3
 | 
					// dear imgui: Renderer Backend for SDL_Renderer for SDL3
 | 
				
			||||||
// (Requires: SDL 3.0.0+)
 | 
					// (Requires: SDL 3.0.0+)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// (**IMPORTANT: SDL 3.0.0 is NOT YET RELEASED AND CURRENTLY HAS A FAST CHANGING API. THIS CODE BREAKS OFTEN AS SDL3 CHANGES.**)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Note how SDL_Renderer is an _optional_ component of SDL3.
 | 
					// Note how SDL_Renderer is an _optional_ component of SDL3.
 | 
				
			||||||
// For a multi-platform app consider using e.g. SDL+DirectX on Windows and SDL+OpenGL on Linux/OSX.
 | 
					// For a multi-platform app consider using e.g. SDL+DirectX on Windows and SDL+OpenGL on Linux/OSX.
 | 
				
			||||||
// If your application will want to render any non trivial amount of graphics other than UI,
 | 
					// If your application will want to render any non trivial amount of graphics other than UI,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -92,6 +92,7 @@ Other changes:
 | 
				
			|||||||
  a drag and drop source or target: a SetNextWindowPos() call won't be overriden. (#6973)
 | 
					  a drag and drop source or target: a SetNextWindowPos() call won't be overriden. (#6973)
 | 
				
			||||||
- Style: added PushStyleVarX(), PushStyleVarY() helpers to modify only one component of a ImVec2 var.
 | 
					- Style: added PushStyleVarX(), PushStyleVarY() helpers to modify only one component of a ImVec2 var.
 | 
				
			||||||
- Fonts: made it possible to use PushFont()/PopFont() calls accross Begin() calls. (#3224, #3875, #6398, #7903)
 | 
					- Fonts: made it possible to use PushFont()/PopFont() calls accross Begin() calls. (#3224, #3875, #6398, #7903)
 | 
				
			||||||
 | 
					- Backends:
 | 
				
			||||||
  - Backends: GLFW: added ImGui_ImplGlfw_Sleep() helper function because GLFW does not
 | 
					  - Backends: GLFW: added ImGui_ImplGlfw_Sleep() helper function because GLFW does not
 | 
				
			||||||
    provide a way to do a portable sleep. (#7844)
 | 
					    provide a way to do a portable sleep. (#7844)
 | 
				
			||||||
  - Backends: SDL2, SDL3: ignore events of other SDL windows. (#7853) [@madebr, @ocornut]
 | 
					  - Backends: SDL2, SDL3: ignore events of other SDL windows. (#7853) [@madebr, @ocornut]
 | 
				
			||||||
@@ -102,8 +103,10 @@ Other changes:
 | 
				
			|||||||
    since GLFW own tests are doing that and it seems unnecessary.
 | 
					    since GLFW own tests are doing that and it seems unnecessary.
 | 
				
			||||||
  - Backends: SDL2, SDL3, GLFW, OSX, Allegro: update to set function handlers in ImGuiPlatformIO
 | 
					  - Backends: SDL2, SDL3, GLFW, OSX, Allegro: update to set function handlers in ImGuiPlatformIO
 | 
				
			||||||
    instead of ImGuiIO.
 | 
					    instead of ImGuiIO.
 | 
				
			||||||
 | 
					- Examples:
 | 
				
			||||||
  - Examples: GLFW (all), SDL2 (all), SDL3 (all), Win32+OpenGL3: rework examples main loop
 | 
					  - Examples: GLFW (all), SDL2 (all), SDL3 (all), Win32+OpenGL3: rework examples main loop
 | 
				
			||||||
    to handle minimization without burning CPU or GPU by running unthrottled code. (#7844)
 | 
					    to handle minimization without burning CPU or GPU by running unthrottled code. (#7844)
 | 
				
			||||||
 | 
					  - Examples: SDL3: Update for API changes: SDL_Init() returns 0 on failure.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Backends: SDL3: following SDL3 reverting their change, result of SDL_GetGamepads must be freed. (#7918, #7898)
 | 
					Backends: SDL3: following SDL3 reverting their change, result of SDL_GetGamepads must be freed. (#7918, #7898)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,7 +27,7 @@
 | 
				
			|||||||
int main(int, char**)
 | 
					int main(int, char**)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    // Setup SDL
 | 
					    // Setup SDL
 | 
				
			||||||
    if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMEPAD) != 0)
 | 
					    if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMEPAD))
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        printf("Error: SDL_Init(): %s\n", SDL_GetError());
 | 
					        printf("Error: SDL_Init(): %s\n", SDL_GetError());
 | 
				
			||||||
        return -1;
 | 
					        return -1;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,7 +25,7 @@
 | 
				
			|||||||
int main(int, char**)
 | 
					int main(int, char**)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    // Setup SDL
 | 
					    // Setup SDL
 | 
				
			||||||
    if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMEPAD) != 0)
 | 
					    if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMEPAD))
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        printf("Error: SDL_Init(): %s\n", SDL_GetError());
 | 
					        printf("Error: SDL_Init(): %s\n", SDL_GetError());
 | 
				
			||||||
        return -1;
 | 
					        return -1;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user