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
Wrap
Text File
|
2006-06-25
|
3KB
|
151 lines
extends Object;
native _n_drawSprite;
function drawSprite(x,y,p,f) {
return _n_drawSprite (_body,x,y,p,f);
}
native _n_drawDXSprite;
function drawDXSprite(x,y,p,f,ag,scx,scy) {
return _n_drawDXSprite (_body,x,y,p,f,ag,scx,scy);
}
native _n_drawLine;
function drawLine(x,y,dx,dy,c) {
return _n_drawLine (_body,x,y,dx,dy,c);
}
function drawBrokenLine(sx,sy,dx,dy,col,length){
var i,nx,ny,space,d;
d=dist(sx-dx,sy-dy);
if (d>0 && length>0) {
space=trunc(d/(length*2));
nx=(dx-sx)/space;
ny=(dy-sy)/space;
for(i=0;i<space;i++){
drawline(sx+(nx*i),sy+(ny*i),sx+nx*(i+1)-nx/2,sy+ny*(i+1)-ny/2,col);
}
drawline(sx+(nx*i),sy+(ny*i),dx,dy,col);
}
}
native _n_getPixel;
function getPixel(x,y) {
return _n_getPixel (_body,x,y);
}
native _n_fillRect;
function fillRect(x,y,dx,dy,c) {
return _n_fillRect (_body,x,y,dx,dy,c);
}
native _n_fillPolygon;
function fillPolygon(x,y,points,col) {
return _n_fillPolygon (_body,x,y,points,col);
}
native _n_drawText;
function drawText(x,y,s,c,f) {
return _n_drawText (_body,x,y,s,c,f);
}
native _n_draw;
function draw(x,y,w,h,sx,sy) {
var ww,hh;
// âXâNâìü[âïâéü[âh(âXâNâìü[âïé┼é½éΘé¬ë±ô]ègæσé┼é½é╚éó)é┼ò`ëµ
// w,h: ëµû╩Åπé┼é╠æσé½é│ sx,sy:âXâNâìü[âïê╩Æu
ww=w;hh=h;
if (!w) ww=width;
if (!h) hh=height;
// width : paneWidth ww : dispWidth
return _n_draw (_body,x,y,width,height,sx,sy,ww,hh,zOrder,alpha,angle);
}
function stretchDraw(x,y,w,h) {
// âXâgâîâbâ`âéü[âh(ë±ô]ègæσé┼é½éΘé¬âXâNâìü[âïé┼é½é╚éó)é┼ò`ëµ
// (0,0)-(w,h) : ëµû╩Åπé┼é╠æσé½é│
return _n_draw (_body,x,y,width,height,sx,sy,w,h ,zOrder,alpha,angle,1);
}
native _n_copyRect;
function copyRect(dlx,dty,drx,dby,src,slx,sty,srx,sby) {
var srx2,sby2;
if (!(src is Panel)) return 0;
if (srx) {
srx2=srx;
sby2=sby;
} else {
srx2=slx+(drx-dlx);
sby2=sty+(dby-dty);
}
return _n_copyRect(_body,dlx,dty,drx,dby,src._body,slx,sty,srx2,sby2);
}
native _n_resize;
function resize(w,h) {
_body=_n_resize(_body,w,h);
width=w;height=h;
}
native _n_init;
function init(w,h) {
_body=_n_init(w,h);
}
native _n_free;
destructor free(){
dispose();
}
function dispose() {
_n_free (_body);
_body=null;
}
constructor Panel(w,h) {
init(w,h);
width=w;
height=h;
alpha=255;
target=null;
tr=0;
setTransparentColor(tr);
}
native _n_setTransparentColor;
function setTransparentColor(c) {
tr=c;
_n_setTransparentColor(_body,c);
}
function getTransparentColor() {
return tr;
}
function clear() {
fillRect(0,0,width,height,getTransparentColor());
}
function setPixel(x,y,c){
drawLine(x,y,x+1,y,c);
}
native _n_save;
function save(fn,sx,sy,dx,dy) {
if (!dx) {
return _n_save(_body,fn,0,0,width,height);
}
return _n_save(_body,fn,sx,sy,dx,dy);
}
native _n_regetWidth;
native _n_regetHeight;
native _n_load;
function load(fn) {
var b;
b=_n_load(_body,fn);
if (b) {
_body=b;
width=_n_regetWidth(b);
height=_n_regetHeight(b);
return 1;
}
return 0;
}