00001 /************************************************************************************ 00002 00003 Filename : Platform.cpp 00004 Content : Platform-independent app framework for Oculus samples 00005 Created : September 6, 2012 00006 Authors : Andrew Reisse 00007 00008 Copyright : Copyright 2012 Oculus VR, Inc. All Rights reserved. 00009 00010 Licensed under the Apache License, Version 2.0 (the "License"); 00011 you may not use this file except in compliance with the License. 00012 You may obtain a copy of the License at 00013 00014 http://www.apache.org/licenses/LICENSE-2.0 00015 00016 Unless required by applicable law or agreed to in writing, software 00017 distributed under the License is distributed on an "AS IS" BASIS, 00018 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00019 See the License for the specific language governing permissions and 00020 limitations under the License. 00021 00022 ************************************************************************************/ 00023 00024 00025 00026 #include "Platform.h" 00027 #include <Kernel/OVR_Std.h> 00028 #include <Kernel/OVR_Timer.h> 00029 #include "../Render/Render_Device.h" 00030 #include "Gamepad.h" 00031 00032 namespace OVR { namespace Platform { 00033 00034 00035 const SetupGraphicsDeviceSet* SetupGraphicsDeviceSet::PickSetupDevice(const char* typeArg) const 00036 { 00037 // Search for graphics creation object that matches type arg. 00038 if (typeArg) 00039 { 00040 for (const SetupGraphicsDeviceSet* p = this; p != 0; p = p->pNext) 00041 { 00042 if (!OVR_stricmp(p->pTypeArg, typeArg)) 00043 return p; 00044 } 00045 } 00046 return this; 00047 } 00048 00049 //------------------------------------------------------------------------------------- 00050 00051 PlatformCore::PlatformCore(Application *app) 00052 { 00053 pApp = app; 00054 pApp->SetPlatformCore(this); 00055 StartupTicks = OVR::Timer::GetTicks(); 00056 } 00057 00058 double PlatformCore::GetAppTime() const 00059 { 00060 return (OVR::Timer::GetTicks() - StartupTicks) * (1.0 / (double)OVR::Timer::MksPerSecond); 00061 } 00062 00063 bool PlatformCore::SetFullscreen(const Render::RendererParams&, int fullscreen) 00064 { 00065 if (pRender) 00066 return pRender->SetFullscreen((Render::DisplayMode)fullscreen); 00067 return 0; 00068 } 00069 00070 Render::DisplayId PlatformCore::GetDisplay(int screen) 00071 { 00072 OVR_UNUSED(screen); return Render::DisplayId(); 00073 } 00074 00075 }}