#include "SDL.h"
#include <stdio.h>
#include <Windows.h>

int main(int argc, char* argv[]) {
	SDL_Window *window;
	SDL_Init(SDL_INIT_VIDEO);
	window = SDL_CreateWindow("An SDL2 window", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, 0);

	SDL_SetHint(SDL_HINT_MOUSE_RELATIVE_MODE_WARP, "1");
	SDL_SetRelativeMouseMode(SDL_TRUE);

	bool loop = true;

	while (loop) {
		SDL_Event evt;
		while (SDL_PollEvent(&evt)) {
			switch (evt.type) {
			case SDL_QUIT:
				loop = false;
				break;
			case SDL_KEYDOWN:
				SetCursorPos(320, 240);
				break;
			case SDL_MOUSEMOTION:
				// On Windows 10 Fall Creators update, spurious motion events are printed
				printf("Mouse motion: %d\n", evt.motion.xrel);
				break;
			}
		}
	}

	SDL_DestroyWindow(window);
	SDL_Quit();
	return 0;
}
