Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SDL2/SDL.h>
- #include <iostream>
- using namespace std;
- int main()
- {
- SDL_GLContext rctx;
- if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS) != 0)
- {
- return -1;
- }
- SDL_Window* win = SDL_CreateWindow("32 bit mouse test", 0, 0, 1920, 1080,
- SDL_WINDOW_SHOWN | SDL_WINDOW_FULLSCREEN);
- SDL_Event e;
- bool quit = false;
- while(!quit)
- {
- while(SDL_PollEvent(&e))
- {
- switch(e.type)
- {
- case SDL_MOUSEMOTION:
- cout << "x: " << e.motion.x << "(" << e.motion.xrel << ")" << endl;
- cout << "y: " << e.motion.y << "(" << e.motion.yrel << ")" << endl;
- break;
- case SDL_MOUSEBUTTONDOWN:
- case SDL_KEYDOWN:
- case SDL_QUIT:
- quit = true;
- break;
- default:
- break;
- }
- }
- }
- SDL_DestroyWindow(win);
- SDL_Quit();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement