| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
- //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
- #pragma once
- #include "BsEditorPrerequisites.h"
- namespace bs
- {
- /** @addtogroup Handles-Internal
- * @{
- */
- /** Controls all instantiated HandleSlider%s. */
- class BS_ED_EXPORT HandleSliderManager
- {
- /** Contains active/hover sliders for each camera. */
- struct StatePerCamera
- {
- HandleSlider* activeSlider = nullptr;
- HandleSlider* hoverSlider = nullptr;
- };
- public:
- /**
- * Updates all underlying sliders, changing their state and dragging them depending on their state and pointer
- * movement.
- *
- * @param[in] camera Camera through which we're interacting with sliders.
- * @param[in] inputPos Position of the pointer.
- * @param[in] inputDelta Movement of the pointer since last frame.
- * @return True if slider state changed, false otherwise.
- */
- bool update(const SPtr<Camera>& camera, const Vector2I& inputPos, const Vector2I& inputDelta);
- /**
- * Attempts to select (activate) a slider at the specified position.
- *
- * @param[in] camera Camera through which we're interacting with sliders.
- * @param[in] inputPos Position of the pointer.
- * @return True if handle slider state changed, false otherwise.
- */
- bool trySelect(const SPtr<Camera>& camera, const Vector2I& inputPos);
- /** Clears the active slider (deactivates it) for the specified camera. */
- void clearSelection(const SPtr<Camera>& camera);
- /** Checks is any slider active for the specified camera. */
- bool isSliderActive(const SPtr<Camera>& camera) const;
- /** Registers a new instantiated slider. */
- void _registerSlider(HandleSlider* slider);
- /** Unregisters a previously instantiated slider. */
- void _unregisterSlider(HandleSlider* slider);
- private:
- /**
- * Attempts to find slider at the specified position.
- *
- * @param[in] camera Camera through which we're interacting with sliders.
- * @param[in] inputPos Position of the pointer.
- * @return Slider if we're intersecting with one, or null otherwise.
- */
- HandleSlider* findUnderCursor(const SPtr<Camera>& camera, const Vector2I& inputPos) const;
- UnorderedMap<UINT64, StatePerCamera> mStates;
- UnorderedSet<HandleSlider*> mSliders;
- };
- /** @} */
- }
|