Changeset 352

Show
Ignore:
Timestamp:
06/03/08 06:49:51 (6 months ago)
Author:
FeepingCreature
Message:
  • Foobie
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/qd/test2.d

    r343 r352  
    417417} 
    418418 
    419 MouseHandler mouse; 
    420  
    421419T[] array(T)(T[] elems...) { return elems.dup; } 
    422420 
     
    501499} 
    502500 
    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  
    527501import std.c.time: time; 
    528502void countFPS() { 
     
    556530void main(string[] args) { 
    557531  New(primitives, "Vera.ttf"); 
    558   New(mouse); 
    559532  auto wm=new WindowManager; 
    560533  auto f1=new FractalWidget!(creal); 
     
    564537  wm.windows~=w1; 
    565538  //wm.windows~=wm.new Window(display.select(10, 10, 160, 60), new BaseSliderWidget); 
    566   w1.motion~=stackthread=&f1.handleMouse; 
    567539  auto start_from = f1.from, start_to = f1.to; 
    568540   
     
    582554      f1.zoom(nffrom, nfto); 
    583555      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(); } 
    585557    } 
    586558    for (int i = 0; i < length; ++i) renderStep(i); 
     
    594566    flip; 
    595567    idle(); 
    596     mouse.poll
     568    events
    597569    countFPS(); 
    598570  }