Initialize sdl::UserEvent to all zeroes

It was the entire point of pull request #1968, after all.
Apparently this bit was lost in the midst of refactoring.

While I'm here, also utilize standard formatting practices,
in particular indenting with tabs.
(My bad that I missed space indentation while reviewing the pull request.)
This commit is contained in:
Jyrki Vesterinen 2017-09-17 17:37:30 +03:00
parent c7cda91250
commit dca021e9ad

View file

@ -15,29 +15,39 @@
#include <SDL_events.h>
#include <cstring>
namespace sdl
{
class UserEvent : public SDL_UserEvent
{
public:
UserEvent() : SDL_UserEvent() {
}
UserEvent(int type) : UserEvent() {
this->type = type;
}
class UserEvent : public SDL_UserEvent
{
public:
UserEvent() : SDL_UserEvent()
{
std::memset(this, 0, sizeof(*this));
}
UserEvent(int type, int code) : UserEvent(type) {
this->code = code;
}
UserEvent(int type) : UserEvent()
{
this->type = type;
}
UserEvent(int type, int data1, int data2) : UserEvent(type) {
this->data1 = reinterpret_cast<void*>(data1);
this->data2 = reinterpret_cast<void*>(data2);
}
UserEvent(int type, int code) : UserEvent(type)
{
this->code = code;
}
UserEvent(int type, int data1, int data2) : UserEvent(type)
{
this->data1 = reinterpret_cast<void*>(data1);
this->data2 = reinterpret_cast<void*>(data2);
}
UserEvent(int type, void* data1) : UserEvent(type)
{
this->data1 = data1;
}
};
UserEvent(int type, void* data1) : UserEvent(type) {
this->data1 = data1;
}
};
}