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())
This file contains the base IControl implementation, along with some base classes for specific types ...
The lowest level base class of an IGraphics control.
void SetWantsMultiTouch(bool enable=true)
Specify whether this control supports multiple touches.
virtual bool IsDirty()
Called at each display refresh by the IGraphics draw loop, after IControl::Animate(),...
virtual void SetDirty(bool triggerAction=true, int valIdx=kNoValIdx)
Mark the control as dirty, i.e.
The lowest level base class of an IGraphics context.
virtual void DrawRect(const IColor &color, const IRECT &bounds, const IBlend *pBlend=0, float thickness=1.f)
Draw a rectangle to the graphics context.
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.
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 ResumeLayer(ILayerPtr &layer)
If a layer already exists, continue drawing to it.
bool CheckLayer(const ILayerPtr &layer)
Test to see if a layer needs drawing, for instance if the control's bounds were changed.
void DrawLayer(const ILayerPtr &layer, const IBlend *pBlend=nullptr)
Draw a layer to the main IGraphics context.
void GetTouches(IControl *pControl, std::vector< ITouchID > &touchesOnThisControl) const
Populate a vector with the touchIDs active on pControl.
void StartLayer(IControl *pOwner, const IRECT &r, bool cacheable=false)
Create an IGraphics layer.
ILayerPtr EndLayer()
End an IGraphics layer.
A base class for controls that can do do multitouch.
Control to test multi touch.
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 OnMouseDown(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse down event on this control.
bool IsDirty() override
Called at each display refresh by the IGraphics draw loop, after IControl::Animate(),...
void OnTouchCancelled(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a touch cancel event on this control.
void OnMouseUp(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse up event on this control.
void Draw(IGraphics &g) override
Draw the control to the graphics context.
std::unique_ptr< ILayer > ILayerPtr
ILayerPtr is a managed pointer for transferring the ownership of layers.
Used to manage mouse modifiers i.e.
Used to manage a rectangular area, independent of draw class/platform.
IText is used to manage font and text/text entry style for a piece of text on the UI,...