Added events

This commit is contained in:
Robert 2020-06-15 21:49:10 +02:00
parent 9ce9cd3432
commit fd43b8917c
3 changed files with 21 additions and 1 deletions

View file

@ -4,6 +4,12 @@
using namespace sf;
int Callback(void* userdata, SDL_Event* event)
{
std::cout << event->type << std::endl;
return 0;
}
class MyWindow : public IWindow
{
public:
@ -27,7 +33,7 @@ private:
virtual bool OnUpdate(double frametime) override
{
printf("Frame took %f seconds\n", frametime);
SDL_SetWindowTitle(m_pWindow, std::to_string(frametime).c_str());
return true;
}
};
@ -37,6 +43,7 @@ int main(int argc, char* argv[])
SDL_Init(SDL_INIT_VIDEO);
MyWindow window;
window.AddEventCallback(Callback, nullptr);
try
{