Initialisation du projet mp-scratch
[mp-scratch.git] / src / Bloc.mp
1 vardef AffichageB=
2   path cadre;
3   cadre=(llcorner texto+(-eb,-eb))--(lrcorner texto+(eb,-eb))--(urcorner texto+(eb,eb))--(ulcorner texto+(-eb,eb))--cycle;
4   picture TEXT;
5   TEXT=image(
6       fill cadre withcolor DarkPurple;
7     draw texto;
8     draw (llcorner texto+(-eb,-eb))--(lrcorner texto+(eb,-eb))--(urcorner texto+(eb,eb))--(ulcorner texto+(-eb,eb))--cycle;
9     );
10   TEXT
11 enddef;
12
13 vardef AffichageBlocDef=
14   path cadre;
15   cadre=(llcorner texto+(-eb,-eb))--(lrcorner texto+(eb,-eb))--(urcorner texto+(eb,eb)){dir165}..{dir-165}(ulcorner texto+(-eb,eb))--cycle;
16   picture TEXT;
17   TEXT=image(
18       fill cadre withcolor DarkPurple;
19     draw texto;
20     draw cadre;%(llcorner texto+(-eb,-eb))--(lrcorner texto+(eb,-eb))--(urcorner texto+(eb,eb))--(ulcorner texto+(-eb,eb))--cycle;
21     );
22   TEXT
23 enddef;
24
25 vardef Bloc(expr nombloc)=
26   save $;
27   picture $,texto;
28   texto=image(
29       label.lrt(LATEX("\bfseries\color{white}"&nombloc&""),if unknown _coinprec:(0,0) else: _coinprec fi);
30   );
31 $=AffichageB shifted (if unknown _coinprec:(0,0) else : _coinprec fi - ulcorner AffichageB);
32 _coinprec:=llcorner $;
33 $
34 enddef;
35
36 vardef NouveauBloc(expr nombloc)=
37   save $;
38   picture $,texto;
39   texto=image(
40       label.lrt(LATEX("\bfseries\color{white} Définir \colorbox{LightPurple}{\textcolor{white}{"&nombloc&"}}"),if unknown _coinprec:(0,0) else: _coinprec fi);
41   );
42 $=AffichageBlocDef shifted (if unknown _coinprec:(0,0) else : _coinprec fi - ulcorner AffichageBlocDef);
43 _coinprec:=llcorner $;
44 $
45 enddef;
46

Licence Creative Commons Les fichiers de Syracuse sont mis à disposition (sauf mention contraire) selon les termes de la
Licence Creative Commons Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 4.0 International.