[turtle] Fixed remanent images bug

We now erase the turtle before writing text. This way we can redraw it
on top of it, preventing overlapping and remanent images.

Those scripts are causing issues :
goto(-30,50)
write('coucou')
left(270)
goto(30,50)
write('oui')
-----------
up()
goto(-30,50)
write('coucou')
goto(30,50)
write('oui')

Change-Id: I01a6e5f8308937b5051165548c2046883da587d2
This commit is contained in:
Arthur Camouseigt
2020-06-08 16:27:14 +02:00
parent 1ccb55a16e
commit d7fb5c256c

View File

@@ -176,8 +176,8 @@ void Turtle::setVisible(bool visible) {
}
void Turtle::write(const char * string) {
// To prevent overlapping between the text and the turtle, force redraw
m_drawn = false;
// We erase the turtle to redraw it on top of the text
erase();
MicroPython::ExecutionEnvironment::currentExecutionEnvironment()->displaySandbox();
KDContext * ctx = KDIonContext::sharedContext();
static constexpr KDCoordinate headOffsetLength = 6;