home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l216 / 2.ddi / XGEOMETR.PRO < prev    next >
Encoding:
Text File  |  1987-03-23  |  2.2 KB  |  82 lines

  1. /****************************************************************
  2.  
  3.      Turbo Prolog Toolbox
  4.      (C) Copyright 1987 Borland International.
  5.  
  6.         Demo of    miscellaneous graphic functions
  7. ****************************************************************/
  8.  
  9. project "xgeometr"
  10.  
  11. include "tdoms.pro"
  12. include "gdoms.pro"
  13.  
  14. database
  15.     newsline(string)
  16.  
  17. include "gglobs.pro"
  18. include "tpreds.pro"
  19. include "gpreds.pro"
  20.  
  21. predicates
  22.     message(string,string,string,string,string)
  23.     wfs(char)
  24.     wait(integer)
  25. goal
  26.     graphics(1,1,1),
  27.     makewindow(1,6,6,"Geometric shapes",0,0,18,40),
  28.         makewindow(3,7,0,"",18,0,6,40),
  29.     makewindow(4,8,0,"SPACE BAR MESSAGE",24,5,1,20),
  30.  
  31.     message("This demo includes predicates which may",
  32.         "be used to draw real art.","","",""),
  33.     shiftwindow(1),
  34.     LineShade(0,0,18000,18000,18000,1,1),
  35.     LineShade(0,0,18000,18000,18000,3,0),
  36.     LineShade(0,0,18000,18000,18000,0,2),
  37.     LineShade(0,0,18000,18000,18000,2,3),
  38.     LineShade(18000,18000,0,24000,0,1,0),
  39.     wfs(_),
  40.     message("The graphics predicates include pred-",
  41.         "icates which draw different geometric",
  42.         "shapes:  circles, ellipses, rectangles",
  43.         "etc. Each may be colored and filled.",
  44.         "Here are some examples:"),
  45.     shiftwindow(1),
  46.     box(2000,2000,10000,15000,2,3,1),
  47.     box(7000,7000,11000,20000,1,2,1),
  48.     box(8000,8000,9000,18000,1,1,1),
  49.     ellipse(5000,5000,4000,0.5,1,2,1),
  50.     ellipse(9000,12000,8000,1.4,4,4,0),
  51.     sector(9000,21000,5000,2,240,300,1,1,1),
  52.     sector(9000,21000,5000,2,300,360,2,2,1),
  53.     sector(9000,21000,5000,2,0,60,3,3,1),
  54.     wfs(_).
  55.  
  56. clauses
  57.    newsline("Press the space bar to continue.   ").
  58.    message(S1,S2,S3,S4,S5):-
  59.        shiftwindow(Old),shiftwindow(3),
  60.        clearwindow,
  61.     attribute(1),write(S1,"\n"),
  62.     attribute(2),write(S2,"\n"),
  63.     attribute(3),write(S3,"\n"),
  64.     attribute(1),write(S4,"\n"),
  65.     attribute(2),write(S5,"\n"),
  66.     shiftwindow(Old).
  67.    
  68.    wfs(C):- 
  69.        shiftwindow(4),
  70.        attribute(2),
  71.        newsline(S),field_str(0,0,20,S),
  72.        keypressed,readchar(C),!,
  73.        field_str(0,0,20," "),shiftwindow(3).
  74.    wfs(C):-wait(2000),
  75.        retract(newsline(String)),!,
  76.        frontstr(1,String,F,Rest),
  77.        concat(Rest,F,New),
  78.        assertz(newsline(New)),
  79.        wfs(C).
  80.  
  81.    wait(0):-!. wait(N):-N1=N-1,wait(N1).
  82.