mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 21:21:06 +01:00 
			
		
		
		
	ColorEdit4: Alpha default to 255 (instead of 0) when omitted in hex input. (#3973)
Courtesy of @squadack
This commit is contained in:
		| @@ -47,6 +47,7 @@ Other Changes: | |||||||
| - Drags, Sliders, Inputs: Specifying a NULL format to Float functions default them to "%.3f" to be | - Drags, Sliders, Inputs: Specifying a NULL format to Float functions default them to "%.3f" to be | ||||||
|   consistent with the compile-time default. (#3922) |   consistent with the compile-time default. (#3922) | ||||||
| - DragScalar: Add default value for v_speed argument to match higher-level functions. (#3922) [@eliasdaler] | - DragScalar: Add default value for v_speed argument to match higher-level functions. (#3922) [@eliasdaler] | ||||||
|  | - ColorEdit4: Alpha default to 255 (instead of 0) when omitted in hex input. (#3973) [@squadack] | ||||||
| - Backends: SDL: Rework global mouse pos availability check listing supported platforms explicitly, | - Backends: SDL: Rework global mouse pos availability check listing supported platforms explicitly, | ||||||
|   effectively fixing mouse access on Raspberry Pi. (#2837, #3950) [@lethal-guitar, @hinxx] |   effectively fixing mouse access on Raspberry Pi. (#2837, #3950) [@lethal-guitar, @hinxx] | ||||||
| - Backends: Win32: Clearing keyboard down array when losing focus (WM_KILLFOCUS). (#2062, #3532, #3961) | - Backends: Win32: Clearing keyboard down array when losing focus (WM_KILLFOCUS). (#2062, #3532, #3961) | ||||||
|   | |||||||
| @@ -4804,7 +4804,8 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag | |||||||
|             char* p = buf; |             char* p = buf; | ||||||
|             while (*p == '#' || ImCharIsBlankA(*p)) |             while (*p == '#' || ImCharIsBlankA(*p)) | ||||||
|                 p++; |                 p++; | ||||||
|             i[0] = i[1] = i[2] = i[3] = 0; |             i[0] = i[1] = i[2] = 0; | ||||||
|  |             i[3] = 0xFF; // alpha default to 255 is not parsed by scanf (e.g. inputting #FFFFFF omitting alpha) | ||||||
|             if (alpha) |             if (alpha) | ||||||
|                 sscanf(p, "%02X%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2], (unsigned int*)&i[3]); // Treat at unsigned (%X is unsigned) |                 sscanf(p, "%02X%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2], (unsigned int*)&i[3]); // Treat at unsigned (%X is unsigned) | ||||||
|             else |             else | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user