Advertisement
Guest User

mouse.h

a guest
Jun 25th, 2020
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1. #pragma once
  2. #include <hardware/interrupts.h>
  3. #include <drivers/driver.h>
  4.  
  5. namespace drivers {
  6.  
  7.   class MouseEventHandler {
  8.    
  9.   public:
  10.    
  11.     virtual void onMouseDown(uint8_t button);
  12.     virtual void onMouseUp(uint8_t button);
  13.    
  14.     virtual void onMouseMove(int x, int y);
  15.    
  16.   };
  17.  
  18.   class MouseDriver :public hardware::InterruptHandler, public Driver {
  19.    
  20.   protected:
  21.    
  22.     hardware::Port8Bit dataport;
  23.     hardware::Port8Bit commandport;
  24.    
  25.     uint8_t buffer[3];
  26.     uint8_t offset;
  27.     uint8_t buttons;
  28.     int8_t x, y;
  29.    
  30.     MouseEventHandler* eventHandler;
  31.    
  32.   public:
  33.    
  34.     MouseDriver(hardware::InterruptManager* interruptManager, MouseEventHandler* events);
  35.     uint32_t handleInterrupt(uint32_t esp);
  36.     virtual void activate();
  37.    
  38.   };
  39.  
  40. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement