35 std::vector<ITouchID> touches;
38 str.SetFormatted(32,
"NUM TOUCHES: %i", static_cast<int>(touches.size()));
49 for (
auto& touchPair : mTrackedTouches)
52 int t = pTouch->index;
53 float dim = pTouch->radius > 0.f ? pTouch->radius : 50.f;
54 IRECT r {pTouch->x-dim,pTouch->y-dim,pTouch->x+dim, pTouch->y+dim};
57 Milliseconds duration = std::chrono::high_resolution_clock::now() - pTouch->startTime;
58 str.SetFormatted(32,
"%i: %i", t, static_cast<int>(duration.count()));
73 AddTouch(mod.touchID, x, y, mod.touchRadius);
78 ReleaseTouch(mod.touchID);
80 if(NTrackedTouches() == 0)
95 UpdateTouch(mod.touchID, x, y, mod.touchRadius);
101 if(NTrackedTouches())
void OnMouseDrag(float x, float y, float dx, float dy, const IMouseMod &mod) override
Implement this method to respond to a mouse drag event on this control.
void SetWantsMultiTouch(bool enable=true)
Specify whether this control supports multiple touches.
void StartLayer(IControl *pOwner, const IRECT &r, bool cacheable=false)
Create an IGraphics layer.
The lowest level base class of an IGraphics control.
Used to manage a rectangular area, independent of draw class/platform.
virtual void DrawRect(const IColor &color, const IRECT &bounds, const IBlend *pBlend=0, float thickness=1.f)
Draw a rectangle to the graphics context.
void ResumeLayer(ILayerPtr &layer)
If a layer already exists, continue drawing to it.
Used to manage mouse modifiers i.e.
void DrawText(const IText &text, const char *str, const IRECT &bounds, const IBlend *pBlend=0)
Draw some text to the graphics context in a specific rectangle.
void Draw(IGraphics &g) override
Draw the control to the graphics context.
void OnMouseDown(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse down event on this control.
This file contains the base IControl implementation, along with some base classes for specific types ...
void GetTouches(IControl *pControl, std::vector< ITouchID > &touchesOnThisControl) const
Populate a vector with the touchIDs active on pControl.
IText is used to manage font and text/text entry style for a piece of text on the UI...
bool CheckLayer(const ILayerPtr &layer)
Test to see if a layer needs drawing, for instance if the control's bounds were changed.
virtual bool IsDirty()
Called at each display refresh by the IGraphics draw loop, after IControl::Animate(), to determine if the control is marked as dirty.
IControl(const IRECT &bounds, int paramIdx=kNoParameter, IActionFunction actionFunc=nullptr)
Constructor.
void OnTouchCancelled(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a touch cancel event on this control.
The lowest level base class of an IGraphics context.
bool IsDirty() override
Called at each display refresh by the IGraphics draw loop, after IControl::Animate(), to determine if the control is marked as dirty.
virtual void FillEllipse(const IColor &color, const IRECT &bounds, const IBlend *pBlend=0)
Fill an ellipse within a rectangular region of the graphics context.
virtual void DrawEllipse(const IColor &color, const IRECT &bounds, const IBlend *pBlend=0, float thickness=1.f)
Draw an ellipse within a rectangular region of the graphics context.
Control to test multi touch.
void DrawLayer(const ILayerPtr &layer, const IBlend *pBlend=nullptr)
Draw a layer to the main IGraphics context.
A base class for controls that can do do multitouch.
void OnMouseUp(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse up event on this control.
ILayerPtr EndLayer()
End an IGraphics layer.
std::unique_ptr< ILayer > ILayerPtr
ILayerPtr is a managed pointer for transferring the ownership of layers.
virtual void SetDirty(bool triggerAction=true, int valIdx=kNoValIdx)
Mark the control as dirty, i.e.