void Cursor::DefineShape(CursorShape shape, Image* image, const IntRect& imageRect, const IntVector2& hotSpot) { if (shape < CS_NORMAL || shape >= CS_MAX_SHAPES) { ATOMIC_LOGERROR("Shape index out of bounds, can not define cursor shape"); return; } DefineShape(shapeNames[shape], image, imageRect, hotSpot); }
void Cursor::SetShapesAttr(const VariantVector& value) { if (!value.Size()) return; for (VariantVector::ConstIterator i = value.Begin(); i != value.End(); ++i) { VariantVector shapeVector = i->GetVariantVector(); if (shapeVector.Size() >= 4) { String shape = shapeVector[0].GetString(); ResourceRef ref = shapeVector[1].GetResourceRef(); IntRect imageRect = shapeVector[2].GetIntRect(); IntVector2 hotSpot = shapeVector[3].GetIntVector2(); DefineShape(shape, GetSubsystem<ResourceCache>()->GetResource<Image>(ref.name_), imageRect, hotSpot); } } }
void Cursor::SetShapesAttr(VariantVector value) { unsigned index = 0; if (!value.Size()) return; unsigned numShapes = value[index++].GetUInt(); while (numShapes-- && (index + 4) <= value.Size()) { CursorShape shape = (CursorShape)GetStringListIndex(value[index++].GetString().CString(), shapeNames, CS_MAX_SHAPES); if (shape != CS_MAX_SHAPES) { ResourceRef ref = value[index++].GetResourceRef(); IntRect imageRect = value[index++].GetIntRect(); IntVector2 hotSpot = value[index++].GetIntVector2(); DefineShape(shape, GetSubsystem<ResourceCache>()->GetResource<Image>(ref.name_), imageRect, hotSpot); } else index += 3; } }