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[] = { "initfail", "arch", "bsd", "centos", "debian",
10 "gentoo", "mandriva", "openbsd", "slackware",
11 "suse", "ubuntu"};
12 #define NUM_OS (sizeof(osname) / sizeof(osname[0]))
13
14 static Picture *os[NUM_OS]; /* array of OS pictures*/
15 static MCursor *cursor[NUM_OS]; /* array of OS cursors (drag/drop) */
16
17
18 void
OS_load_pix()19 OS_load_pix() {
20 unsigned int i;
21 for (i = 0; i < NUM_OS; i++) {
22 UI_load_picture(osname[i], 1, &os[i]);
23 if (i != 0)
24 UI_load_cursor(osname[i], CURSOR_OWN_MASK, &cursor[i]);
25 }
26 }
27
28 void
OS_draw(int index,int x,int y)29 OS_draw(int index, int x, int y) {
30 UI_draw(os[index], x, y);
31 }
32
33 int
OS_width()34 OS_width() {
35 return UI_picture_width(os[0]);
36 }
37
38 int
OS_height()39 OS_height() {
40 return UI_picture_height(os[0]);
41 }
42
43 void
OS_set_cursor(int index)44 OS_set_cursor(int index) {
45 UI_set_cursor(cursor[index]);
46 }
47
48 int
OS_randpc()49 OS_randpc() {
50 return (RAND(MIN_PC, NUM_OS - 1));
51 }
52
53 int
OS_ispc(int index)54 OS_ispc(int index) {
55 return (index >= MIN_PC);
56 }
57