D Paste by downs
Description: test27.d
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | import qd; void main() { screen(640, 480); pt pos; alias ex!("v -> f -> f.type == v") TypeCheck; alias ex!("a, b -> x -> a(x) && b(x)") And; alias ex!("a -> b -> b.pos in a()") LazyIn; registerCallback( condslice((QdEvent qe) { if (qe.type == QdEvent.Type.MouseMoved) { pos = qe.pos; } })[ And(TypeCheck(QdEvent.Type.MousePushed), LazyIn({ return Area(pos - pt(10), pt(20)); })) .. TypeCheck(QdEvent.Type.MouseReleased) ] ); while (true) { cls; circle(pos.x, pos.y, 10); flip; checkEvents; } } |