bool UKUISimpleClickWidget::OnMouseButtonDown( const FKUIInterfaceContainerMouseButtonEvent& stEventInfo ) { if ( stEventInfo.bHandled ) return true; if ( !CanReceieveMouseEvents() ) return Super::OnMouseButtonDown( stEventInfo ); if ( stEventInfo.eButton != EMouseButtons::Left ) return Super::OnMouseButtonDown( stEventInfo ); bDown = false; if ( !bMouseOver ) return Super::OnMouseButtonDown( stEventInfo ); if ( !IsVisibleRecursive() ) return Super::OnMouseButtonDown( stEventInfo ); if ( IsDisabledRecursive() ) return Super::OnMouseButtonDown( stEventInfo ); bDown = true; v2ClickOffset = stEventInfo.v2Location - GetScreenLocation(); KUISendSubEvent( FKUIInterfaceEvent, EKUIInterfaceWidgetEventList::E_StateChange ); return true; }
bool UKUIInterfaceElement::IsMouseOver() const { if ( GetInterface() == NULL ) { KUIErrorUO( "Null interface" ); return false; } if ( GetContainer() != NULL ) { if ( !GetContainer()->IsMouseOver() ) return false; } const FVector2D v2CursorLocation = GetInterface()->GetCursorLocation(); const FVector2D v2Size = GetSize(); const FVector2D v2TopLeftLocation = GetScreenLocation(); if ( v2CursorLocation.X >= v2TopLeftLocation.X && v2CursorLocation.Y >= v2TopLeftLocation.Y && v2CursorLocation.X < ( v2TopLeftLocation.X + v2Size.X ) && v2CursorLocation.Y < ( v2TopLeftLocation.Y + v2Size.Y ) ) return true; return false; }
void WorldPinsScaleController::UpdateWorldPin(WorldPinItemModel& worldPinItemModel, float deltaSeconds, const Eegeo::Camera::RenderCamera& renderCamera) { const bool showingInterior = m_interiorsController.ShowingInterior(); bool shouldHideInteirorPin = worldPinItemModel.IsInterior(); if( showingInterior == false) { shouldHideInteirorPin = shouldHideInteirorPin && !worldPinItemModel.GetInteriorData().showInExterior; } else { shouldHideInteirorPin = shouldHideInteirorPin && (worldPinItemModel.GetInteriorData().floor != m_interiorsController.GetCurrentFloorIndex()); } Eegeo::v2 screenLocation; GetScreenLocation(worldPinItemModel, screenLocation, renderCamera); const float ratioX = screenLocation.GetX() / renderCamera.GetViewportWidth(); const float ratioY = screenLocation.GetY() / renderCamera.GetViewportHeight(); const bool shouldHide = (ratioX < 0.1f) || (ratioX > 0.9f) || (ratioY < 0.15f) || (ratioY > 0.9f) || shouldHideInteirorPin; if(shouldHide) { worldPinItemModel.Hide(); } else { worldPinItemModel.Show(); } worldPinItemModel.Update(deltaSeconds); }
int *CalcScreenLocation() { ACB *j; int pos; j = GetACBPtr(); pos = j->CursorRow * j->VideoCols + j->CursorCol; // if (j == IOFocusNdx) { SetVideoReg(11,pos); // } return GetScreenLocation()+pos; }
bool UKUIInterfaceElement::IsPointOver( const FVector2D& v2Point ) const { const FVector2D v2ScreenLocation = GetScreenLocation(); const FVector2D v2Size = GetSize(); if ( v2Point.X < v2ScreenLocation.X || v2Point.Y < v2ScreenLocation.Y ) return false; if ( v2Point.X >= ( v2ScreenLocation.X + v2Size.X ) || v2Point.Y >= ( v2ScreenLocation.Y + v2Size.Y ) ) return false; return true; }
void VBScrollUp() { int *scrn = GetScreenLocation(); int nn; int count; ACB *j; j = GetACBPtr(); count = (int)j->VideoCols*(int)(j->VideoRows-1); for (nn = 0; nn < count; nn++) scrn[nn] = scrn[nn+(int)j->VideoCols]; BlankLine(GetTextRows()-1); }
void BlankLine(int row) { int *p; int nn; int mx; ACB *j; int vc; j = GetACBPtr(); p = GetScreenLocation(); p = p + (int)j->VideoCols * row; vc = GetCurrAttr() | AsciiToScreen(' '); memsetH(p, vc, j->VideoCols); }
void UKUISliderWidget::OnDrag( float fLocation ) { const float fTravelDistance = GetTravelDistance(); if ( fTravelDistance == 0.f ) return; float fValue = 0.f; if ( bHorizontal ) fValue = fLocation - GetScreenLocation().X - fEndSize - fMouseDownOffset - ( oHandle.IsValid() ? oHandle->GetSize().X / 2.f : 0.f ); else fValue = fLocation - GetScreenLocation().Y - fEndSize - fMouseDownOffset - ( oHandle.IsValid() ? oHandle->GetSize().Y / 2.f : 0.f ); fValue = clamp( fValue, 0.f, fTravelDistance ) / fTravelDistance; if ( iStepCount == 0 ) SetValue( fValue ); else SetValue( fValue * ( float ) iStepCount ); }
void ClearScreen() { __int32 *p; int nn; int mx; ACB *j; int vc; j = GetACBPtr(); p = GetScreenLocation(); // Compiler did a byte multiply generating a single byte result first // before assigning it to mx. The (int) casts force the compiler to use // an int result. mx = (int)j->VideoRows * (int)j->VideoCols; vc = GetCurrAttr() | AsciiToScreen(' '); memsetH(p, vc, mx); }
void UKUIInterfaceElement::Render( AKUIInterface* aHud, UCanvas* oCanvas, const FVector2D& v2Origin, UKUIInterfaceElement* oRenderCacheObject ) { aLastRenderedBy = aHud; if ( !HasValidAlignLocation() ) { TArray<UKUIInterfaceElement*> arAlignStack; CalculateAlignLocation( arAlignStack ); } if ( IsRenderCaching() ) { if ( oRenderCacheObject != this ) { if ( !oRenderCache->IsRenderCacheValid() ) oRenderCache->UpdateRenderCache( this ); //v2LastScreenRenderLocation = v2Origin + GetRenderLocation()/* + oRenderCacheObject->GetLastScreenRenderLocation()*/; oCanvas->Reset(); oRenderCache->Render( aHud, oCanvas, GetScreenLocation() ); KUISendEvent( FKUIInterfaceElementRenderEvent, EKUIInterfaceElementEventList::E_Render, oCanvas, v2Origin ); } } else { if ( oRenderCacheObject == NULL ) v2LastScreenRenderLocation = v2Origin + GetRenderLocation(); oCanvas->Reset(); KUISendEvent( FKUIInterfaceElementRenderEvent, EKUIInterfaceElementEventList::E_Render, oCanvas, v2Origin ); } #if KUI_INTERFACE_MOUSEOVER_DEBUG AKUIInterface* aInterface = GetInterface(); if ( aInterface && aInterface->bDebugMouseOver && IsMouseOver() ) { aInterface->cmDebugMouseOver = this; aInterface->v2DebugMouseOverLocation = GetLastScreenRenderLocation(); aInterface->v2DebugMouseOverSize = GetSize(); } #endif // KUI_INTERFACE_MOUSEOVER_DEBUG }