funkheld | ¡Hola, guten Tag. ¿Cómo se puede Yo Por favor, el Starpaint/Endpaint en mi Programa en un nProc de XPSE unterbringen ?
Hier möchte Yo ellos Por favor, rein haben: nProc drawhPicRotated(long hPic,dc,x,y,xx,yy,w,r)
esta: startpaint vordergrpic& drawpic hintergrpic&,0,0;0 drawpic bpic1&,dx!,dy!;-1,$ff00ff endpaint
y si auch va esta, welches de el Tastatur gesteuert voluntad:
startpaint bpic1& drawhPicRotated(bpicbmp&,hDC,50,50,50,50,winkel&,verh&) endpaint
Das heisst Yo möchte sólo: drawhPicRotated(bpicbmp&,hDC,50,50,50,50,winkel&,verh&) aufrufenvon el Tastatur y el otro se en el nProc abgearbeitet voluntad.
Irgendwo Tuve hier veces gelesen, el así etws gemacht wurde.
Gracias. Gruss
{$cleq}
declarar bpic&, bpic1&,bpicbmp&,ende&,winkel&,hintergrpic&,vordergrpic&
declarar x1!,y1!,dx!,dy!,verh&
ende&=1
bpic& = create("HPIC",-1,"data\\auto.bmp")
Ventana 20,20-800,600
Cls RGB(220,220,220)
bpicbmp& = create("hNewPic", 100,100,rgb(255,0,255))
bpic1& = create("hNewPic", 100,100,rgb(255,0,255))
hintergrpic& = create("hNewPic", 500,500,rgb(255,255,0))
vordergrpic& = create("hNewPic", 500,500,rgb(255,255,0))
startpaint bpicbmp&
drawpic bpic&,18,18;-1,$ff00ff
EndPaint
startpaint hintergrpic&
USEP 0,1,Rgb(,128,255)
usebrush 1,rgb(0,128,255)
ellipse 200,200-250,250
endpaint
verh&=75
dx!=60
dy!=60
startpaint bpic1&
drawhPicRotated(bpicbmp&,hDC,50,50,50,50,winkel&,verh&)
endpaint
WHILE ende&
if isKey(83)
y1!=Sin((winkel&/1000)/180.0*pi())*0.2
x1!=Cos((winkel&/1000)/180.0*pi())*0.2
dx!=dx!-x1!
dy!=dy!-y1!
endif
if isKey(87)
y1!=Sin((winkel&/1000)/180.0*pi())*0.2
x1!=Cos((winkel&/1000)/180.0*pi())*0.2
dx!=dx!+x1!
dy!=dy!+y1!
endif
if isKey(81)
winkel&=winkel&-1000
startpaint bpic1&
drawhPicRotated(bpicbmp&,hDC,50,50,50,50,winkel&,verh&)
endpaint
endif
if isKey(69)
winkel&=winkel&+1000
startpaint bpic1&
drawhPicRotated(bpicbmp&,hDC,50,50,50,50,winkel&,verh&)
endpaint
endif
startpaint vordergrpic&
drawpic hintergrpic&,0,0;0
drawpic bpic1&,dx!,dy!;-1,$ff00ff
endpaint
drawpic vordergrpic&,10,10;0
ENDWHILE
end
nProc getCircP(long r,w)
volver long(sin(0.0174532925199433*float(w)/1000.0)*float(r))
ENDPROC
nProc angleByLine(long x,y,xx,yy)
sub y,yy
sub x,xx
if x
xx=int(57295.77951 * arctan(float(y)/float(x)))
caso x>0 : volver 270000 + xx
volver 90000 + xx
endif
caso y<0 : volver 180000
volver 0
ENDPROC
nProc drawhPicRotated(long hPic,dc,x,y,xx,yy,w,r)
long hDCBits=createCompatibleDC(hDC)
selectObject(hDCBits, hPic)
long pts=dim(24)
long w1=angleByLine(xx,yy,0,0)
Largo w2=abs(w1-360000)
Largo w3=abs(w1-540000)
casenot r : r=long(sqrt(float(xx*xx+yy*yy)))\2
long pts&,0=x+getcircp(r,w1+w)
long pts&,4=y+getcircp(r,w1-90000+w)
long pts&,8=x+getcircp(r,w2+w)
long pts&,12=y+getcircp(r,w2-90000+w)
long pts&,16=x+getcircp(r,w3+w)
long pts&,20=y+getcircp(r,w3-90000+w)
plgBlt(dc,pts,hDCBits,0,0,100,100,0,0,0)
deleteDC(hDCBits)
disponer(pts)
ENDPROC
|
|