/* 3d Window - aout.97 - par Sylvain Huet */ struct WarpWin= [chWarpWin:Chn,winWarpWin:ObjWin,flagsWarpWin:I, endWarpWin:fun [] I, bufWarpWin:ObjBitmap,srcWarpWin:ObjBitmap, kWarpWin:F,angularWarpWin:[F F], refWarpWin:[I I],refangularWarpWin:[F F] ]mkWarpWin;; var WARPWIN_INTERF=2;; var WARPWIN_DDRAW=1;; fun _paintevent(a,b)= let b.angularWarpWin -> [p q] in WARPcalcul p q; _fooI WARPrender b.bufWarpWin b.srcWarpWin; _BLTbitmap b.winWarpWin b.bufWarpWin 0 0 ;; fun _UnclickE(a,b,x,y,button)= set b.refangularWarpWin=b.angularWarpWin; set b.refWarpWin=nil;; fun _ClickE(a,b,x,y,button)= _SETfocus b.winWarpWin ; set b.refangularWarpWin=b.angularWarpWin; set b.refWarpWin=[x y];; fun _keydownE (t,b,code,val)= if val==27 then (_DSwindow b.winWarpWin; _DSbitmap b.bufWarpWin; _DSbitmap b.srcWarpWin; exec b.endWarpWin with []) else nil;; fun movecurs(b,x,y)= let b.kWarpWin ->k in let b.refWarpWin ->[xr yr] in (set x=x-xr; set y=yr-y; let b.refangularWarpWin -> [p q] in set b.angularWarpWin=[p-.k*.itof x q+.k*.itof y]; _paintevent nil b );; fun _CursorE(a,b,x,y,c)= if b.refWarpWin==nil then nil else movecurs b x y ;; fun _DestroyE(x,b)= _DSbitmap b.bufWarpWin; _DSbitmap b.srcWarpWin; exec b.endWarpWin with [];; fun iniWarpWin(ch,father,title,end,flag)= let _CRwindow ch father nil nil 640 480 if flag&WARPWIN_DDRAW then WN_NOBORDER+WN_NOCAPTION else WN_MENU+WN_MINBOX title -> win in let _CRbitmap ch 640 480 ->buf in let _CRbitmap ch 2048 768 ->src in let mkWarpWin [ch win flag end buf src atof ".3" [itof 0 itof 0] nil nil] -> b in (_CBwinDestroy win @_DestroyE b; _CBwinPaint win @_paintevent b; _CBwinKeydown win @_keydownE b; if flag&WARPWIN_INTERF then (_CBwinClick win @_ClickE b; _CBwinUnclick win @_UnclickE b) else nil; _CBcursorMove win @_CursorE b; WARPinitialize atof "60" atof "50"; if flag&WARPWIN_DDRAW then DDRAWdefine b.winWarpWin 640 480 else nil; _paintevent nil b; b );; fun loadWarpWin(b,s)= let _FILEOpen b.chWarpWin s -> f in (HNM6header f; HNM6readWarp f b.srcWarpWin; _FILEClose f); _paintevent nil b;; fun refreshWarpWin(b)= _paintevent nil b;;