[python] add bgcolor to turtule module (#367)

* add bgcolor to turtul module

* add bgcolor to toolbox and a minor fix

* ok is ok now i hope however

* Submodule Omega-Kawaii-Theme remove
This commit is contained in:
cartoone222
2024-06-09 09:01:17 +02:00
committed by GitHub
parent 3b22656d4f
commit ff54918502
16 changed files with 76 additions and 1 deletions

View File

@@ -33,6 +33,7 @@ void Turtle::reset() {
m_y = 0;
m_heading = 0;
m_color = k_defaultColor;
m_bgcolor = k_defaultColorBG;
m_penDown = true;
m_visible = true;
m_speed = k_defaultSpeed;
@@ -40,6 +41,7 @@ void Turtle::reset() {
m_mileage = 0;
// Draw the turtle
drawBg();
draw(true);
}
@@ -202,6 +204,19 @@ bool Turtle::isOutOfBounds() const {
return absF(x()) > k_maxPosition || absF(y()) > k_maxPosition;
};
void Turtle::drawBg() {
MicroPython::ExecutionEnvironment::currentExecutionEnvironment()->displaySandbox();
KDContext * ctx = KDIonContext::sharedContext();
KDRect bg = KDRect(
0,
0,
320,
229);
ctx->fillRect(bg, m_bgcolor);
}
// Private functions
void Turtle::setHeadingPrivate(mp_float_t angle) {
@@ -406,4 +421,4 @@ void Turtle::erase() {
KDContext * ctx = KDIonContext::sharedContext();
ctx->fillRectWithPixels(iconRect(), m_underneathPixelBuffer, nullptr);
m_drawn = false;
}
}