Commit Graph

66 Commits

Author SHA1 Message Date
cartoone222
ff54918502 [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
2024-06-09 07:01:17 +00:00
Hugo Saint-Vignes
7e5ddcd36b [python/turtle] Prevent position overflow from turtle
Change-Id: Ieb8a7b64bab1ce6fac23ca4c8dcb43467b8d4d5c
2020-11-04 15:33:01 +01:00
Arthur Camouseigt
d7fb5c256c [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
2020-06-10 10:35:13 +02:00
Arthur Camouseigt
4b20c69174 [python/modturtle.cpp] Added support for float parameter in colormode()
The function can now accept the value 1.0 in addition to 1

Change-Id: I9a7021076844784ca997fc618253524089cbe855
(cherry picked from commit c69e1542ecc9a7e474a3f1e92cc97f644bf4b701)
2020-06-04 14:50:10 +02:00
Arthur
fe7c4b1a8a [python/turtle] Added write method
Allows user to print strings with the turtle

Change-Id: I06a3832f6fa36d29506be10c48a1b2fb34cb69fb
2020-06-04 14:50:09 +02:00
Émilie Feral
273d10dc26 [python] Change names: ColorParse::ParseColor --> Color::Parse 2020-06-04 14:50:08 +02:00
Émilie Feral
ba15415847 [python] modturtle: avoid unexpected cast 2020-04-30 14:12:32 +02:00
Émilie Feral
686a1493e5 [python] Coding style 2020-04-30 14:12:32 +02:00
Émilie Feral
af0cdbcc1b Coding style 2020-04-30 14:12:32 +02:00
Émilie Feral
8f5fa50f22 [python] Color: avoid magic number 255, clean code of ColorParser and
Turtle::colormode
2020-04-30 14:12:32 +02:00
Émilie Feral
c920df1f76 [python] Change enum class name: ColorModes --> ColorMode 2020-04-30 14:12:32 +02:00
Émilie Feral
3d1b3f9a0b [python] Factorize implementation of pencode (Turtle module) 2020-04-30 14:12:32 +02:00
Joachim LF
e76abcf67e [Python] universal colors 2020-04-30 14:12:32 +02:00
Émilie Feral
61399d07eb [python] Turtle: use std::fabs std::copysign when possible 2020-04-16 09:44:37 +02:00
Joachim LF
c15bb3d893 Negative diameter circle turtle support 2020-04-15 06:15:28 -07:00
Neven Sajko
dd6a729f65 Better usage of some floating point constants 2020-04-09 13:58:56 +02:00
Léa Saviot
86bd4be03e [python/port] Fix gc_collect_root on emscripten
Any data access should be aligned.
2020-02-12 15:13:22 +01:00
Léa Saviot
ac6ce97dea [python/modturtle] Allowinterruption during reset
Scenario:
fro m turtle import *
while 1==1:
  reset()
-> This script cannot be interrupted
2020-02-12 15:13:21 +01:00
Émilie Feral
37061b9cb5 [python] Fix gc_collect to be sure to get unaligned pointers 2020-02-12 15:13:16 +01:00
Émilie Feral
0db66f1784 [python] Turtle: add TODO 2019-12-04 11:27:32 +01:00
Émilie Feral
c0da810ea1 [python] Turtle module: fix modturtle_gc_collect from stack-buffer-overflow 2019-06-14 13:37:11 -04:00
Léa Saviot
e8b3db76b2 [python/turtle] Fix rounding errors
Some horizontal/vertical lines were not properly drawn
Example script:
from math import *
from turtle import *
def a():
  def carre(n):
    fd(n)
    right(90)
    fd(n)
    right(90)
    fd(n)
    right(90)
    fd(n)
    right(90)
  penup()
  goto(-158,109)
  pendown()
  carre(100)
  for j in range(10):
    for i in range(26):
      penup()
      fd(2)
      pendown()
      carre(10)
      penup()
      fd(10)
      pendown()
    penup()
    goto(-158,109-10*(j+1))
    pendown()
2019-05-03 15:53:21 +02:00
Léa Saviot
2a34f955ca [python/turtle] Fix some turtle jumps
There was a drawing glitch for instance when doing goto(100,100).
It was due to the tutle mileage being overflowed.
2019-03-12 09:51:40 +01:00
Léa Saviot
ddb22ba1a2 [python/turtle] Fix drawing of diagonal lines 2019-03-12 09:51:40 +01:00
Léa Saviot
147c1b4592 [python/turtle] Make the turtle faster on emscripten
It was slower than on the calculator
2019-03-12 09:51:40 +01:00
Léa Saviot
a036bff275 [python/turtle] Fix setHeadingPrivate (handle big angle errors) 2019-02-11 13:41:10 +01:00
Léa Saviot
3faee8bcd8 [python/turtle] Special case when goTo draws horizontal/vertical line 2019-02-06 11:45:03 +01:00
Léa Saviot
b5e278526f [python/turtle] Use namespace std 2019-02-06 11:45:03 +01:00
Léa Saviot
287dedabc0 [python/turtle] The turtle heading is in [0;360[ 2019-02-06 11:45:03 +01:00
Léa Saviot
a25b2a8ce5 [python/turtle] Fix unwanted dotted lines
Script:
fd(200)
left(90)
fd(10)
left(90)
fd(600)
The final line should be continuous but is dotted
2019-02-06 11:45:03 +01:00
Léa Saviot
5e714c371c [python/turtle] Increase chances that GC collection works fine on turtle 2019-01-21 14:23:38 +01:00
Léa Saviot
2bde26af69 [python/turtle] Specify namespace std when using cos, sin 2019-01-21 13:39:47 +01:00
Léa Saviot
2f9f40f1a7 [python/turtle] Store the heading in degrees with no k_headingOffset
This reduces rouding errors, such as:
setHeading(0)
right(1)
heading() -> gives -1.00...01
2019-01-21 13:39:47 +01:00
Léa Saviot
c2dbe9f7cc [python/turtle] Fix line drawing glitches 2018-12-21 11:57:36 +01:00
Léa Saviot
5a941bc1d5 [python/turtle] Clean circle code 2018-12-21 11:57:09 +01:00
Léa Saviot
4b306791c0 [python/turtle] Turtle::m_drawn is false if sandbox not displayed
This way, Turtle::draw() and erase() are more symetrical and no not
perform themselves if the turtle is already drawn / erased.
2018-12-18 12:05:46 +01:00
Léa Saviot
ad745f7114 [python/turtle] Add speed() methods without args 2018-12-17 15:40:34 +01:00
Léa Saviot
306869edca [python/turtle] Tune values of the turtle speed 2018-12-13 09:44:34 +01:00
Léa Saviot
91c4fea517 [python/turtle] Clean Turtle::PawPosition 2018-12-12 15:45:21 +01:00
Léa Saviot
8ac60983ed [python/turtle] Remove old turtle icon 2018-12-12 15:45:21 +01:00
Léa Saviot
99d71bb0d9 [python/turtle] Clean Turtle::setColor 2018-12-12 15:45:21 +01:00
Léa Saviot
3bd3e64e36 [python/turtle] Order the qstr 2018-12-11 14:42:04 +01:00
Léa Saviot
62cda01d2b [python/turtle] color and pencolor can take various arguments
These two methods are equal.
2018-12-11 14:42:04 +01:00
Léa Saviot
23e3038c00 [python/turtle] Remove waitForVBlank before drawings
The drawing was really slowed down by the waiting, and no tearing effect
has been noticed without waitForVBlank
2018-12-10 17:36:52 +01:00
Léa Saviot
d545c4532a [python/turtle] When speed = 0, do not draw the turtle during "goTo" 2018-12-10 17:14:23 +01:00
Léa Saviot
7efb48ab6e [python/turtle] Turtle::circle's angle argument is optional 2018-12-10 16:59:11 +01:00
Léa Saviot
fa0e93e8ac [python/turtle] Fix Turtle::circle for negative angles 2018-12-10 16:51:16 +01:00
Léa Saviot
3249ccb695 [python/turtle] "back()" shortcut for "backwards()" 2018-12-10 14:31:44 +01:00
Léa Saviot
3b334257ad [python/turlte] Move the turtle paws to mimic crawling 2018-12-10 14:10:44 +01:00
Léa Saviot
c95e291dd1 [python/turtle] First icon redesign 2018-12-07 16:58:59 +01:00