Changeset 352
- Timestamp:
- 06/03/08 06:49:51 (6 months ago)
- Files:
-
- trunk/qd/test2.d (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/qd/test2.d
r343 r352 417 417 } 418 418 419 MouseHandler mouse;420 421 419 T[] array(T)(T[] elems...) { return elems.dup; } 422 420 … … 501 499 } 502 500 503 class MouseHandler {504 pt pos;505 bool button;506 ubyte which;507 StackThreadSched sched;508 mixin This!("button=false, #pos=pt(0, 0); #New(sched); ");509 bool opIn(Area area) { return pos in area; }510 bool opIn(Widget w) { return pos in w.area; }511 void poll() {512 events((int e) { }, (int x, int y, ubyte which, int button) {513 if (button==1) {514 this.button=true;515 this.which=which;516 }517 if (button==-1) {518 this.button=false;519 this.which=which;520 }521 pos=pt(x, y);522 sched();523 });524 }525 }526 527 501 import std.c.time: time; 528 502 void countFPS() { … … 556 530 void main(string[] args) { 557 531 New(primitives, "Vera.ttf"); 558 New(mouse);559 532 auto wm=new WindowManager; 560 533 auto f1=new FractalWidget!(creal); … … 564 537 wm.windows~=w1; 565 538 //wm.windows~=wm.new Window(display.select(10, 10, 160, 60), new BaseSliderWidget); 566 w1.motion~=stackthread=&f1.handleMouse;567 539 auto start_from = f1.from, start_to = f1.to; 568 540 … … 582 554 f1.zoom(nffrom, nfto); 583 555 logln("new from ", nffrom, " to ", nfto, " step being ", step); 584 while (filename.length) { cls(Black); wm.draw(); flip; idle(); mouse.poll; countFPS(); }556 while (filename.length) { cls(Black); wm.draw(); flip; idle(); events; countFPS(); } 585 557 } 586 558 for (int i = 0; i < length; ++i) renderStep(i); … … 594 566 flip; 595 567 idle(); 596 mouse.poll;568 events; 597 569 countFPS(); 598 570 }
