Не распознается ни одно событие SDL
Написал такой код:
#include <iostream>
#include <cstdlib> // для system
#include <conio.h>
#include <stdio.h>
#include <SDL.h>
#include <SDL_image.h>
using namespace std;
int main(int argc, char* argv[])
{
SDL_Event e;
while (1) {
while (SDL_PollEvent(&e) != 0) {
cout << 1;
}
}
}
Какую бы я клавишу не нажал, 1 не выводится в консоль. Что я делаю не так?
Ответы (1 шт):
Автор решения: Nikita_yfh
→ Ссылка
#include <iostream>
#include <cstdlib> // для system
#include <conio.h>
#include <stdio.h>
#include <SDL.h>
#include <SDL_image.h>
using namespace std;
int main(int argc, char* argv[]){
SDL_Init(SDL_INIT_VIDEO);
SDL_Event e;
while (1) {
while (SDL_PollEvent(&e) != 0) {
cout << 1;
}
}
}
Необходимо было инициализировать SDL2.