home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #4 / amigaacscoverdisc1998-041998.iso / utilities / shareware / dev / ucb_logoppc / source / macterm.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-14  |  4.4 KB  |  127 lines

  1. /*
  2.  *      macterm.h          mac-specific graphics macros         mak
  3.  *
  4.  *    Copyright (C) 1993 by the Regents of the University of California
  5.  *
  6.  *      This program is free software; you can redistribute it and/or modify
  7.  *      it under the terms of the GNU General Public License as published by
  8.  *      the Free Software Foundation; either version 2 of the License, or
  9.  *      (at your option) any later version.
  10.  *  
  11.  *      This program is distributed in the hope that it will be useful,
  12.  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  *      GNU General Public License for more details.
  15.  *  
  16.  *      You should have received a copy of the GNU General Public License
  17.  *      along with this program; if not, write to the Free Software
  18.  *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  *
  20.  */
  21.  
  22. #define GR_SIZE 10000
  23.  
  24. #define prepare_to_draw GetPort(&savePort); SetPort(graphics_window)
  25. #define done_drawing SetPort(savePort)
  26.  
  27. #define prepare_to_draw_turtle nop()
  28. #define done_drawing_turtle nop()
  29.  
  30. #define screen_left 1
  31. #define screen_right (graphics_window->portRect.right - 1)
  32. #define screen_top 1
  33. #define screen_bottom (graphics_window->portRect.bottom - 1)
  34.  
  35. #define screen_height (1 + screen_bottom - screen_top)
  36. #define screen_width (1 + screen_right - screen_left)
  37.  
  38. #define screen_x_center (screen_left + (screen_width)/2)
  39. #define screen_y_center (screen_top + (screen_height)/2)
  40.  
  41. #define turtle_left_max ((screen_left) - (screen_x_center))
  42. #define turtle_right_max ((screen_right) - (screen_x_center))
  43. #define turtle_top_max ((screen_y_center) - (screen_top))
  44. #define turtle_bottom_max ((screen_y_center) - (screen_bottom))
  45.  
  46. #define screen_x_coord ((screen_x_center) + turtle_x)
  47. #define screen_y_coord ((screen_y_center) - turtle_y)
  48.  
  49. #define turtle_height 18
  50. #define turtle_half_bottom 6.0
  51. #define turtle_side 19.0
  52.  
  53. #define clear_screen erase_screen()
  54.  
  55. #define line_to(x,y) LineTo(x,y)
  56. #define move_to(x,y) MoveTo(x,y)
  57. #define draw_string(s) DrawString(s)
  58. #define set_pen_vis(v) graphics_window->pnVis = v
  59. #define set_pen_mode(m) graphics_window->pnMode = m
  60. #define set_pen_color(c) mac_set_pc(c)
  61. #define set_back_ground(c) mac_set_bg(c);
  62. #define set_pen_width(w) graphics_window->pnSize.h = w
  63. #define set_pen_height(h) graphics_window->pnSize.v = h
  64. #define set_pen_x(x) graphics_window->pnLoc.h = x
  65. #define set_pen_y(y) graphics_window->pnLoc.v = y
  66.  
  67. /* pen_info is a stucture type with fields for the various
  68.    pen characteristics including the location, size, color,
  69.    mode (e.g. XOR or COPY), pattern, visibility (0 = visible) */
  70.  
  71. typedef struct { PenState ps;
  72.                  int      vis;
  73.                  long     color; } pen_info;
  74.  
  75. #define p_info_x(p) p.ps.pnLoc.h
  76. #define p_info_y(p) p.ps.pnLoc.v
  77.  
  78. #define pen_width graphics_window->pnSize.h
  79. #define pen_height graphics_window->pnSize.v
  80. #define pen_mode graphics_window->pnMode
  81. #define pen_vis graphics_window->pnVis
  82. #define pen_x graphics_window->pnLoc.h
  83. #define pen_y graphics_window->pnLoc.v
  84. #define get_node_pen_pattern Get_node_pen_pattern()
  85. #define get_node_pen_mode Get_node_pen_mode()
  86.  
  87. #define pen_reverse graphics_window->pnMode = patXor
  88. #define pen_erase graphics_window->pnMode = patBic
  89. #define pen_down graphics_window->pnMode = patCopy
  90.  
  91. #define button Button()
  92. #define mouse_x mickey_x()
  93. #define mouse_y mickey_y()
  94.  
  95. #define full_screen f_screen()
  96. #define split_screen s_screen()
  97. #define text_screen t_screen()
  98.  
  99. #define max(x,y) ((x > y) ? x : y)
  100.  
  101. /* colors
  102. #define    blackColor        33
  103. #define    whiteColor        30
  104. #define    redColor        205
  105. #define    greenColor        341
  106. #define    blueColor        409
  107. #define    cyanColor        273
  108. #define    magentaColor    137
  109. #define    yellowColor        69 */
  110.  
  111. extern GrafPtr savePort;
  112. extern int x_coord, y_coord, x_max, y_max, tty_charmode;
  113. extern char so_arr[], se_arr[];
  114.  
  115. extern void save_pen(), restore_pen(), plain_xor_pen(), set_pen_pattern();
  116. extern void set_list_pen_pattern(), get_pen_pattern(), erase_screen();
  117. extern void t_screen(), s_screen(), f_screen(), tone(), logofill(), nop();
  118. extern FIXNUM mickey_x(), mickey_y();
  119. extern NODE *Get_node_pen_pattern(), *Get_node_pen_mode();
  120. extern void c_to_pascal_string(), pascal_to_c_string();
  121. extern FIXNUM pen_color, back_ground;
  122. extern void mac_set_pc(), mac_set_bg();
  123. extern void get_palette(int slot,
  124.                         unsigned int *r, unsigned int *g, unsigned int *b);
  125. extern void set_palette(int slot,
  126.                         unsigned int r, unsigned int g, unsigned int b);
  127.