1 /*
2  *	xtrojka (c) 1994,1995,1996 Maarten Los
3  *
4  *	#include "COPYRIGHT"
5  *
6  *	created:	26.xi.1995
7  *	modified:
8  *
9  *	Do some basic drawing functions
10  */
11 
12 #include <stdio.h>
13 
14 #include <X11/Intrinsic.h>
15 #include <X11/StringDefs.h>
16 #include <X11/Shell.h>
17 #include <X11/Xlib.h>
18 #include "screen.h"
19 
20 #include "debug.h"
21 #include "tr_core.h"
22 #include "screen.h"
23 #include "xtrojka.h"
24 /*
25 #include "window.h"
26 #include "pictures.h"
27 */
28 
29 extern flag is_color;
30 
31 /*
32  *	implementation
33  */
set_color(w,fg,bg)34 void set_color(w, fg, bg)
35 Widget w;
36 int fg, bg;
37 {
38 	DEBUG("screen.c", "set_color")
39 
40 	if(is_color) {
41 
42 		if(fg < 0)
43 			return;
44 
45 		XSetForeground(XtDisplay(w),
46 			DefaultGCOfScreen(XtScreen(w)), app_data.color[fg]);
47 
48 		if(bg < 0)
49 			return;
50 
51 		XSetBackground(XtDisplay(w),
52 			DefaultGCOfScreen(XtScreen(w)), app_data.color[bg]);
53 	}
54 
55 }
56 
57 
paint_widget(w,fg,bg)58 void paint_widget(w, fg, bg)
59 Widget w;
60 int fg,bg;
61 {
62 	DEBUG("screen.c", "paint_widget")
63 
64 	set_color(w, fg, bg);
65 	XFillRectangle(	XtDisplay(w),
66 			XtWindow(w),
67 			DefaultGCOfScreen(XtScreen(w)), 0,0,
68 			WidthOfScreen(XtScreen(w)),
69 			HeightOfScreen(XtScreen(w))
70 	);
71 }
72 
73 
draw_string(w,x,y,s)74 void draw_string(w, x,y,s)
75 Widget w;
76 int x,y;
77 char *s;
78 {
79 	DEBUG("screen.c", "draw_string")
80 
81 	XDrawString(XtDisplay(w),
82 		XtWindow(w),
83 		DefaultGCOfScreen(XtScreen(w)),
84 		x,y, s, strlen(s)
85 	);
86 }
87 
88