Created
September 17, 2012 04:17
-
-
Save yuya-oc/3735503 to your computer and use it in GitHub Desktop.
MRPT Event observer sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <mrpt/utils.h> | |
#include <mrpt/gui.h> | |
class EventObserver : public mrpt::utils::CObserver{ | |
protected: | |
virtual void OnEvent(const mrpt::utils::mrptEvent &e){ | |
if(e.isOfType<mrpt::gui::mrptEventMouseDown>()){ | |
const mrpt::gui::mrptEventMouseDown *ev = e.getAs<mrpt::gui::mrptEventMouseDown>(); | |
std::cout << ev->coords << std::endl; | |
} | |
} | |
}; | |
int main(){ | |
mrpt::gui::CDisplayWindow window("test window"); | |
EventObserver eventObs; | |
eventObs.observeBegin(window); | |
while(window.isOpen()); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment