mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-29 12:11:06 +01:00 
			
		
		
		
	ImGuiStorage: Added bool helper functions for completeness.
This commit is contained in:
		
							
								
								
									
										15
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								imgui.cpp
									
									
									
									
									
								
							| @@ -1313,6 +1313,11 @@ int ImGuiStorage::GetInt(ImU32 key, int default_val) const | ||||
|     return it->val_i; | ||||
| } | ||||
|  | ||||
| bool ImGuiStorage::GetBool(ImU32 key, bool default_val) const | ||||
| { | ||||
|     return GetInt(key, default_val ? 1 : 0) != 0; | ||||
| } | ||||
|  | ||||
| float ImGuiStorage::GetFloat(ImU32 key, float default_val) const | ||||
| { | ||||
|     ImVector<Pair>::iterator it = LowerBound(const_cast<ImVector<ImGuiStorage::Pair>&>(Data), key); | ||||
| @@ -1338,6 +1343,11 @@ int* ImGuiStorage::GetIntRef(ImGuiID key, int default_val) | ||||
|     return &it->val_i; | ||||
| } | ||||
|  | ||||
| bool* ImGuiStorage::GetBoolRef(ImGuiID key, bool default_val) | ||||
| { | ||||
|     return (bool*)GetIntRef(key, default_val ? 1 : 0); | ||||
| } | ||||
|  | ||||
| float* ImGuiStorage::GetFloatRef(ImGuiID key, float default_val) | ||||
| { | ||||
|     ImVector<Pair>::iterator it = LowerBound(Data, key); | ||||
| @@ -1366,6 +1376,11 @@ void ImGuiStorage::SetInt(ImU32 key, int val) | ||||
|     it->val_i = val; | ||||
| } | ||||
|  | ||||
| void ImGuiStorage::SetBool(ImU32 key, bool val) | ||||
| { | ||||
|     SetInt(key, val ? 1 : 0); | ||||
| } | ||||
|  | ||||
| void ImGuiStorage::SetFloat(ImU32 key, float val) | ||||
| { | ||||
|     ImVector<Pair>::iterator it = LowerBound(Data, key); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user