1 #include "types.h"
2 #include "util.h"
3
4 #include "OS.h"
5 #include "UI.h"
6
7 #define MIN_PC 6 /* OS >= MIN_PC means the OS is a PC OS */
8
9 static const char *osname[] = {"wingdows", "apple", "next", "sgi", "sun",
10 "palm", "os2", "bsd", "linux", "redhat", "hurd"};
11 #define NUM_OS (sizeof(osname) / sizeof(osname[0]))
12
13 static Picture *os[NUM_OS]; /* array of OS pictures*/
14 static MCursor *cursor[NUM_OS]; /* array of OS cursors (drag/drop) */
15
16
17 void
OS_load_pix()18 OS_load_pix() {
19 unsigned int i;
20 for (i = 0; i < NUM_OS; i++) {
21 UI_load_picture(osname[i], 1, &os[i]);
22 if (i != 0)
23 UI_load_cursor(osname[i], CURSOR_OWN_MASK, &cursor[i]);
24 }
25 }
26
27 void
OS_draw(int index,int x,int y)28 OS_draw(int index, int x, int y) {
29 UI_draw(os[index], x, y);
30 }
31
32 int
OS_width()33 OS_width() {
34 return UI_picture_width(os[0]);
35 }
36
37 int
OS_height()38 OS_height() {
39 return UI_picture_height(os[0]);
40 }
41
42 void
OS_set_cursor(int index)43 OS_set_cursor(int index) {
44 UI_set_cursor(cursor[index]);
45 }
46
47 int
OS_randpc()48 OS_randpc() {
49 return (RAND(MIN_PC, NUM_OS - 1));
50 }
51
52 int
OS_ispc(int index)53 OS_ispc(int index) {
54 return (index >= MIN_PC);
55 }
56