Blender V2.61 - r43446

GHOST_ISystem.cpp

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00040 #include "GHOST_ISystem.h"
00041 
00042 #ifdef WITH_HEADLESS
00043 #   include "GHOST_SystemNULL.h"
00044 #elif defined(WITH_GHOST_SDL)
00045 #   include "GHOST_SystemSDL.h"
00046 #elif defined(WIN32)
00047 #   include "GHOST_SystemWin32.h"
00048 #else
00049 #   ifdef __APPLE__
00050 #       ifdef GHOST_COCOA
00051 #           include "GHOST_SystemCocoa.h"
00052 #       else
00053 #           include "GHOST_SystemCarbon.h"
00054 #       endif
00055 #   else
00056 #       include "GHOST_SystemX11.h"
00057 #   endif
00058 #endif
00059 
00060 
00061 GHOST_ISystem* GHOST_ISystem::m_system = 0;
00062 
00063 
00064 GHOST_TSuccess GHOST_ISystem::createSystem()
00065 {
00066     GHOST_TSuccess success;
00067     if (!m_system) {
00068 #ifdef WITH_HEADLESS
00069         m_system = new GHOST_SystemNULL();
00070 #elif defined(WITH_GHOST_SDL)
00071         m_system = new GHOST_SystemSDL();
00072 #elif defined(WIN32)
00073         m_system = new GHOST_SystemWin32 ();
00074 #else
00075 #   ifdef __APPLE__
00076 #       ifdef GHOST_COCOA
00077             m_system = new GHOST_SystemCocoa ();
00078 #       else
00079             m_system = new GHOST_SystemCarbon ();
00080 #       endif
00081 #   else 
00082         m_system = new GHOST_SystemX11 ();
00083 #   endif
00084 #endif 
00085         success = m_system != 0 ? GHOST_kSuccess : GHOST_kFailure;
00086     }
00087     else {
00088         success = GHOST_kFailure;
00089     }
00090     if (success) {
00091         success = m_system->init();
00092     }
00093     return success;
00094 }
00095 
00096 GHOST_TSuccess GHOST_ISystem::disposeSystem()
00097 {
00098     GHOST_TSuccess success = GHOST_kSuccess;
00099     if (m_system) {
00100         delete m_system;
00101         m_system = 0;
00102     }
00103     else {
00104         success = GHOST_kFailure;
00105     }
00106     return success;
00107 }
00108 
00109 
00110 GHOST_ISystem* GHOST_ISystem::getSystem()
00111 {
00112     return m_system;
00113 }
00114