home *** CD-ROM | disk | FTP | other *** search
- {-----------------------------------------------------------------------------}
- { TEGL Windows ToolKit II }
- { Copyright (C) 1990, 1991 TEGL Systems Corporation }
- { All Rights Reserved. }
- {-----------------------------------------------------------------------------}
-
-
- {$M 20000,0,655360}
- {-- Defaults }
- {$A-} {-- A- byte alignment }
- {$B-} {-- B- short circuit boolean evaluation }
- {$D+} {-- D- No debug info }
- {$E-} {-- E- No emulation }
- {$F-} {-- F- Far calls only when necessary }
- {$I-} {-- I- I/O error checking done internally }
- {$L+} {-- L- No local symbols }
- {$N-} {-- N- Software reals }
- {$R-} {-- R- Range checking off }
- {$S-} {-- S- Stack overflow off }
- {$V-} {-- V- No strict type checking }
-
- USES
- crt,
- errorlog,
- ipstacks,
- teglfont,
- pcxgraph,
- soundunt,
- virtmem,
- videochk,
- teglmain,
- tgi,
- tgraph,
- teglintr,
- teglunit,
- fastgrph;
-
- const
- {$I pcxdemo.inc}
-
- var ix1,iy1,ix2,iy2,bt : integer;
-
- {$F+}
- Procedure lipspcxproc; External;
- {$L lips2.obj}
- {$F-}
-
- function UserPressingButton(fs:ImageStkPtr; ms:MsClickPtr) : Boolean;
- var mxpos,mypos : Word;
- stat : Word;
- ms1 : MsClickPtr;
- begin
- stat := MousePosition(mxpos,mypos);
-
- IF FunctionKeyCode=0 THEN
- ms1 := CheckMouseClickPos(fs,mxpos,mypos)
- ELSE
- BEGIN
- stat := Ord(ScanCodeTable[lo(FunctionKeyCode)]);
- ms1 := ms;
- END;
-
- UserPressingButton := (ms1=ms) and (stat<>0);
- end;
-
-
-
- {$F+}
- Function ViewSecondScreen(ifs:ImageStkPtr; ms: MsClickPtr) : Word;
- {$F-}
- VAR
- ax,ay,ax1,ay1 : Integer;
- BEGIN
- HideMouse;
-
- ax := ms^.ms.x and $fff8;
- ay := ms^.ms.y;
- ax1 := ax + (ms^.ms.x1-ms^.ms.x);
- ay1 := ms^.ms.y1;
-
- MoveStackImage(ifs,ax,ay);
-
- ShowMouse;
- viewsecondscreen := 1;
- END;
-
-
- {$F+}
- Function BounceDemo(ifs:ImageStkPtr; ms: MsClickPtr) : Word;
- {$F-}
- var i,j : integer;
- d,e,r : boolean;
- ch : char;
- x,y,ct : integer;
- begin
- if visualsquarebuttonpress(ifs,ms) then
- begin
- hidemouse;
- x := ifs^.x+16;
- y := ifs^.y+16;
-
- ix1 := ix1 and $fff8;
- ix2 := ix1 + 368;
-
- while keypressed do ch := readkey;
-
- d := true;
- e := true;
- r := true;
- ct := 1;
- repeat
- if d then
- begin
- while (iy2<338) and not keypressed and (mouse_buttons=0) do
- begin
- movevideopixels(ix1,iy1,ix2,iy2,x,y,0,0,ptr($a000,$9600),ptr($a000,$0000));
- { movevideopixels(ix1,iy1,ix2,iy2,x,y,0,0,$8000,0); }
- inc(iy1,ct);
- inc(iy2,ct);
- end;
-
- if iy2>338 then
- begin
- dec(iy1,ct);
- dec(iy2,ct);
- end;
- end
- else
- begin
- while (iy1>0) and not keypressed and (mouse_buttons=0) do
- begin
- movevideopixels(ix1,iy1,ix2,iy2,x,y,0,0,ptr($a000,$9600),ptr($a000,$0000));
- { movevideopixels(ix1,iy1,ix2,iy2,x,y,0,0,$8000,0); }
- dec(iy1,ct);
- dec(iy2,ct);
- end;
-
- if iy1<0 then
- begin
- inc(iy1,ct);
- inc(iy2,ct);
- end;
- end;
-
- d := not d;
-
- if e then
- begin
- inc(ix1,8);
- inc(ix2,8);
- end
- else
- begin
- dec(ix1,8);
- dec(ix2,8);
- end;
-
- if ix2>639 then
- begin
- dec(ix1,8);
- dec(ix2,8);
- e := not e;
- end
- else
- if ix1<0 then
- begin
- inc(ix1,8);
- inc(ix2,8);
- e := not e;
- end;
-
- if r then
- begin
- inc(ct);
- if ct>10 then
- r := not r;
- end
- else
- begin
- dec(ct);
- if ct=1 then
- r := not r;
- end;
- until keypressed or (mouse_buttons<>0);
-
- showmouse;
- while keypressed do ch := readkey;
- while (mouse_buttons<>0) do;
-
- ReleaseSquareButton(ifs,ms);
- end;
-
- BounceDemo := 1;
- END;
-
-
- {$F+}
- Function ShiftVert(ifs:ImageStkPtr; ms: MsClickPtr) : Word;
- {$F-}
- var x,y,x1,y1 : integer;
- begin
- PressSquareButton(ifs,ms);
-
- x := ifs^.x+16;
- y := ifs^.y+16;
- x1 := x+368+16;
- y1 := y+168+16;
-
- prepareforpartialupdate(ifs,x,y,x1,y1);
- repeat
- case ms^.clicknumber of
- {/\} 7 : begin
- {/\} dec(iy1,8);
- dec(iy2,8);
- end;
- {/\} 8 : begin
- dec(iy1);
- dec(iy2);
- end;
- {\/} 9 : begin
- inc(iy1);
- inc(iy2);
- end;
- {\/} 10 : begin
- {\/} inc(iy1,8);
- inc(iy2,8);
- end;
- end;
-
- if iy1<0 then
- begin
- iy1 := 0;
- iy2 := 168;
- end
- else
- if iy2>338 then
- begin
- iy1 := 338-(iy2-iy1);
- iy2 := 338;
- end;
-
- movevideopixels(ix1,iy1,ix2,iy2,x,y,0,0,ptr($a000,$9600),ptr($a000,$0000))
-
- until not userpressingbutton(ifs,ms);
- commitupdate;
- ReleaseSquareButton(ifs,ms);
-
- shiftvert := 1;
- end;
-
-
- {$F+}
- Function ScrollHorz(ifs:ImageStkPtr; ms: MsClickPtr) : Word;
- {$F-}
- var x,y,x1,y1 : integer;
- begin
- PressSquareButton(ifs,ms);
-
- x := ifs^.x+16;
- y := ifs^.y+16;
- x1 := x+368;
- y1 := y+168;
-
- prepareforpartialupdate(ifs,x,y,x1,y1);
- repeat
- case ms^.clicknumber of
- {.<} 11 : movevideopixels(x,y,x1,y1,x,y,0,8,ptr($a000,$0000),ptr($a000,$0000));
- {.>} 13 : movevideopixels(x,y,x1,y1,x,y,0,-8,ptr($a000,$0000),ptr($a000,$0000));
- end;
- until not userpressingbutton(ifs,ms);
- commitupdate;
- ReleaseSquareButton(ifs,ms);
-
- scrollhorz := 1;
- end;
-
- {$F+}
- Function ScrollVert(ifs:ImageStkPtr; ms: MsClickPtr) : Word;
- {$F-}
- var x,y,x1,y1 : integer;
- begin
- PressSquareButton(ifs,ms);
-
- x := ifs^.x+16;
- y := ifs^.y+16;
- x1 := x+368;
- y1 := y+168;
-
- prepareforpartialupdate(ifs,x,y,x1,y1);
- repeat
- case ms^.clicknumber of
- {.^} 12 : movevideopixels(x,y,x1,y1,x,y,-8,0,ptr($a000,$0000),ptr($a000,$0000));
- {.v} 14 : movevideopixels(x,y,x1,y1,x,y,8,0,ptr($a000,$0000),ptr($a000,$0000));
- end;
- until not userpressingbutton(ifs,ms);
- commitupdate;
- ReleaseSquareButton(ifs,ms);
-
- scrollvert := 1;
- end;
-
-
- {$F+}
- Function ShiftHorz(ifs:ImageStkPtr; ms: MsClickPtr) : Word;
- {$F-}
- var x,y,x1,y1 : integer;
- begin
- PressSquareButton(ifs,ms);
-
- x := ifs^.x+16;
- y := ifs^.y+16;
- x1 := x+368;
- y1 := y+168;
-
- prepareforpartialupdate(ifs,x,y,x1,y1);
- repeat
- case ms^.clicknumber of
- {<<} 3 : begin
- dec(ix1,8);
- dec(ix2,8);
- ix2 := ix2 - (ix1 and 7);
- ix1 := ix1 and $fff8;
- end;
- {<} 4 : begin
- dec(ix1);
- dec(ix2);
- end;
- {>} 5 : begin
- inc(ix1);
- inc(ix2);
- end;
- {>>} 6 : begin
- inc(ix1,8);
- inc(ix2,8);
- ix2 := ix2 - (ix1 and 7);
- ix1 := ix1 and $fff8;
- end;
- end;
-
- if ix1<0 then
- begin
- ix1 := 0;
- ix2 := 368;
- end
- else
- if ix2>639 then
- begin
- ix1 := 639-(ix2-ix1);
- ix2 := 639;
- end;
-
- movevideopixels(ix1,iy1,ix2,iy2,x,y,0,0,ptr($a000,$9600),ptr($a000,$0000));
-
- until not userpressingbutton(ifs,ms);
- commitupdate;
- ReleaseSquareButton(ifs,ms);
-
- shifthorz := 1;
- end;
-
-
- {$F+}
- Function SquareButtonTest(ifs:ImageStkPtr; ms: MsClickPtr) : Word;
- {$F-}
- begin
- if visualsquarebuttonpress(ifs,ms) then
- begin
- ReleaseSquareButton(ifs,ms);
- end;
- squarebuttonTest := 0;
- end;
-
- {$F+}
- Function ExitOption(ifs:ImageStkPtr; ms: MsClickPtr) : Word;
- {$F-}
- BEGIN
- if visualsquarebuttonpress(ifs,ms) then
- Abortexit('TEGL PCX Graphics DEMO');
- exitoption := 1;
- END;
-
- BEGIN
- maxwindowsize := 128000;
- IF RegisterTGIDriver(@_grevga16_driver)=0 THEN;
- SetStandardHeapSize(64000); {Reserve about 32k for Video Drivers}
- setvideochoices(TG_CGA,FALSE);
- setvideochoices(TG_HGC,FALSE);
- TEGLInit(videoautodetect,20480);
-
- SetPCXBWMap($ff,$ff,$00,$ff);
- QuickShowPCXFile('TEGLLOGO.pcx',true,0,getmaxy,getmaxx);
- IPpushimage(0,0,319,239);
-
- if getmaxy>400 then
- begin
- IPputimage(320,0,ipstack,FGNORM);
- IPPutimage(0,240,ipstack,FGNORM);
- IPSetCoord(ipstack,320,240,639,479);
- end
- else
- IPSetCoord(ipstack,320,108,639,347);
- ippopimage;
-
- SetPCXBWMap($ff,$ff,$ff,$ff);
-
- {there are only 27k bytes left on the second portion of the VGA}
- {thus you can get only about 338 lines.}
- DisplayPCXFile(@lipspcxproc,true,$9600,338,getmaxx);
-
-
- pushimage(80,100,480,325);
- bevelboxfs(stackptr,0,0,400,225,white,lightgray,lightgray,8);
- bevelboxfs(stackptr,8,8,392,192,lightgray,white,lightgray,7);
- SetMoveFrameCallProc(StackPtr,viewsecondscreen);
- movevideopixels(96,96,464,264,96,116,0,0,ptr($a000,$9600),ptr($a000,$0000));
-
- ix1 := 96;
- iy1 := 96;
- ix2 := 464;
- iy2 := 264;
-
-
- DefineSquareButtonText(stackptr,8,192,57,217,10,4,'QUIT',exitoption);
- DefineSquareButtonText(stackptr,57,192,110,217,12,4,'DEMO',bouncedemo);
-
- DefineSquareButtonClick(stackptr,110,192,140,217,4,7,@imageshftll,shifthorz);
- DefineSquareButtonClick(stackptr,140,192,170,217,4,7,@imageshftl,shifthorz);
- DefineSquareButtonClick(stackptr,170,192,200,217,4,7,@imageshftr,shifthorz);
- DefineSquareButtonClick(stackptr,200,192,230,217,4,7,@imageshftrr,shifthorz);
-
- DefineSquareButtonClick(stackptr,230,192,260,217,4,7,@imageshftuu,shiftvert);
- DefineSquareButtonClick(stackptr,260,192,290,217,4,7,@imageshftu,shiftvert);
- DefineSquareButtonClick(stackptr,290,192,320,217,4,7,@imageshftd,shiftvert);
- DefineSquareButtonClick(stackptr,320,192,350,217,4,7,@imageshftdd,shiftvert);
- setpalette(8,8);
-
- DefineSquareButtonClick(stackptr,350,192,371,205,7,3,@imagetshftl,scrollhorz);
- DefineSquareButtonClick(stackptr,350,205,371,217,7,3,@imagetshftu,scrollvert);
-
- DefineSquareButtonClick(stackptr,371,192,392,205,7,3,@imagetshftr,scrollhorz);
- DefineSquareButtonClick(stackptr,371,205,392,217,7,3,@imagetshftd,scrollvert);
-
- SetCtrlBreakFS(ExitOption);
-
- TEGLSupervisor;
- END.