svgal_vd.hh 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /********************************************************************** <BR>
  2. This file is part of Crack dot Com's free source code release of
  3. Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
  4. information about compiling & licensing issues visit this URL</a>
  5. <PRE> If that doesn't help, contact Jonathan Clark at
  6. golgotha_source@usa.net (Subject should have "GOLG" in it)
  7. ***********************************************************************/
  8. #ifndef __SVGA_VD_HPP_
  9. #define __SVGA_VD_HPP_
  10. #include "image/depth.hh"
  11. #include "device/event.hh"
  12. #include "video/display.hh"
  13. #include "image/image8.hh"
  14. #include "image/image32.hh"
  15. #include "image/img8clip.hh"
  16. class svgalib_display_class : public i4_display_class
  17. {
  18. void copy_part_to_vram(i4_image_class *im, int x, int y, int x1, int y1, int x2, int y2);
  19. w8 *v_addr;
  20. void fill_amode(int mode);
  21. class svga_mode : public mode
  22. {
  23. public :
  24. i4_display_class *assoc; // pointer to use, so we can confirm we created this mode
  25. w32 mode_num; // for the display driver's use only
  26. } amode;
  27. enum { NOT_INITIALIZED,
  28. INITIALIZED_AND_NOT_AVAILABLE,
  29. INITIALIZED_AND_AVAILABLE
  30. } init;
  31. i4_pal_handle_class mouse_pal;
  32. int cur_svga_mode,mouse_x,mouse_y;
  33. i4_image_class *mouse_pict; // generic image which will take the type of the screen when we copy the save portion
  34. i4_SCREEN_TYPE *mouse_save;
  35. int mouse_event_flags;
  36. i4_draw_context_class *context;
  37. public :
  38. class svgalib_device_manager : public i4_device_class // maintains the mouse & keyboard
  39. {
  40. public :
  41. char *name() { return "svgalib device manager"; }
  42. } devs;
  43. class svgalib_mouse_notify : public i4_event_handler_class // receives events from the mouse, so display can update mouse position
  44. {
  45. public :
  46. svgalib_display_class *display;
  47. virtual void receive_event(i4_event *ev)
  48. {
  49. if (ev->type==i4_event::MOUSE_MOVE)
  50. {
  51. i4_mouse_move_event_class *mev=(i4_mouse_move_event_class *)ev;
  52. display->mouse_x=mev->x;
  53. display->mouse_y=mev->y;
  54. }
  55. }
  56. } mouse_notify;
  57. i4_device_class *local_devices() { return &devs; }
  58. i4_image8_clippable *screen;
  59. virtual i4_image_class *next_frame_screen(i4_rect_list_class *area_of_change);
  60. virtual i4_image_class *both_screens();
  61. virtual w16 width() { return screen->width(); }
  62. virtual w16 height() { return screen->height(); }
  63. virtual void flush();
  64. svgalib_display_class();
  65. virtual w8 bits_per_pixel() { return 8; }
  66. virtual mode *get_first_mode();
  67. virtual mode *get_next_mode(mode *last_mode);
  68. i4_rect_list_class *get_clip_list() { return &screen->clip_list; }
  69. virtual i4_draw_context_class *get_context() { return context; }
  70. virtual i4_bool realize_palette(i4_pal_handle_class pal_id);
  71. // initialize_mode need not call close() to switch to another mode
  72. i4_bool initialize_mode(mode *which_one);
  73. // should be called before a program quits
  74. i4_bool close();
  75. char *name() { return "SVGALIB console display"; }
  76. i4_bool available();
  77. ~svgalib_display_class();
  78. } ;
  79. extern svgalib_display_class svgalib_display_instance;
  80. #endif