File: OS.c

package info (click to toggle)
xbill 2.1-7
  • links: PTS, VCS
  • area: main
  • in suites: lenny, squeeze
  • size: 736 kB
  • ctags: 552
  • sloc: ansic: 3,250; sh: 197; makefile: 129
file content (55 lines) | stat: -rw-r--r-- 993 bytes parent folder | download | duplicates (6)
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
54
55
#include "types.h"
#include "util.h"

#include "OS.h"
#include "UI.h"

#define MIN_PC 6		/* OS >= MIN_PC means the OS is a PC OS */

static const char *osname[] = {"wingdows", "apple", "next", "sgi", "sun",
			       "palm", "os2", "bsd", "linux", "redhat", "hurd"};
#define NUM_OS (sizeof(osname) / sizeof(osname[0]))

static Picture *os[NUM_OS];		/* array of OS pictures*/
static MCursor *cursor[NUM_OS];		/* array of OS cursors (drag/drop) */


void
OS_load_pix() {
	unsigned int i;
	for (i = 0; i < NUM_OS; i++) {
		UI_load_picture(osname[i], 1, &os[i]);
		if (i != 0)
			UI_load_cursor(osname[i], CURSOR_OWN_MASK, &cursor[i]);
	}
}

void
OS_draw(int index, int x, int y) {
	UI_draw(os[index], x, y);
}

int
OS_width() {
	return UI_picture_width(os[0]);
}

int
OS_height() {
	return UI_picture_height(os[0]);
}

void
OS_set_cursor(int index) {
	UI_set_cursor(cursor[index]);
}

int
OS_randpc() {
	return (RAND(MIN_PC, NUM_OS - 1));
}

int
OS_ispc(int index) {
	return (index >= MIN_PC);
}