diff options
Diffstat (limited to 'source/gameengine/BlenderRoutines')
-rw-r--r-- | source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp | 2 | ||||
-rw-r--r-- | source/gameengine/BlenderRoutines/BL_System.cpp | 104 | ||||
-rw-r--r-- | source/gameengine/BlenderRoutines/BL_System.h | 72 | ||||
-rw-r--r-- | source/gameengine/BlenderRoutines/CMakeLists.txt | 4 | ||||
-rw-r--r-- | source/gameengine/BlenderRoutines/SConscript | 4 |
5 files changed, 182 insertions, 4 deletions
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index b94d15d2fbf..571cc9087b3 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -64,7 +64,7 @@ #include "NG_LoopBackNetworkDeviceInterface.h" -#include "SYS_System.h" +#include "BL_System.h" #include "GPU_extensions.h" #include "Value.h" diff --git a/source/gameengine/BlenderRoutines/BL_System.cpp b/source/gameengine/BlenderRoutines/BL_System.cpp new file mode 100644 index 00000000000..30b8beef156 --- /dev/null +++ b/source/gameengine/BlenderRoutines/BL_System.cpp @@ -0,0 +1,104 @@ +/* + * $Id$ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + * Interface to the commandline arguments + */ + +/** \file gameengine/BlenderRoutines/BL_System.cpp + * \ingroup blroutines + */ + +#include "CTR_Map.h" +#include "STR_HashedString.h" +#include "BL_System.h" + +struct SingletonSystem { + CTR_Map<STR_HashedString,int> int_params; + CTR_Map<STR_HashedString,float> float_params; + CTR_Map<STR_HashedString,STR_String> string_params; +}; + +static SingletonSystem *_system_instance = NULL; + +SYS_SystemHandle SYS_GetSystem() +{ + if(!_system_instance) + _system_instance = new SingletonSystem(); + + return (SYS_SystemHandle)_system_instance; +} + +void SYS_DeleteSystem(SYS_SystemHandle sys) +{ + if(_system_instance) { + delete _system_instance; + _system_instance = NULL; + } +} + +int SYS_GetCommandLineInt(SYS_SystemHandle sys, const char *paramname, int defaultvalue) +{ + int *result = ((SingletonSystem *)sys)->int_params[paramname]; + if(result) + return *result; + + return defaultvalue; +} + +float SYS_GetCommandLineFloat(SYS_SystemHandle sys, const char *paramname, float defaultvalue) +{ + float *result = ((SingletonSystem *)sys)->float_params[paramname]; + if(result) + return *result; + + return defaultvalue; +} + +const char *SYS_GetCommandLineString(SYS_SystemHandle sys, const char *paramname, const char *defaultvalue) +{ + STR_String *result = ((SingletonSystem *)sys)->string_params[paramname]; + if(result) + return *result; + + return defaultvalue; +} + +void SYS_WriteCommandLineInt(SYS_SystemHandle sys, const char *paramname, int value) +{ + ((SingletonSystem *)sys)->int_params.insert(paramname, value); +} + +void SYS_WriteCommandLineFloat(SYS_SystemHandle sys, const char *paramname, float value) +{ + ((SingletonSystem *)sys)->float_params.insert(paramname, value); +} + +void SYS_WriteCommandLineString(SYS_SystemHandle sys, const char *paramname, const char *value) +{ + ((SingletonSystem *)sys)->string_params.insert(paramname, value); +} + diff --git a/source/gameengine/BlenderRoutines/BL_System.h b/source/gameengine/BlenderRoutines/BL_System.h new file mode 100644 index 00000000000..d743ef5532a --- /dev/null +++ b/source/gameengine/BlenderRoutines/BL_System.h @@ -0,0 +1,72 @@ +/* + * $Id$ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + * System specific information / access. + * Interface to the commandline arguments + */ + +/** \file gameengine/BlenderRoutines/BL_System.h + * \ingroup blroutines + */ + +#ifndef BL_SYSTEM_H +#define BL_SYSTEM_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Game Engine command line parameters */ + +typedef void* SYS_SystemHandle; + +extern SYS_SystemHandle SYS_GetSystem(void); +extern void SYS_DeleteSystem(SYS_SystemHandle sys); + +extern int SYS_GetCommandLineInt(SYS_SystemHandle sys, const char *paramname, int defaultvalue); +extern float SYS_GetCommandLineFloat(SYS_SystemHandle sys, const char *paramname, float defaultvalue); +extern const char *SYS_GetCommandLineString(SYS_SystemHandle sys, const char *paramname, const char *defaultvalue); + +extern void SYS_WriteCommandLineInt(SYS_SystemHandle sys, const char *paramname, int value); +extern void SYS_WriteCommandLineFloat(SYS_SystemHandle sys, const char *paramname, float value); +extern void SYS_WriteCommandLineString(SYS_SystemHandle sys, const char *paramname, const char *value); + +/* Start game engine */ + +struct bContext; +struct ARegion; +struct rcti; + +extern void StartKetsjiShell(struct bContext *C, struct ARegion *ar, + struct rcti *cam_frame, int always_use_expand_framing); + +#ifdef __cplusplus +} +#endif + +#endif /* BL_SYSTEM_H */ + diff --git a/source/gameengine/BlenderRoutines/CMakeLists.txt b/source/gameengine/BlenderRoutines/CMakeLists.txt index f5103034316..6a17017f261 100644 --- a/source/gameengine/BlenderRoutines/CMakeLists.txt +++ b/source/gameengine/BlenderRoutines/CMakeLists.txt @@ -1,8 +1,8 @@ set(INC . - ../../../source/kernel/gen_system ../../../intern/string + ../../../intern/container ../../../intern/guardedalloc ../../../intern/audaspace/intern ../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer @@ -34,6 +34,7 @@ set(INC set(SRC BL_KetsjiEmbedStart.cpp + BL_System.cpp KX_BlenderCanvas.cpp KX_BlenderGL.cpp KX_BlenderInputDevice.cpp @@ -42,6 +43,7 @@ set(SRC KX_BlenderRenderTools.cpp KX_BlenderSystem.cpp + BL_System.h KX_BlenderCanvas.h KX_BlenderGL.h KX_BlenderInputDevice.h diff --git a/source/gameengine/BlenderRoutines/SConscript b/source/gameengine/BlenderRoutines/SConscript index ff70ad3bf7b..8f59ec0bf04 100644 --- a/source/gameengine/BlenderRoutines/SConscript +++ b/source/gameengine/BlenderRoutines/SConscript @@ -4,10 +4,10 @@ Import ('env') sources = env.Glob('*.cpp') defs = [ 'GLEW_STATIC' ] -incs = '. #source/kernel/gen_system #intern/string #intern/guardedalloc' +incs = '. #intern/string #intern/guardedalloc' incs += ' #source/gameengine/Rasterizer/RAS_OpenGLRasterizer' incs += ' #source/gameengine/Converter #source/blender/imbuf' -incs += ' #intern/ghost/include' +incs += ' #intern/ghost/include #intern/container' incs += ' #intern/audaspace/intern' incs += ' #intern/moto/include #source/gameengine/Ketsji #source/blender/blenlib' incs += ' #source/blender/blenkernel #source/blender' |