oculus1

diff libovr/Src/Kernel/OVR_System.cpp @ 1:e2f9e4603129

added LibOVR and started a simple vr wrapper.
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 14 Sep 2013 16:14:59 +0300
parents
children b069a5c27388
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libovr/Src/Kernel/OVR_System.cpp	Sat Sep 14 16:14:59 2013 +0300
     1.3 @@ -0,0 +1,1 @@
     1.4 +/************************************************************************************
     1.5 
     1.6 Filename    :   OVR_System.cpp
     1.7 Content     :   General kernel initialization/cleanup, including that
     1.8                 of the memory allocator.
     1.9 Created     :   September 19, 2012
    1.10 Notes       : 
    1.11 
    1.12 Copyright   :   Copyright 2012 Oculus VR, Inc. All Rights reserved.
    1.13 
    1.14 Use of this software is subject to the terms of the Oculus license
    1.15 agreement provided at the time of installation or download, or which
    1.16 otherwise accompanies this software in either electronic or hard copy form.
    1.17 
    1.18 ************************************************************************************/
    1.19 
    1.20 #include "OVR_System.h"
    1.21 #include "OVR_Threads.h"
    1.22 #include "OVR_Timer.h"
    1.23 
    1.24 namespace OVR {
    1.25 
    1.26 // *****  OVR::System Implementation
    1.27 
    1.28 // Initializes System core, installing allocator.
    1.29 void System::Init(Log* log, Allocator *palloc)
    1.30 {    
    1.31     if (!Allocator::GetInstance())
    1.32     {
    1.33         Log::SetGlobalLog(log);
    1.34         Timer::initializeTimerSystem();
    1.35         Allocator::setInstance(palloc);
    1.36     }
    1.37     else
    1.38     {
    1.39         OVR_DEBUG_LOG(("System::Init failed - duplicate call."));
    1.40     }
    1.41 }
    1.42 
    1.43 void System::Destroy()
    1.44 {    
    1.45     if (Allocator::GetInstance())
    1.46     {
    1.47         // Wait for all threads to finish; this must be done so that memory
    1.48         // allocator and all destructors finalize correctly.
    1.49 #ifdef OVR_ENABLE_THREADS
    1.50         Thread::FinishAllThreads();
    1.51 #endif
    1.52 
    1.53         // Shutdown heap and destroy SysAlloc singleton, if any.
    1.54         Allocator::GetInstance()->onSystemShutdown();
    1.55         Allocator::setInstance(0);
    1.56 
    1.57         Timer::shutdownTimerSystem();
    1.58         Log::SetGlobalLog(Log::GetDefaultLog());
    1.59     }
    1.60     else
    1.61     {
    1.62         OVR_DEBUG_LOG(("System::Destroy failed - System not initialized."));
    1.63     }
    1.64 }
    1.65 
    1.66 // Returns 'true' if system was properly initialized.
    1.67 bool System::IsInitialized()
    1.68 {
    1.69     return Allocator::GetInstance() != 0;
    1.70 }
    1.71 
    1.72 } // OVR
    1.73 
    1.74 \ No newline at end of file