|
|
ba9f06 |
|
|
|
ba9f06 |
#include <math.h></math.h>
|
|
|
ba9f06 |
|
|
|
ba9f06 |
#include <helianthus.h></helianthus.h>
|
|
|
ba9f06 |
|
|
|
ba9f06 |
#include "drawing.h"
|
|
|
ba9f06 |
|
|
|
ba9f06 |
|
|
|
deef1d |
static Animation texture;
|
|
|
deef1d |
|
|
|
ba9f06 |
|
|
|
ba9f06 |
void drawingInit() {
|
|
|
d4e89f |
background(colorByName("yellow"));
|
|
|
deef1d |
texture = createAnimationEx("data/sprite/bricks-tile.png", TRUE, TRUE);
|
|
|
ba9f06 |
}
|
|
|
ba9f06 |
|
|
|
ba9f06 |
|
|
|
ba9f06 |
void drawingDraw() {
|
|
|
deef1d |
saveState();
|
|
|
3954ba |
|
|
|
ba9f06 |
double x = 512;
|
|
|
ba9f06 |
double y = 512 - 64;
|
|
|
ba9f06 |
|
|
|
deef1d |
strokeWidth(20);
|
|
|
ba9f06 |
|
|
|
d4e89f |
fill(colorByName("red"));
|
|
|
d4e89f |
stroke(colorByName("blue"));
|
|
|
ba9f06 |
rect(x, y, 48*2, 48);
|
|
|
ba9f06 |
x += 48*2 + 16;
|
|
|
ba9f06 |
|
|
|
d4e89f |
fill(colorByName("#C71585AA"));
|
|
|
d4e89f |
stroke(colorByName("0 0 1 0.5"));
|
|
|
ba9f06 |
ellipse(x, y, 48*2, 48);
|
|
|
ba9f06 |
x += 48*2 + 16;
|
|
|
ba9f06 |
|
|
|
d4e89f |
fill(colorByName("green"));
|
|
|
d4e89f |
stroke(colorByName("magenta"));
|
|
|
ba9f06 |
regularPolygon(x + 24, y + 24, 6, 48);
|
|
|
ba9f06 |
x += 64;
|
|
|
ba9f06 |
|
|
|
d4e89f |
stroke(colorByName("brown"));
|
|
|
ba9f06 |
point(x, y);
|
|
|
d4e89f |
stroke(colorByName("cyan"));
|
|
|
ba9f06 |
line(x, y + 48, x + 48, y);
|
|
|
d4e89f |
stroke(colorByName("brown"));
|
|
|
ba9f06 |
arc(x, y, 48, 48, 0, 90);
|
|
|
ba9f06 |
x += 64;
|
|
|
ba9f06 |
|
|
|
d4e89f |
stroke(colorByName("gray"));
|
|
|
ba9f06 |
moveTo(x, y + 24);
|
|
|
ba9f06 |
arcPath(x, y, 48, 48, 180, 360);
|
|
|
ba9f06 |
lineTo(x + 48, y + 48);
|
|
|
ba9f06 |
lineTo(x, y + 48);
|
|
|
ba9f06 |
strokePath();
|
|
|
ba9f06 |
x += 64;
|
|
|
ba9f06 |
|
|
|
d4e89f |
fill(colorByName("red"));
|
|
|
deef1d |
fillTexture(texture, 0, 0, 32, 32, FALSE);
|
|
|
d4e89f |
stroke(colorByName("transparent"));
|
|
|
ba9f06 |
moveTo(x, y + 24);
|
|
|
ba9f06 |
arcPath(x, y, 48, 48, 180, 360);
|
|
|
ba9f06 |
lineTo(x + 48, y + 48);
|
|
|
ba9f06 |
lineTo(x, y + 48);
|
|
|
ba9f06 |
lineTo(x + 24, y + 24);
|
|
|
ba9f06 |
closePath();
|
|
|
ba9f06 |
|
|
|
deef1d |
restoreState();
|
|
|
3954ba |
}
|