Skip to content

Instantly share code, notes, and snippets.

@dougbinks
Created October 30, 2015 10:01
Show Gist options
  • Save dougbinks/ca4798e5a1a16bd23fd6 to your computer and use it in GitHub Desktop.
Save dougbinks/ca4798e5a1a16bd23fd6 to your computer and use it in GitHub Desktop.
ImGui CheckboxFont
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