2019-08-05 02:10 AM
Hello,
Do you know if there is a simple way to make touchGFX draw a circle during a few ms on each touch screen press ?
best regards
2019-08-05 06:26 AM
Hi,
What do you mean by "during a few ms" ? Are you putting a requirement on the render effeciency of the circle or do you mean that it has to animate from 0 to 100% filled or something like that?
Thanks!
/Martin
2019-08-05 06:28 AM
Hi,
no just print a circle for a few ms (just to tell the user the press has been detected)
Best regards
2019-08-05 06:32 AM
Ah, you mean show a circle for a few ms then hide it again?
2019-08-05 06:33 AM
Yes
2019-08-05 06:34 AM
The simple thing to do is just to use MyView::handleClickEvent() to show the Circle at the pressed x,y and in the MyView::handleTickEvent() method just keep track of ticks and hide the circle once a certain amount of ticks have passed.
/Martin
2019-08-05 06:46 AM
thanks a lot for the help,
now compilation is OK.
But
1) from my function handleClickEvent, how can i get the coordinates (i have to print the circle at the press position...) : call TS_GetState ?
2) i have to implement this functions for all my screens ?
best regards
2019-08-05 06:54 AM
Hello
I can't make it work....!!!
here is my implementation :
void DigicodeView::handleClickEvent(const ClickEvent& evt)
{
TS_StateTypeDef state;
touchgfx::Circle circle1;
touchgfx::PainterRGB888 circle1Painter;
TS_GetState(&state);
if (state.touchDetected == 1)
{
circle1.setPosition(0, 0, 144, 80);
circle1.setCenter(52, 41);
circle1.setRadius(40);
circle1.setLineWidth(4);
circle1.setArc(0, 360);
circle1.setCapPrecision(180);
circle1Painter.setColor(touchgfx::Color::getColorFrom24BitRGB(199, 16, 16));
circle1.setPainter(circle1Painter);
circle1.setVisible(true);
circle1.invalidate();
}
}
best regards
2019-08-05 11:28 PM
Hi,
No, you don't have to call TS_GetState. This is already called in the TouchController implementation. Notice the arguments to handleClickEvent. You can get x and y from
evt.getX()
evt.getY()
/Martin
2019-08-06 12:04 AM
Hello
thank you for your reply
I still can't make it work : the circle doesn't appear; do you have any idea why ?
In the setup screen i add a circle :
void DigicodeView::setupScreen()
{
DigicodeViewBase::setupScreen();
circle1.setPosition(0, 0, 480, 272);
circle1.setCenter(x,y);
circle1.setRadius(40);
circle1.setLineWidth(4);
circle1.setArc(0, 360);
circle1.setCapPrecision(180);
circle1Painter.setColor(touchgfx::Color::getColorFrom24BitRGB(199, 16, 16));
circle1.setPainter(circle1Painter);
add(circle1);
circle1.setVisible(false);
circle1.invalidate();
}
In the handleClickEvent i try to show the circle
void DigicodeView::handleClickEvent(const ClickEvent& evt)
{
int16_t x = evt.getX();
int16_t y = evt.getY();
circle1.setPosition(0, 0, 480, 272);
circle1.setCenter(52, 41);
circle1.setRadius(40);
circle1.setLineWidth(4);
circle1.setArc(0, 360);
circle1.setCapPrecision(180);
circle1Painter.setColor(touchgfx::Color::getColorFrom24BitRGB(199, 16, 16));
circle1.setPainter(circle1Painter);
circle1.setVisible(true);
circle1.invalidate();
}
best regards