MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/FleX / imguiButton

Function imguiButton

demo/imgui.cpp:448–469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

446}
447
448bool imguiButton(const char* text, bool enabled)
449{
450 g_state.widgetId++;
451 unsigned int id = (g_state.areaId<<16) | g_state.widgetId;
452
453 int x = g_state.widgetX;
454 int y = g_state.widgetY - BUTTON_HEIGHT;
455 int w = g_state.widgetW;
456 int h = BUTTON_HEIGHT;
457 g_state.widgetY -= BUTTON_HEIGHT + DEFAULT_SPACING;
458
459 bool over = enabled && inRect(x, y, w, h);
460 bool res = buttonLogic(id, over);
461
462 addGfxCmdRoundedRect((float)x, (float)y, (float)w, (float)h, (float)BUTTON_HEIGHT/2-1, imguiRGBA(128,128,128, isActive(id)?196:96));
463 if (enabled)
464 addGfxCmdText(x+BUTTON_HEIGHT/2, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, isHot(id) ? imguiRGBA(255,196,0,255) : imguiRGBA(255,255,255,200));
465 else
466 addGfxCmdText(x+BUTTON_HEIGHT/2, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, imguiRGBA(128,128,128,200));
467
468 return res;
469}
470
471bool imguiItem(const char* text, bool enabled, unsigned int color, bool forceHot)
472{

Callers 1

DoUIFunction · 0.85

Calls 7

inRectFunction · 0.85
buttonLogicFunction · 0.85
addGfxCmdRoundedRectFunction · 0.85
imguiRGBAFunction · 0.85
isActiveFunction · 0.85
addGfxCmdTextFunction · 0.85
isHotFunction · 0.85

Tested by

no test coverage detected