File: triangle.c

package info (click to toggle)
xgalaga 2.1.1.0-7
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,700 kB
  • sloc: ansic: 16,119; sh: 1,548; perl: 816; makefile: 179
file content (53 lines) | stat: -rw-r--r-- 1,091 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "allincludes.h"

void
W_WriteAnyTriangle(window, X1, Y1, X2, Y2, X3, Y3, color)
    W_Window window;
    int     X1, Y1, X2, Y2, X3, Y3;
    W_Color color;
{
    struct window *win = W_Void2Window(window);
    XPoint  points[3];

    points[0].x = X1;
    points[0].y = Y1;
    points[1].x = X2;
    points[1].y = Y2;
    points[2].x = X3;
    points[2].y = Y3;

    XFillPolygon(W_Display, win->drawable, colortable[color].contexts[0],
		 points, 3, Convex, CoordModeOrigin);
}

void
W_WriteTriangle(window, x, y, s, t, color)
    W_Window window;
    int     x, y, s;
    int     t;
    W_Color color;
{
    struct window *win = W_Void2Window(window);
    XPoint  points[3];

    if (t == 0) {
	points[0].x = x;
	points[0].y = y;
	points[1].x = x + s;
	points[1].y = y - s;
	points[2].x = x - s;
	points[2].y = y - s;
    } else {
	points[0].x = x;
	points[0].y = y;
	points[1].x = x + s;
	points[1].y = y + s;
	points[2].x = x - s;
	points[2].y = y + s;
    }


    XFillPolygon(W_Display, win->drawable, colortable[color].contexts[0],
		 points, 3, Convex, CoordModeOrigin);
}