int CUI::DoColorSelectionLogic(const CUIRect *pRect, const CUIRect *pButton) // it's counter logic! FIXME { if(MouseButtonClicked(0) && MouseInside(pRect) && !MouseInside(pButton)) return 1; else return 0; }
int CUI::DoPickerLogic(const void *pID, const CUIRect *pRect, float *pX, float *pY) { int Inside = MouseInside(pRect); if(CheckActiveItem(pID)) { if(!MouseButton(0)) SetActiveItem(0); } else if(HotItem() == pID) { if(MouseButton(0)) SetActiveItem(pID); } else if(Inside) SetHotItem(pID); if(!CheckActiveItem(pID)) return 0; if(pX) *pX = clamp(m_MouseX - pRect->x, 0.0f, pRect->w) / Scale(); if(pY) *pY = clamp(m_MouseY - pRect->y, 0.0f, pRect->h) / Scale(); return 1; }
int CUI::DoPickerLogic(const void *pID, const CUIRect *pRect, float *pX, float *pY) { int Inside = MouseInside(pRect); if(ActiveItem() == pID) { if(!MouseButton(0)) SetActiveItem(0); } else if(HotItem() == pID) { if(MouseButton(0)) SetActiveItem(pID); } else if(Inside) SetHotItem(pID); if(ActiveItem() != pID || !Inside) return 0; if(pX) *pX = (m_MouseX - pRect->x) / Scale(); if(pY) *pY = (m_MouseY - pRect->y) / Scale(); return 1; }
int CUI::DoButtonLogic(const void *pID, const char *pText, int Checked, const CUIRect *pRect) { // logic int ReturnValue = 0; int Inside = MouseInside(pRect); static int ButtonUsed = 0; if(ActiveItem() == pID) { if(!MouseButton(ButtonUsed)) { if(Inside && Checked >= 0) ReturnValue = 1+ButtonUsed; SetActiveItem(0); } } else if(HotItem() == pID) { for(int i = 0; i < 3; ++i) { if(MouseButton(i)) { SetActiveItem(pID); ButtonUsed = i; } } } if(Inside) SetHotItem(pID); return ReturnValue; }