Created
October 30, 2015 10:01
-
-
Save dougbinks/ca4798e5a1a16bd23fd6 to your computer and use it in GitHub Desktop.
ImGui CheckboxFont
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void CheckBoxFont( const char* name_, bool* pB_, const char* pOn_ = "[X]", const char* pOff_="[ ]" ) | |
{ | |
if( *pB_ ) | |
{ | |
ImGui::Text(pOn_); | |
} | |
else | |
{ | |
ImGui::Text(pOff_); | |
} | |
bool bHover = false; | |
bHover = bHover || ImGui::IsItemHovered(); | |
ImGui::SameLine(); | |
ImGui::Text( name_ ); | |
bHover = bHover || ImGui::IsItemHovered(); | |
if( bHover && ImGui::IsMouseClicked(0) ) | |
{ | |
*pB_ = ! *pB_; | |
} | |
} | |
void CheckBoxTick( const char* name_, bool* pB_ ) | |
{ | |
CheckBoxFont( name_, pB_, ICON_FA_CHECK_SQUARE_O, ICON_FA_SQUARE_O ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment