Changeset 257

Show
Ignore:
Timestamp:
03/11/08 08:50:01 (9 months ago)
Author:
FeepingCreature
Message:

--

Files:

Legend:

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

    r225 r257  
    112112  int SDL_PollEvent(SDL_Event *event); 
    113113  int SDL_SaveBMP_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst); 
     114  void SDL_QuitSubSystem(uint flags); 
     115  const uint SDL_INIT_VIDEO = 0x00000020; 
    114116} 
    115117 
     
    237239int lastx, lasty; 
    238240 
    239 void pset(T...)(int x, int y, T params) { 
    240   lastx=x; lasty=y; 
     241void pset(T...)(T params) { 
     242  auto x = cast(int) params[0], y = cast(int) params[1]; 
     243  lastx=cast(int) x; lasty=cast(int) y; 
    241244  SDL_LockSurface(display.target); 
    242245  scope(exit) { SDL_UnlockSurface(display.target); if (doFlip) flip; } 
    243   execParams(params); 
    244   with (color) putpixel32(display.target, x, y, SDL_MapRGBA(display.target.format, values[0], values[1], values[2], 0)); 
     246  execParams(params[2..$]); 
     247  if (x<0 || x!<screen.w || y<0 || y!<screen.h) return; 
     248  with (color) putpixel32( 
     249    display.target, x, y, 
     250    SDL_MapRGBA(display.target.format, values[0], values[1], values[2], 0) 
     251  ); 
    245252} 
    246253 
     
    451458      else display=Area(SDL_SetVideoMode(w, h, 32, sdl_flags)); 
    452459    } 
     460    void close() { SDL_QuitSubSystem(SDL_INIT_VIDEO); } 
    453461    int width() { return display.width; } 
    454462    int height() { return display.height; }