int WINAPI WinMain(HINSTANCE hinst, HINSTANCE, LPSTR inArgs, int)
{
    int exitCode = 0;

    // Initializes LibOVR. This LogMask_All enables maximum logging.
    // Custom allocator can also be specified here.
    OVR::System::Init(OVR::Log::ConfigureDefaultLog(OVR::LogMask_All));

    // Scope to force application destructire before System::Destroy.
    {
        OculusRoomTinyApp app(hinst);
        //app.hInstance = hinst;

        exitCode = app.OnStartup(inArgs);
        if (!exitCode)
        {
            // Processes messages and calls OnIdle() to do rendering.
            exitCode = app.Run();
        }
    }

    // No OVR functions involving memory are allowed after this.
    OVR::System::Destroy();
  
    OVR_DEBUG_STATEMENT(_CrtDumpMemoryLeaks());
    return exitCode;
}
Oculus::~Oculus()
{
	OVR::MessageHandler::RemoveHandlerFromDevices();
	m_sensor.Clear();
	m_HMD.Clear();
	m_device_manager.Clear();
		
	OVR::System::Destroy();
	OVR_DEBUG_STATEMENT(_CrtDumpMemoryLeaks());
}