#include <SDL.h> #include <stdio.h> #include <memory> //Screen dimension constants const int SCREEN_WIDTH = 640; const int SCREEN_HEIGHT = 480; int isMouseEvent(SDL_Event* ev); int main(int argc, char* args[]) { SDL_Event ev; //The window we'll be rendering to SDL_Window* window = NULL; //The surface contained by the window SDL_Surface* screenSurface = NULL; //Initialize SDL if (SDL_Init(SDL_INIT_VIDEO) < 0) { printf("SDL could not initialize! SDL_Error: %s\n", SDL_GetError()); } else { //Create window window = SDL_CreateWindow("SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN); if (window == NULL) { printf("Window could not be created! SDL_Error: %s\n", SDL_GetError()); } else { bool black = false; //Get window surface screenSurface = SDL_GetWindowSurface(window); SDL_SetEventFilter(isMouseEvent); bool isOn = true; while (isOn) { //Pump events SDL_PumpEvents(); SDL_FillRect(screenSurface, NULL, SDL_MapRGB(screenSurface->format, 0xFF, 0xFF, 0xFF)); //Update the surface SDL_UpdateWindowSurface(window); } } } //Destroy window SDL_DestroyWindow(window); //Quit SDL subsystems SDL_Quit(); return 0; } int isMouseEvent(SDL_Event* ev) { if(ev!=NULL) { if (ev->type == SDL_MOUSEMOTION) return 0; } return 1; } However, I am recieving these errors:
Error 1 error C2660: 'SDL_SetEventFilter' : function does not take 1 arguments
2 IntelliSense: argument of type "int (*)(SDL_Event *ev)" is incompatible with parameter of type "SDL_EventFilter"
Which does not make any sense to me, because 1) SDL_EventFilter takeswhen the second argument as a void pointercode is ran no events are filtered, so it should be ableevery event passed to be omittedisMouseEvent(This comes from my understanding at looking at every example I could find on this) and 2) is null. The parameterSDL2 Wiki is the correct typevery bare, according toand the wikiexamples on using SDL_SetEventFilter are very basic and do not work properly.
Are there any suggestions or Any ideas on whatas to where I am doing incorrectlyshould go from here, seeing as the events are constantly null when checked from the isMouseEvent() function?