better event handling

This commit is contained in:
Jack Andersen
2015-04-22 11:48:23 -10:00
parent edaebc5e50
commit c1dc218bd1
12 changed files with 85 additions and 45 deletions

View File

@@ -3,11 +3,30 @@
#include <stdio.h>
#include <boo.hpp>
class CTestDeviceFinder : public CDeviceFinder
{
CDolphinSmashAdapter* smashAdapter = NULL;
public:
CTestDeviceFinder()
: CDeviceFinder(DEV_DOL_SMASH_ADAPTER)
{}
void deviceConnected(CDeviceToken& tok)
{
printf("CONNECTED %s %s\n", tok.getVendorName().c_str(), tok.getProductName().c_str());
smashAdapter = dynamic_cast<CDolphinSmashAdapter*>(tok.openAndGetDevice());
}
void deviceDisconnected(CDeviceToken& tok)
{
printf("DISCONNECTED %s %s\n", tok.getVendorName().c_str(), tok.getProductName().c_str());
delete smashAdapter;
smashAdapter = NULL;
}
};
int main(int argc, char** argv)
{
CDeviceFinder finder(DEV_DOL_SMASH_ADAPTER);
CDeviceToken& smashToken = finder.getTokens().begin()->second;
CDolphinSmashAdapter* smashAdapter = dynamic_cast<CDolphinSmashAdapter*>(smashToken.openAndGetDevice());
CTestDeviceFinder finder;
finder.startScanning();
IGraphicsContext* ctx = new CGraphicsContext;