home *** CD-ROM | disk | FTP | other *** search
/ ring.yamanashi.ac.jp/pub/pc/freem/action/ / action.zip / baku100.zip / baku100 / Kernel / Map / Panel.tonyu < prev   
Text File  |  2006-06-25  |  3KB  |  151 lines

  1. extends Object;
  2.  
  3. native _n_drawSprite;
  4. function drawSprite(x,y,p,f) {
  5.    return _n_drawSprite (_body,x,y,p,f);
  6. }
  7.  
  8. native _n_drawDXSprite;
  9. function drawDXSprite(x,y,p,f,ag,scx,scy) {
  10.    return _n_drawDXSprite (_body,x,y,p,f,ag,scx,scy);
  11. }
  12.  
  13. native _n_drawLine;
  14. function drawLine(x,y,dx,dy,c) {
  15.    return _n_drawLine (_body,x,y,dx,dy,c);
  16. }
  17.  
  18. function drawBrokenLine(sx,sy,dx,dy,col,length){
  19.   var i,nx,ny,space,d;
  20.   d=dist(sx-dx,sy-dy);
  21.   if (d>0 && length>0) {
  22.     space=trunc(d/(length*2));
  23.     nx=(dx-sx)/space;
  24.     ny=(dy-sy)/space;
  25.     for(i=0;i<space;i++){
  26.       drawline(sx+(nx*i),sy+(ny*i),sx+nx*(i+1)-nx/2,sy+ny*(i+1)-ny/2,col);
  27.     }
  28.     drawline(sx+(nx*i),sy+(ny*i),dx,dy,col);
  29.   }
  30. }
  31.  
  32. native _n_getPixel;
  33. function getPixel(x,y) {
  34.    return _n_getPixel (_body,x,y);
  35. }
  36.  
  37.  
  38. native _n_fillRect;
  39. function fillRect(x,y,dx,dy,c) {
  40.    return _n_fillRect (_body,x,y,dx,dy,c);
  41. }
  42. native _n_fillPolygon;
  43. function fillPolygon(x,y,points,col) {
  44.    return _n_fillPolygon (_body,x,y,points,col);
  45. }
  46.  
  47. native _n_drawText;
  48. function drawText(x,y,s,c,f) {
  49.    return _n_drawText (_body,x,y,s,c,f);
  50. }
  51.  
  52. native _n_draw;
  53. function draw(x,y,w,h,sx,sy) {
  54.    var ww,hh;
  55. // âXâNâìü[âïâéü[âh(âXâNâìü[âïé┼é½éΘé¬ë±ô]ègæσé┼é½é╚éó)é┼ò`ëµ  
  56. //  w,h: ëµû╩Åπé┼é╠æσé½é│ sx,sy:âXâNâìü[âïê╩Æu
  57.    ww=w;hh=h;
  58.    if (!w) ww=width;
  59.    if (!h) hh=height;
  60.    // width : paneWidth     ww : dispWidth
  61.    return _n_draw (_body,x,y,width,height,sx,sy,ww,hh,zOrder,alpha,angle);
  62. }
  63. function stretchDraw(x,y,w,h) {
  64. // âXâgâîâbâ`âéü[âh(ë±ô]ègæσé┼é½éΘé¬âXâNâìü[âïé┼é½é╚éó)é┼ò`ëµ  
  65. //  (0,0)-(w,h)  : ëµû╩Åπé┼é╠æσé½é│
  66.    return _n_draw (_body,x,y,width,height,sx,sy,w,h ,zOrder,alpha,angle,1);
  67. }
  68.  
  69. native _n_copyRect;
  70. function copyRect(dlx,dty,drx,dby,src,slx,sty,srx,sby) {
  71.    var srx2,sby2;
  72.    if (!(src is Panel)) return 0;
  73.    if (srx) {
  74.        srx2=srx;
  75.        sby2=sby;
  76.    } else {
  77.        srx2=slx+(drx-dlx);
  78.        sby2=sty+(dby-dty);
  79.    }
  80.    return _n_copyRect(_body,dlx,dty,drx,dby,src._body,slx,sty,srx2,sby2);
  81. }
  82.  
  83. native _n_resize;
  84. function resize(w,h) {
  85.   _body=_n_resize(_body,w,h);
  86.   width=w;height=h;
  87. }
  88.  
  89. native _n_init;
  90. function init(w,h) {
  91.  _body=_n_init(w,h);
  92. }
  93.  
  94. native _n_free;
  95. destructor free(){
  96.    dispose();    
  97. }
  98.  
  99. function dispose() {
  100.    _n_free (_body);
  101.    _body=null;
  102. }
  103.  
  104. constructor Panel(w,h) {
  105.   init(w,h);  
  106.   width=w;
  107.   height=h;
  108.   alpha=255;
  109.   target=null;
  110.   tr=0;
  111.   setTransparentColor(tr);
  112. }
  113.  
  114. native _n_setTransparentColor;
  115. function setTransparentColor(c) {
  116.   tr=c;
  117.   _n_setTransparentColor(_body,c);
  118. }
  119. function getTransparentColor() {
  120.    return tr;
  121. }
  122.  
  123. function clear() {
  124.   fillRect(0,0,width,height,getTransparentColor());
  125. }
  126.  
  127. function setPixel(x,y,c){
  128.   drawLine(x,y,x+1,y,c);
  129. }
  130.  
  131. native _n_save;
  132. function save(fn,sx,sy,dx,dy) {
  133.   if (!dx) {
  134.     return _n_save(_body,fn,0,0,width,height);
  135.   }
  136.   return _n_save(_body,fn,sx,sy,dx,dy);
  137. }
  138. native _n_regetWidth;
  139. native _n_regetHeight;
  140. native _n_load;
  141. function load(fn) {
  142.   var b;
  143.   b=_n_load(_body,fn);
  144.   if (b) {
  145.     _body=b;
  146.     width=_n_regetWidth(b);
  147.     height=_n_regetHeight(b);
  148.     return 1;
  149.   }
  150.   return 0;
  151. }