Relative Content

Tag Archive for c++sdl-2

SDL2 not throwing window close event

For personal use, I’m coding an additional layer on SDL2, which includes an event manager. It correctly detects every type of event, except SDL_WINDOWEVENT_CLOSE. After trying to debug my code, I realized that SDL2 actually never fires that event on my device… So there’s no problem when I have only 1 window (because SDL_QUIT is thrown instead), but when I have several windows I just can’t detect when a window closing is requested, and I have to ctrl+C my program from the shell to have SDL_QUIT fired manually.

SDL2 not throwing window close event

For personal use, I’m coding an additional layer on SDL2, which includes an event manager. It correctly detects every type of event, except SDL_WINDOWEVENT_CLOSE. After trying to debug my code, I realized that SDL2 actually never fires that event on my device… So there’s no problem when I have only 1 window (because SDL_QUIT is thrown instead), but when I have several windows I just can’t detect when a window closing is requested, and I have to ctrl+C my program from the shell to have SDL_QUIT fired manually.

Problems with SDL2 controller rumble

I’m making a game using C++ and SDL2, and for testing purposes I wanted my controller to rumble when detected by the program. However, said rumbling does not happen. I tried calling SDL_GameControllerRumble in another part of my program to test it, and in that case it works until I unplug and plug back in my controller a few times.

error allocating an object of an abstract class type

**menu button class:** #ifndef __FORGE_MENU_BUTTON_HPP__ #define __FORGE_MENU_BUTTON_HPP__ #include “ForgeConstruct.hpp” #include “ForgeConstructFactory.hpp” class ForgeMenuButton : public ForgeSDLConstruct { public: ForgeMenuButton() : ForgeSDLConstruct() {} virtual void load(const ForgeConstructParams*); . . more code in here but removed conciseness . }; **class ForgeMenuButtonCreator : public ForgeBaseCreator{ ForgeConstruct* createForgeConstruct() const { return new ForgeMenuButton();** } }; **base class** class ForgeBaseCreator{ […]