home *** CD-ROM | disk | FTP | other *** search
/ Large Pack of OldSkool DOS MOD Trackers / goattracker_2.68.zip / src / bme / bme_mou.c < prev    next >
C/C++ Source or Header  |  2008-04-01  |  1KB  |  60 lines

  1. //
  2. // BME (Blasphemous Multimedia Engine) mouse module
  3. //
  4.  
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <string.h>
  8. #include <SDL/SDL.h>
  9.  
  10. #include "bme_main.h"
  11. #include "bme_cfg.h"
  12. #include "bme_win.h"
  13. #include "bme_gfx.h"
  14. #include "bme_io.h"
  15. #include "bme_err.h"
  16.  
  17. void mou_init(void);
  18. void mou_uninit(void);
  19. void mou_getpos(unsigned *x, unsigned *y);
  20. void mou_getmove(int *dx, int *dy);
  21. unsigned mou_getbuttons(void);
  22.  
  23. void mou_init(void)
  24. {
  25.     win_mousebuttons = 0;
  26. }
  27.  
  28. void mou_uninit(void)
  29. {
  30. }
  31.  
  32. void mou_getpos(unsigned *x, unsigned *y)
  33. {
  34.     if (!gfx_initted)
  35.     {
  36.         *x = win_mousexpos;
  37.         *y = win_mouseypos;
  38.     }
  39.     else
  40.     {
  41.         *x = win_mousexpos * gfx_virtualxsize / gfx_windowxsize;
  42.         *y = win_mouseypos * gfx_virtualysize / gfx_windowysize;
  43.     }
  44. }
  45.  
  46. void mou_getmove(int *dx, int *dy)
  47. {
  48.     *dx = win_mousexrel;
  49.     *dy = win_mouseyrel;
  50.     win_mousexrel = 0;
  51.     win_mouseyrel = 0;
  52.  
  53. }
  54.  
  55. unsigned mou_getbuttons(void)
  56. {
  57.     return win_mousebuttons;
  58. }
  59.  
  60.