You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

57 lines
1020 B

  1. #include "types.h"
  2. #include "util.h"
  3. #include "OS.h"
  4. #include "UI.h"
  5. #define MIN_PC 6 /* OS >= MIN_PC means the OS is a PC OS */
  6. static const char *osname[] = { "initfail", "arch", "bsd", "centos", "debian",
  7. "gentoo", "mandriva", "openbsd", "slackware",
  8. "suse", "ubuntu"};
  9. #define NUM_OS (sizeof(osname) / sizeof(osname[0]))
  10. static Picture *os[NUM_OS]; /* array of OS pictures*/
  11. static MCursor *cursor[NUM_OS]; /* array of OS cursors (drag/drop) */
  12. void
  13. OS_load_pix() {
  14. unsigned int i;
  15. for (i = 0; i < NUM_OS; i++) {
  16. UI_load_picture(osname[i], 1, &os[i]);
  17. if (i != 0)
  18. UI_load_cursor(osname[i], CURSOR_OWN_MASK, &cursor[i]);
  19. }
  20. }
  21. void
  22. OS_draw(int index, int x, int y) {
  23. UI_draw(os[index], x, y);
  24. }
  25. int
  26. OS_width() {
  27. return UI_picture_width(os[0]);
  28. }
  29. int
  30. OS_height() {
  31. return UI_picture_height(os[0]);
  32. }
  33. void
  34. OS_set_cursor(int index) {
  35. UI_set_cursor(cursor[index]);
  36. }
  37. int
  38. OS_randpc() {
  39. return (RAND(MIN_PC, NUM_OS - 1));
  40. }
  41. int
  42. OS_ispc(int index) {
  43. return (index >= MIN_PC);
  44. }