-
Notifications
You must be signed in to change notification settings - Fork 2
/
MBOS.m
59 lines (45 loc) · 1.05 KB
/
MBOS.m
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
56
57
58
59
#import "MBtypes.h"
#import "MBOS.h"
#import "MButil.h"
#import "MBUI.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", "beos"};
#define NUM_OS (sizeof(osname) / sizeof(osname[0]))
static MBPicture *os[NUM_OS]; /* array of OS pictures*/
static MBMCursor *cursor[NUM_OS]; /* array of OS cursors (drag/drop) */
@implementation MBOS
- (void)OS_load_pix
{
unsigned int i;
for (i = 0; i < NUM_OS; i++) {
[ui UI_load_picture:osname[i] :1 :&os[i]];
if (i != 0)
[ui UI_load_cursor:osname[i] :CURSOR_OWN_MASK :&cursor[i]];
}
}
- (void)OS_draw:(int)index :(int)x :(int)y
{
[ui UI_draw:os[index] :x :y];
}
- (int)OS_width
{
return [ui UI_picture_width:os[0]];
}
- (int)OS_height
{
return [ui UI_picture_height:os[0]];
}
- (void)OS_set_cursor:(int)index
{
[ui UI_set_cursor:cursor[index]];
}
- (int)OS_randpc
{
return (RAND(MIN_PC, NUM_OS - 1));
}
- (int)OS_ispc:(int)index
{
return (index >= MIN_PC);
}
@end