类型 | 命令 |
---|---|
基本画图命令 | fd, bk, lt, rt |
设置笔状态命令 | c, rgb, size, up, down |
状态命令 | show, hide, speed, showXY, wait, pause, cls, clsRec |
增强画图命令 | o, oo, e, ee, r, rr |
坐标命令 | moveTo, lineTo, getX, getY, getAngle, setAngle |
文字命令 | text, precision, textSize, font, textU, d2s |
图片命令 | setPath,picL, pic, picO, picU, cav, ani |
声音命令 | soundL, sound, soundLoop, soundVol, soundPause, soundStop |
输入输出命令 | cin, cinTitle, cinWin, cout |
键盘检测命令 | getKey, getDigit, waitKey, getDownKey |
鼠标检测命令 | waitMouse, mouseDown, getMX, getMY, getMDX, getMDY, mouseIn, cursor |
设置按钮命令 | button, buttonMP, buttonMI |
新版增加命令 | alp, a, aa, ch, drawH, pXY, pol,cap, save, load, videoPlay, ctime, getC |
数学函数 | abs(), sqrt(), rand(), sin, cos, atan2, pow, strlen, getYear, getMonth, getDate, getHour, getMinute, getSecond, getTime |
基本画图命令 | |
---|---|
命令 | 功能说明 |
pen.fd( length ); | ![]() |
pen.bk( length ); | ![]() |
pen.rt( angle ); | ![]() |
pen.lt( angle ); | ![]() |
设置笔状态命令 | |
---|---|
命令 | 功能说明 |
pen.c( color ); | ![]() |
pen.rgb(r, g, b ); |
![]() |
pen.size( width ); |
![]() |
pen.up( ); |
![]() |
pen.down( ); |
![]() |
状态命令 | |
---|---|
命令 | 功能说明 |
pen.show( ); | |
pen.hide( ); |
![]() |
pen.speed( v ); |
|
pen.showXY(len,color,size ); |
![]() ![]() |
wait( second ); |
表示程序在这里停留0.2秒。 |
pause( ); pause( second ); |
表示程序在这里等待5.5秒,但按键就会终止等待,继续运行。 |
pen.cls( ); |
|
pen.clsRec( w, h ); pen.clsRec( ); |
![]() |
增强画图命令 | |
---|---|
命令 | 功能说明 |
pen.o( r ); pen.o( r,c ); pen.oo( r ); pen.oo(r,c); |
![]() |
pen.e( w, h ); pen.e( w, h, c ); pen.ee( w, h ); pen.ee(w, h, c); |
![]() |
pen.r( w, h ); pen.r( w, h, c ); pen.rr( w, h ); pen.rr(w, h, c); |
![]() |
坐标命令 | |
---|---|
命令 | 功能说明 |
pen.moveTo( x, y ); |
![]() |
pen.lineTo( x, y ); |
![]() |
getX( ); |
![]() |
getY( ); |
![]() |
getAngle( ); |
![]() |
pen.setAngle( a ); |
![]() |
文字命令 | |
---|---|
命令 | 功能说明 |
pen.text(x); pen.text(x, c); |
如果x是浮点数字,按照指定精度输出。 如果缺省c,以笔的颜色为文字颜色。 ![]() |
pen.precision( len ); |
![]() |
pen.textSize( i ); |
![]() |
pen.font( f ); |
pen.textSize(40).font(3).text("你好",0); pen.moveTo(80,0).font("华文新魏").text("你好",1); ![]() |
pen.text(s,col,size,dir,x,y,c2); pen.text(s,col,size,dir,x,y); pen.text(s,col,size,dir); pen.text(s,col,size); |
![]() |
pen.textU( 0/1 ); |
p.textU(0); for (int i=0; i<6; i++) p.fd(150).text(i,i,100).bk(150).rt(60); ![]() |
d2s( double ); |
pen.hide().up(); for (int i=0; i<12; i++) p.fd(150).text(d2s(i)+"点",0,30).bk(150).rt(360/12); ![]() |
图片命令 | |
---|---|
命令 | 功能说明 |
pen.setPath(ps ); |
![]() ![]() |
pen.picL( id,fname ); |
|
pen.picL( idBeign,idEnd,fnames ); pen.picL( idBeign,idEnd,fname,sBegin ); |
第1种命令格式中的idBegin是id的开始编号,idEnd是id的结束编号。fnames是多个图形文件名的字符串,文件名中间用”,”隔开。 第2种命令格式中的sBegin是图片文件的开始编号,图片文件名格式为:文件名+编号+.+后缀。 这个命令相当于: pen.picL(0,"car.png").picL(1,"pen.png").picL(2,"tree.png"); 这个命令相当于: pen.picL(3,"bike0.png").picL(4,"bike1.png").picL(5,"bike2.png").picL(6,"bike3.png"); |
pen.pic( id ); pen.pic(id, w, h); pen.pic(cav,id,w,h,angle,x,y); |
p.picL(1,"bird.png"); for (int i=0; i<4; i++) p.fd(150).pic(1).bk(150).rt(90); ![]() |
pen.picO( 1/0 ); |
p.picL(1,"bird.png").picO(0); for (int i=0; i<4; i++) p.fd(150).pic(1) .o(10,1).bk(150).rt(90); ![]() |
pen.picU( 0/1 ); |
p.picL(1,"bird.png").picU(0); for (int i=0; i<6; i++) p.fd(150) .pic(1).bk(150).rt(60); ![]() |
pen.cav( -1/0/1 ); |
p.cav(0).ee(80,200,2).rt(60); p.cav(-1).ee(80,200,3).rt(60); ![]() |
pen.ani(cavId, picId ); pen.ani(cavId, picId, w, h); pen.ani(cav,id,w,h,angle,x,y); |
p.speed(10).picL(1,"car.png"); for (int i=0;i<20; i++) p.fd(50).ani(-1,1).rt(18); ![]() |
声音命令 | |
---|---|
命令 | 功能说明 |
pen.soundL(id, fname); pen.soundL( idBeign,idEnd,fnames ); pen.soundL( idBeign,idEnd,fname,sBegin ); |
p.soundL(1,2,"rub.mp3,mus.wav"); |
pen.sound(id); |
|
pen.soundLoop(id); |
|
pen.soundVol(id, v ); |
|
pen.soundPause(id); |
|
pen.soundStop( id ); pen.soundStop(); |
|
输入输出命令 | |
---|---|
命令 | 功能说明 |
cin>> x; |
![]() |
cinTitle( string ); |
![]() |
cinWin(); |
![]() ![]() |
cout << x; |
![]() |
键盘检测命令 | |
---|---|
命令 | 功能说明 |
getKey() |
![]() |
waitKey(); |
|
getDigit() |
|
getDownKey() |
|
鼠标检测命令 | |
---|---|
命令 | 功能说明 |
waitMouse(); |
|
getMX() getMY() |
for (;;) pen.moveTo(getMX(), getMY()).oo(5,1); ![]() |
getMDX() getMDY() |
for (;;) pen.moveTo(getMDX(), getMDY()).oo(5,1); ![]() |
mouseIn(x,y,r) |
|
mouseDown(x,y,r); mouseDown(); |
cursor( s ); |
参数常见的有:default | crosshair | move | help | wait | text | w-resize |s-resize |ne-resize |nw-resize |pointer|等。对应的图形: ![]() ![]() |
按钮命令 | |
---|---|
命令 | 功能说明 |
pen.button(id,string,col,size); pen.button(id,string,col,size, dir,x,y); pen.button(id,string,col,size, dir,x,y,bgcol); pen.button(id,string,col,size, dir,x,y,bgcol,edgecol); |
![]() |
buttonMP(id); |
p.c(1).rt(90); p.button(1,"点这里画黑色点",02,23,0,0,60,5); for (;;){ if ( buttonMP(1)) p.oo(10,0); p.fd(1).rt(1); } ![]() |
buttonMI(id); |
p.c(1).rt(90); p.button(2,"移动到这里画绿点",10,23,90,-120,-50,4); for (;;){ if ( buttonMI(2)) p.oo(10,3); p.fd(1).rt(1); } ![]() |
新版增加命令 | |
---|---|
命令 | 功能说明 |
pen.alp( d ); | ![]() |
pen.a( r, A, mod, c ); pen.aa( r, A, mod, c ); |
![]() ![]() ![]() |
pen.CH ( id ); |
p.picL(1,"pen.png").CH (1); for (int i=0; i<10; i++) p.fd(100).rt(36); ![]() |
pen.drawH( ); |
![]() |
pen.polXY(x, y); pen.polXY( ); |
![]() |
pen.pol( mod ); pen.pol( mod, col ); |
![]() |
pen.cap( mod ); |
p.size(20).speed(10); p.cap(0).c(0).fd(80).o(30,10).rt(90).fd(80); p.cap(1).c(1).fd(80).o(30,10).rt(90).fd(80); p.cap(2).c(2).fd(80).o(30,10).rt(90).fd(80); ![]() |
pen.save( ); pen.load( ); |
for (int i=0; i<6; i++){ p.fd(150).rt(60); if (i>0 && i<4) p.save().c(10).size(1).lineTo(0,0).load(); } ![]() |
pen.videoL( vId, fname); videoPlay(vId,left,top,width,height,loop,volume); pen.videoStop( vId ); pen.videoPause( vid ); pen.videoGo( vid ); |
p.videoL(1,"lesson1/mov.mp4"); p.videoPlay(1,-100,50,300,200,0,0.6); wait(10); ![]() |
getC(x,y); getC(x,y,cavId); |
![]() |
pen.ctime( s ); pen.ctime(title,s,c,size,x,y); |
![]() |
数学函数 | |
---|---|
命令 | 功能说明 |
abs() | ![]() |
sqrt() |
![]() |
rand() rand(a,b) srand( x ) |
![]() |
sin( a ) cos( a ) |
![]() |
atan2(y,x) |
![]() |
pow(a,b) |
![]() |
strlen( s ) |
![]() |
getYear() getMonth() getDay() getHour() getMinute() getSecond() |
![]() |
getTime() |
![]() |
修改时间: 2024.10