mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-04 15:11:05 +01:00 
			
		
		
		
	Added support for CheckboxFlags that can set multiple flags at the same time.
This commit is contained in:
		
							
								
								
									
										12
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								imgui.cpp
									
									
									
									
									
								
							@@ -6907,12 +6907,14 @@ bool ImGui::Checkbox(const char* label, bool* v)
 | 
			
		||||
 | 
			
		||||
bool ImGui::CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value)
 | 
			
		||||
{
 | 
			
		||||
    bool v = (*flags & flags_value) ? true : false;
 | 
			
		||||
    bool v = ((*flags & flags_value) == flags_value);
 | 
			
		||||
    bool pressed = ImGui::Checkbox(label, &v);
 | 
			
		||||
    if (v)
 | 
			
		||||
        *flags |= flags_value;
 | 
			
		||||
    else
 | 
			
		||||
        *flags &= ~flags_value;
 | 
			
		||||
    if(pressed) {
 | 
			
		||||
        if (v)
 | 
			
		||||
            *flags |= flags_value;
 | 
			
		||||
        else
 | 
			
		||||
            *flags &= ~flags_value;
 | 
			
		||||
    }
 | 
			
		||||
    return pressed;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user