diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-04-16 15:07:42 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-04-17 18:51:28 +0300 |
commit | 159806140fd33e6ddab951c0f6f180cfbf927d38 (patch) | |
tree | da076be3baa4d987fb5935e220a3d901c926e0e7 /source/gameengine/BlenderRoutines | |
parent | 28b996a9d2090efdd74115a653629ef9d7d871f7 (diff) |
Removing Blender Game Engine from Blender 2.8
Folders removed entirely:
* //extern/recastnavigation
* //intern/decklink
* //intern/moto
* //source/blender/editors/space_logic
* //source/blenderplayer
* //source/gameengine
This includes DNA data and any reference to the BGE code in Blender itself.
We are bumping the subversion.
Pending tasks:
* Tile/clamp code in image editor draw code.
* Viewport drawing code (so much of this will go away because of BI removal
that we can wait until then to remove this.
Diffstat (limited to 'source/gameengine/BlenderRoutines')
14 files changed, 0 insertions, 2216 deletions
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp deleted file mode 100644 index 4e8f0eba9b7..00000000000 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ /dev/null @@ -1,683 +0,0 @@ -/* - * ***** 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 ***** - * Blender's Ketsji startpoint - */ - -/** \file gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp - * \ingroup blroutines - */ - - -#include <signal.h> -#include <stdlib.h> -#include <stdio.h> - -#ifdef _MSC_VER - /* don't show stl-warnings */ -# pragma warning (disable:4786) -#endif - -#include "GPU_glew.h" - -#include "KX_BlenderCanvas.h" -#include "KX_BlenderKeyboardDevice.h" -#include "KX_BlenderMouseDevice.h" -#include "KX_BlenderSystem.h" -#include "BL_Material.h" - -#include "KX_KetsjiEngine.h" -#include "KX_BlenderSceneConverter.h" -#include "KX_PythonInit.h" -#include "KX_PyConstraintBinding.h" -#include "KX_PythonMain.h" - -#include "RAS_OpenGLRasterizer.h" -#include "RAS_ListRasterizer.h" - -#include "NG_LoopBackNetworkDeviceInterface.h" - -#include "BL_System.h" - -#include "GPU_extensions.h" -#include "EXP_Value.h" - - -extern "C" { - #include "DNA_object_types.h" - #include "DNA_view3d_types.h" - #include "DNA_screen_types.h" - #include "DNA_userdef_types.h" - #include "DNA_scene_types.h" - #include "DNA_windowmanager_types.h" - - #include "BKE_global.h" - #include "BKE_report.h" - #include "BKE_ipo.h" - #include "BKE_main.h" - #include "BKE_context.h" - #include "BKE_sound.h" - - /* avoid c++ conflict with 'new' */ - #define new _new - #include "BKE_screen.h" - #undef new - - #include "MEM_guardedalloc.h" - - #include "BLI_blenlib.h" - #include "BLO_readfile.h" - - #include "../../blender/windowmanager/WM_types.h" - #include "../../blender/windowmanager/wm_window.h" - -/* avoid more includes (not used by BGE) */ -typedef void * wmUIHandlerFunc; -typedef void * wmUIHandlerRemoveFunc; - - #include "../../blender/windowmanager/wm_event_system.h" -} - -#ifdef WITH_AUDASPACE -# include <AUD_Device.h> -#endif - -static BlendFileData *load_game_data(const char *filename) -{ - ReportList reports; - BlendFileData *bfd; - - BKE_reports_init(&reports, RPT_STORE); - bfd= BLO_read_from_file(filename, &reports, BLO_READ_SKIP_USERDEF); - - if (!bfd) { - printf("Loading %s failed: ", filename); - BKE_reports_print(&reports, RPT_ERROR); - } - - BKE_reports_clear(&reports); - - return bfd; -} - -static int BL_KetsjiNextFrame(KX_KetsjiEngine *ketsjiengine, bContext *C, wmWindow *win, Scene *scene, ARegion *ar, - KX_BlenderKeyboardDevice* keyboarddevice, KX_BlenderMouseDevice* mousedevice, int draw_letterbox) -{ - int exitrequested; - - // first check if we want to exit - exitrequested = ketsjiengine->GetExitCode(); - - // kick the engine - bool render = ketsjiengine->NextFrame(); - - if (render) { - if (draw_letterbox) { - // Clear screen to border color - // We do this here since we set the canvas to be within the frames. This means the engine - // itself is unaware of the extra space, so we clear the whole region for it. - glClearColor(scene->gm.framing.col[0], scene->gm.framing.col[1], scene->gm.framing.col[2], 1.0f); - glViewport(ar->winrct.xmin, ar->winrct.ymin, - BLI_rcti_size_x(&ar->winrct), BLI_rcti_size_y(&ar->winrct)); - glClear(GL_COLOR_BUFFER_BIT); - } - - // render the frame - ketsjiengine->Render(); - } - - wm_window_process_events_nosleep(); - - // test for the ESC key - //XXX while (qtest()) - while (wmEvent *event= (wmEvent *)win->queue.first) { - short val = 0; - //unsigned short event = 0; //XXX extern_qread(&val); - unsigned int unicode = event->utf8_buf[0] ? BLI_str_utf8_as_unicode(event->utf8_buf) : event->ascii; - - if (keyboarddevice->ConvertBlenderEvent(event->type, event->val, unicode)) - exitrequested = KX_EXIT_REQUEST_BLENDER_ESC; - - /* Coordinate conversion... where - * should this really be? - */ - if (event->type == MOUSEMOVE) { - /* Note, not nice! XXX 2.5 event hack */ - val = event->x - ar->winrct.xmin; - mousedevice->ConvertBlenderEvent(MOUSEX, val, 0); - - val = ar->winy - (event->y - ar->winrct.ymin) - 1; - mousedevice->ConvertBlenderEvent(MOUSEY, val, 0); - } - else { - mousedevice->ConvertBlenderEvent(event->type, event->val, 0); - } - - BLI_remlink(&win->queue, event); - wm_event_free(event); - } - - if (win != CTX_wm_window(C)) { - exitrequested= KX_EXIT_REQUEST_OUTSIDE; /* window closed while bge runs */ - } - return exitrequested; -} - - -#ifdef WITH_PYTHON -static struct BL_KetsjiNextFrameState { - class KX_KetsjiEngine* ketsjiengine; - struct bContext *C; - struct wmWindow* win; - struct Scene* scene; - struct ARegion *ar; - KX_BlenderKeyboardDevice* keyboarddevice; - KX_BlenderMouseDevice* mousedevice; - int draw_letterbox; -} ketsjinextframestate; - -static int BL_KetsjiPyNextFrame(void *state0) -{ - BL_KetsjiNextFrameState *state = (BL_KetsjiNextFrameState *) state0; - return BL_KetsjiNextFrame( - state->ketsjiengine, - state->C, - state->win, - state->scene, - state->ar, - state->keyboarddevice, - state->mousedevice, - state->draw_letterbox); -} -#endif - - -extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *cam_frame, int always_use_expand_framing) -{ - /* context values */ - struct wmWindowManager *wm= CTX_wm_manager(C); - struct wmWindow *win= CTX_wm_window(C); - struct Scene *startscene= CTX_data_scene(C); - struct Main* maggie1= CTX_data_main(C); - - - RAS_Rect area_rect; - area_rect.SetLeft(cam_frame->xmin); - area_rect.SetBottom(cam_frame->ymin); - area_rect.SetRight(cam_frame->xmax); - area_rect.SetTop(cam_frame->ymax); - - int exitrequested = KX_EXIT_REQUEST_NO_REQUEST; - Main* blenderdata = maggie1; - - char* startscenename = startscene->id.name+2; - char pathname[FILE_MAXDIR+FILE_MAXFILE], oldsce[FILE_MAXDIR+FILE_MAXFILE]; - STR_String exitstring = ""; - BlendFileData *bfd= NULL; - - BLI_strncpy(pathname, blenderdata->name, sizeof(pathname)); - BLI_strncpy(oldsce, G.main->name, sizeof(oldsce)); -#ifdef WITH_PYTHON - resetGamePythonPath(); // need this so running a second time wont use an old blendfiles path - setGamePythonPath(G.main->name); - - // Acquire Python's GIL (global interpreter lock) - // so we can safely run Python code and API calls - PyGILState_STATE gilstate = PyGILState_Ensure(); - - PyObject *pyGlobalDict = PyDict_New(); /* python utility storage, spans blend file loading */ -#endif - - // Globals to be carried on over blender files - GlobalSettings gs; - gs.matmode= startscene->gm.matmode; - gs.glslflag= startscene->gm.flag; - - do - { - View3D *v3d= CTX_wm_view3d(C); - RegionView3D *rv3d= CTX_wm_region_view3d(C); - - // get some preferences - SYS_SystemHandle syshandle = SYS_GetSystem(); - bool properties = (SYS_GetCommandLineInt(syshandle, "show_properties", 0) != 0); - bool usefixed = (SYS_GetCommandLineInt(syshandle, "fixedtime", 0) != 0); - bool profile = (SYS_GetCommandLineInt(syshandle, "show_profile", 0) != 0); - bool frameRate = (SYS_GetCommandLineInt(syshandle, "show_framerate", 0) != 0); - bool animation_record = (SYS_GetCommandLineInt(syshandle, "animation_record", 0) != 0); - bool displaylists = false; // (SYS_GetCommandLineInt(syshandle, "displaylists", 0) != 0) && GPU_display_list_support(); -#ifdef WITH_PYTHON - bool nodepwarnings = (SYS_GetCommandLineInt(syshandle, "ignore_deprecation_warnings", 0) != 0); -#endif - // bool novertexarrays = (SYS_GetCommandLineInt(syshandle, "novertexarrays", 0) != 0); - bool mouse_state = (startscene->gm.flag & GAME_SHOW_MOUSE) != 0; - bool restrictAnimFPS = (startscene->gm.flag & GAME_RESTRICT_ANIM_UPDATES) != 0; - - short drawtype = v3d->drawtype; - - /* we do not support material mode in game engine, force change to texture mode */ - if (drawtype == OB_MATERIAL) drawtype = OB_TEXTURE; - if (animation_record) usefixed= false; /* override since you don't want to run full-speed for sim recording */ - - // create the canvas and rasterizer - RAS_ICanvas* canvas = new KX_BlenderCanvas(wm, win, area_rect, ar); - - // default mouse state set on render panel - if (mouse_state) - canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL); - else - canvas->SetMouseState(RAS_ICanvas::MOUSE_INVISIBLE); - - // Setup vsync - int previous_vsync = 0; - canvas->GetSwapInterval(previous_vsync); - if (startscene->gm.vsync == VSYNC_ADAPTIVE) - canvas->SetSwapInterval(-1); - else - canvas->SetSwapInterval((startscene->gm.vsync == VSYNC_ON) ? 1 : 0); - - RAS_IRasterizer* rasterizer = NULL; - RAS_STORAGE_TYPE raster_storage = RAS_AUTO_STORAGE; - - if (startscene->gm.raster_storage == RAS_STORE_VBO) { - raster_storage = RAS_VBO; - } - else if (startscene->gm.raster_storage == RAS_STORE_VA) { - raster_storage = RAS_VA; - } - //Don't use displaylists with VBOs - //If auto starts using VBOs, make sure to check for that here - if (displaylists && raster_storage != RAS_VBO) - rasterizer = new RAS_ListRasterizer(canvas, true, raster_storage); - else - rasterizer = new RAS_OpenGLRasterizer(canvas, raster_storage); - - RAS_IRasterizer::MipmapOption mipmapval = rasterizer->GetMipmapping(); - - - // create the inputdevices - KX_BlenderKeyboardDevice* keyboarddevice = new KX_BlenderKeyboardDevice(); - KX_BlenderMouseDevice* mousedevice = new KX_BlenderMouseDevice(); - - // create a networkdevice - NG_NetworkDeviceInterface* networkdevice = new - NG_LoopBackNetworkDeviceInterface(); - - // - // create a ketsji/blendersystem (only needed for timing and stuff) - KX_BlenderSystem* kxsystem = new KX_BlenderSystem(); - - // create the ketsjiengine - KX_KetsjiEngine* ketsjiengine = new KX_KetsjiEngine(kxsystem); - - // set the devices - ketsjiengine->SetKeyboardDevice(keyboarddevice); - ketsjiengine->SetMouseDevice(mousedevice); - ketsjiengine->SetNetworkDevice(networkdevice); - ketsjiengine->SetCanvas(canvas); - ketsjiengine->SetRasterizer(rasterizer); - ketsjiengine->SetUseFixedTime(usefixed); - ketsjiengine->SetTimingDisplay(frameRate, profile, properties); - ketsjiengine->SetRestrictAnimationFPS(restrictAnimFPS); - ketsjiengine->SetRender(true); - KX_KetsjiEngine::SetExitKey(ConvertKeyCode(startscene->gm.exitkey)); - - //set the global settings (carried over if restart/load new files) - ketsjiengine->SetGlobalSettings(&gs); - -#ifdef WITH_PYTHON - CValue::SetDeprecationWarnings(nodepwarnings); -#endif - - //lock frame and camera enabled - storing global values - int tmp_lay= startscene->lay; - Object *tmp_camera = startscene->camera; - - if (v3d->scenelock==0) { - startscene->lay= v3d->lay; - startscene->camera= v3d->camera; - } - - // some blender stuff - float camzoom = 1.0f; - int draw_letterbox = 0; - - if (rv3d->persp==RV3D_CAMOB) { - if (startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) { /* Letterbox */ - draw_letterbox = 1; - } - else { - camzoom = 1.0f / BKE_screen_view3d_zoom_to_fac(rv3d->camzoom); - } - } - - rasterizer->SetDrawingMode(drawtype); - ketsjiengine->SetCameraZoom(camzoom); - ketsjiengine->SetCameraOverrideZoom(2.0f); - - // if we got an exitcode 3 (KX_EXIT_REQUEST_START_OTHER_GAME) load a different file - if (exitrequested == KX_EXIT_REQUEST_START_OTHER_GAME || exitrequested == KX_EXIT_REQUEST_RESTART_GAME) - { - exitrequested = KX_EXIT_REQUEST_NO_REQUEST; - if (bfd) BLO_blendfiledata_free(bfd); - - char basedpath[FILE_MAX]; - // base the actuator filename with respect - // to the original file working directory - - if (exitstring != "") - BLI_strncpy(basedpath, exitstring.ReadPtr(), sizeof(basedpath)); - - // load relative to the last loaded file, this used to be relative - // to the first file but that makes no sense, relative paths in - // blend files should be relative to that file, not some other file - // that happened to be loaded first - BLI_path_abs(basedpath, pathname); - bfd = load_game_data(basedpath); - - // if it wasn't loaded, try it forced relative - if (!bfd) - { - // just add "//" in front of it - char temppath[FILE_MAX] = "//"; - BLI_strncpy(temppath + 2, basedpath, FILE_MAX - 2); - - BLI_path_abs(temppath, pathname); - bfd = load_game_data(temppath); - } - - // if we got a loaded blendfile, proceed - if (bfd) - { - blenderdata = bfd->main; - startscenename = bfd->curscene->id.name + 2; - - if (blenderdata) { - BLI_strncpy(G.main->name, blenderdata->name, sizeof(G.main->name)); - BLI_strncpy(pathname, blenderdata->name, sizeof(pathname)); -#ifdef WITH_PYTHON - setGamePythonPath(G.main->name); -#endif - } - } - // else forget it, we can't find it - else - { - exitrequested = KX_EXIT_REQUEST_QUIT_GAME; - } - } - - Scene *scene= bfd ? bfd->curscene : (Scene *)BLI_findstring(&blenderdata->scene, startscenename, offsetof(ID, name) + 2); - - if (scene) - { - int startFrame = scene->r.cfra; - ketsjiengine->SetAnimRecordMode(animation_record, startFrame); - - // Quad buffered needs a special window. - if (scene->gm.stereoflag == STEREO_ENABLED) { - if (scene->gm.stereomode != RAS_IRasterizer::RAS_STEREO_QUADBUFFERED) - rasterizer->SetStereoMode((RAS_IRasterizer::StereoMode) scene->gm.stereomode); - - rasterizer->SetEyeSeparation(scene->gm.eyeseparation); - } - - rasterizer->SetBackColor(scene->gm.framing.col); - } - - if (exitrequested != KX_EXIT_REQUEST_QUIT_GAME) - { - if (rv3d->persp != RV3D_CAMOB) - { - ketsjiengine->EnableCameraOverride(startscenename); - ketsjiengine->SetCameraOverrideUseOrtho((rv3d->persp == RV3D_ORTHO)); - ketsjiengine->SetCameraOverrideProjectionMatrix(MT_CmMatrix4x4(rv3d->winmat)); - ketsjiengine->SetCameraOverrideViewMatrix(MT_CmMatrix4x4(rv3d->viewmat)); - ketsjiengine->SetCameraOverrideClipping(v3d->near, v3d->far); - ketsjiengine->SetCameraOverrideLens(v3d->lens); - } - - // create a scene converter, create and convert the startingscene - KX_ISceneConverter* sceneconverter = new KX_BlenderSceneConverter(blenderdata, ketsjiengine); - ketsjiengine->SetSceneConverter(sceneconverter); - if (always_use_expand_framing) - sceneconverter->SetAlwaysUseExpandFraming(true); - - sceneconverter->SetMaterials(true); - - if (gs.matmode == GAME_MAT_GLSL) - sceneconverter->SetGLSLMaterials(true); - if (scene->gm.flag & GAME_NO_MATERIAL_CACHING) - sceneconverter->SetCacheMaterials(false); - - KX_Scene* startscene = new KX_Scene(keyboarddevice, - mousedevice, - networkdevice, - startscenename, - scene, - canvas); - -#ifdef WITH_PYTHON - // some python things - PyObject *gameLogic, *gameLogic_keys; - setupGamePython(ketsjiengine, startscene, blenderdata, pyGlobalDict, &gameLogic, &gameLogic_keys, 0, NULL); -#endif // WITH_PYTHON - - //initialize Dome Settings - if (scene->gm.stereoflag == STEREO_DOME) - ketsjiengine->InitDome(scene->gm.dome.res, scene->gm.dome.mode, scene->gm.dome.angle, scene->gm.dome.resbuf, scene->gm.dome.tilt, scene->gm.dome.warptext); - - // initialize 3D Audio Settings - AUD_Device* device = BKE_sound_get_device(); - AUD_Device_setSpeedOfSound(device, scene->audio.speed_of_sound); - AUD_Device_setDopplerFactor(device, scene->audio.doppler_factor); - AUD_Device_setDistanceModel(device, AUD_DistanceModel(scene->audio.distance_model)); - - // from see blender.c: - // FIXME: this version patching should really be part of the file-reading code, - // but we still get too many unrelated data-corruption crashes otherwise... - if (blenderdata->versionfile < 250) - do_versions_ipos_to_animato(blenderdata); - - if (sceneconverter) - { - // convert and add scene - sceneconverter->ConvertScene( - startscene, - rasterizer, - canvas); - ketsjiengine->AddScene(startscene); - - // init the rasterizer - rasterizer->Init(); - - // start the engine - ketsjiengine->StartEngine(true); - - - // Set the animation playback rate for ipo's and actions - // the framerate below should patch with FPS macro defined in blendef.h - // Could be in StartEngine set the framerate, we need the scene to do this - ketsjiengine->SetAnimFrameRate(FPS); - -#ifdef WITH_PYTHON - char *python_main = NULL; - pynextframestate.state = NULL; - pynextframestate.func = NULL; - python_main = KX_GetPythonMain(scene); - - // the mainloop - printf("\nBlender Game Engine Started\n"); - if (python_main) { - char *python_code = KX_GetPythonCode(blenderdata, python_main); - if (python_code) { - // Set python environement variable. - KX_SetActiveScene(startscene); - PHY_SetActiveEnvironment(startscene->GetPhysicsEnvironment()); - - ketsjinextframestate.ketsjiengine = ketsjiengine; - ketsjinextframestate.C = C; - ketsjinextframestate.win = win; - ketsjinextframestate.scene = scene; - ketsjinextframestate.ar = ar; - ketsjinextframestate.keyboarddevice = keyboarddevice; - ketsjinextframestate.mousedevice = mousedevice; - ketsjinextframestate.draw_letterbox = draw_letterbox; - - pynextframestate.state = &ketsjinextframestate; - pynextframestate.func = &BL_KetsjiPyNextFrame; - printf("Yielding control to Python script '%s'...\n", python_main); - PyRun_SimpleString(python_code); - printf("Exit Python script '%s'\n", python_main); - MEM_freeN(python_code); - } - } - else -#endif /* WITH_PYTHON */ - { - while (!exitrequested) - { - exitrequested = BL_KetsjiNextFrame(ketsjiengine, C, win, scene, ar, keyboarddevice, mousedevice, draw_letterbox); - } - } - printf("Blender Game Engine Finished\n"); - exitstring = ketsjiengine->GetExitString(); -#ifdef WITH_PYTHON - if (python_main) MEM_freeN(python_main); -#endif /* WITH_PYTHON */ - - gs = *(ketsjiengine->GetGlobalSettings()); - - // when exiting the mainloop -#ifdef WITH_PYTHON - // Clears the dictionary by hand: - // This prevents, extra references to global variables - // inside the GameLogic dictionary when the python interpreter is finalized. - // which allows the scene to safely delete them :) - // see: (space.c)->start_game - - //PyDict_Clear(PyModule_GetDict(gameLogic)); - - // Keep original items, means python plugins will autocomplete members - PyObject *gameLogic_keys_new = PyDict_Keys(PyModule_GetDict(gameLogic)); - const Py_ssize_t numitems= PyList_GET_SIZE(gameLogic_keys_new); - Py_ssize_t listIndex; - for (listIndex=0; listIndex < numitems; listIndex++) { - PyObject *item = PyList_GET_ITEM(gameLogic_keys_new, listIndex); - if (!PySequence_Contains(gameLogic_keys, item)) { - PyDict_DelItem( PyModule_GetDict(gameLogic), item); - } - } - Py_DECREF(gameLogic_keys_new); - gameLogic_keys_new = NULL; -#endif - ketsjiengine->StopEngine(); -#ifdef WITH_PYTHON - exitGamePythonScripting(); -#endif - networkdevice->Disconnect(); - } - if (sceneconverter) - { - delete sceneconverter; - sceneconverter = NULL; - } - -#ifdef WITH_PYTHON - Py_DECREF(gameLogic_keys); - gameLogic_keys = NULL; -#endif - } - //lock frame and camera enabled - restoring global values - if (v3d->scenelock==0) { - startscene->lay= tmp_lay; - startscene->camera= tmp_camera; - } - - if (exitrequested != KX_EXIT_REQUEST_OUTSIDE) - { - // set the cursor back to normal - canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL); - - // set mipmap setting back to its original value - rasterizer->SetMipmapping(mipmapval); - } - - // clean up some stuff - if (ketsjiengine) - { - delete ketsjiengine; - ketsjiengine = NULL; - } - if (kxsystem) - { - delete kxsystem; - kxsystem = NULL; - } - if (networkdevice) - { - delete networkdevice; - networkdevice = NULL; - } - if (keyboarddevice) - { - delete keyboarddevice; - keyboarddevice = NULL; - } - if (mousedevice) - { - delete mousedevice; - mousedevice = NULL; - } - if (rasterizer) - { - delete rasterizer; - rasterizer = NULL; - } - if (canvas) - { - canvas->SetSwapInterval(previous_vsync); // Set the swap interval back - delete canvas; - canvas = NULL; - } - - // stop all remaining playing sounds - AUD_Device_stopAll(BKE_sound_get_device()); - - } while (exitrequested == KX_EXIT_REQUEST_RESTART_GAME || exitrequested == KX_EXIT_REQUEST_START_OTHER_GAME); - - if (bfd) BLO_blendfiledata_free(bfd); - - BLI_strncpy(G.main->name, oldsce, sizeof(G.main->name)); - -#ifdef WITH_PYTHON - PyDict_Clear(pyGlobalDict); - Py_DECREF(pyGlobalDict); - - // Release Python's GIL - PyGILState_Release(gilstate); -#endif - -} diff --git a/source/gameengine/BlenderRoutines/BL_System.cpp b/source/gameengine/BlenderRoutines/BL_System.cpp deleted file mode 100644 index 251182a07aa..00000000000 --- a/source/gameengine/BlenderRoutines/BL_System.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * ***** 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 deleted file mode 100644 index b9f51393f44..00000000000 --- a/source/gameengine/BlenderRoutines/BL_System.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * ***** 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 deleted file mode 100644 index 42293050753..00000000000 --- a/source/gameengine/BlenderRoutines/CMakeLists.txt +++ /dev/null @@ -1,78 +0,0 @@ - -set(INC - . - ../Converter - ../Expressions - ../GameLogic - ../Ketsji - ../Network - ../Network/LoopBackNetwork - ../Physics/Bullet - ../Physics/common - ../Rasterizer - ../Rasterizer/RAS_OpenGLRasterizer - ../SceneGraph - ../../blender - ../../blender/blenfont - ../../blender/blenkernel - ../../blender/blenlib - ../../blender/blenloader - ../../blender/editors/include - ../../blender/gpu - ../../blender/imbuf - ../../blender/makesdna - ../../blender/makesrna - ../../blender/windowmanager - ../../../intern/container - ../../../intern/glew-mx - ../../../intern/guardedalloc - ../../../intern/string -) - -set(INC_SYS - ../../../intern/moto/include - ${PTHREADS_INCLUDE_DIRS} - ${GLEW_INCLUDE_PATH} - ${BOOST_INCLUDE_DIR} -) - -set(SRC - BL_KetsjiEmbedStart.cpp - BL_System.cpp - KX_BlenderCanvas.cpp - KX_BlenderInputDevice.cpp - KX_BlenderKeyboardDevice.cpp - KX_BlenderMouseDevice.cpp - KX_BlenderSystem.cpp - - BL_System.h - KX_BlenderCanvas.h - KX_BlenderInputDevice.h - KX_BlenderKeyboardDevice.h - KX_BlenderMouseDevice.h - KX_BlenderSystem.h -) - -add_definitions(${GL_DEFINITIONS}) - -if(WITH_AUDASPACE) - add_definitions(-DWITH_AUDASPACE) - - list(APPEND INC_SYS - ${AUDASPACE_C_INCLUDE_DIRS} - ) -endif() - -if(WITH_CODEC_FFMPEG) - add_definitions(-DWITH_FFMPEG) -endif() - -if(WITH_BULLET) - list(APPEND INC_SYS - ${BULLET_INCLUDE_DIRS} - ) - add_definitions(-DWITH_BULLET) -endif() - - -blender_add_lib(ge_blen_routines "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp deleted file mode 100644 index 6fdc823ba1a..00000000000 --- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp +++ /dev/null @@ -1,352 +0,0 @@ -/* - * ***** 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 ***** - */ - -/** \file gameengine/BlenderRoutines/KX_BlenderCanvas.cpp - * \ingroup blroutines - */ - -#include "GPU_glew.h" - -#include "MEM_guardedalloc.h" - -#include "KX_BlenderCanvas.h" - -#include "DNA_screen_types.h" -#include "DNA_scene_types.h" -#include "DNA_windowmanager_types.h" - -#include "BKE_image.h" - -#include <assert.h> -#include <iostream> - -extern "C" { -#include "WM_api.h" -#include "wm_cursors.h" -#include "wm_window.h" -} - -KX_BlenderCanvas::KX_BlenderCanvas(wmWindowManager *wm, wmWindow *win, RAS_Rect &rect, struct ARegion *ar) : -m_wm(wm), -m_win(win), -m_frame_rect(rect) -{ - // initialize area so that it's available for game logic on frame 1 (ImageViewport) - m_area_rect = rect; - // area boundaries needed for mouse coordinates in Letterbox framing mode - m_area_left = ar->winrct.xmin; - m_area_top = ar->winrct.ymax; - m_frame = 1; - - glGetIntegerv(GL_VIEWPORT, (GLint *)m_viewport); -} - -KX_BlenderCanvas::~KX_BlenderCanvas() -{ -} - -void KX_BlenderCanvas::Init() -{ - glDepthFunc(GL_LEQUAL); -} - - -void KX_BlenderCanvas::SwapBuffers() -{ - wm_window_swap_buffers(m_win); -} - -void KX_BlenderCanvas::SetSwapInterval(int interval) -{ - wm_window_set_swap_interval(m_win, interval); -} - -bool KX_BlenderCanvas::GetSwapInterval(int &intervalOut) -{ - return wm_window_get_swap_interval(m_win, &intervalOut); -} - -void KX_BlenderCanvas::GetDisplayDimensions(int &width, int &height) -{ - wm_get_screensize(&width, &height); -} - -void KX_BlenderCanvas::ResizeWindow(int width, int height) -{ - // Not implemented for the embedded player -} - -void KX_BlenderCanvas::SetFullScreen(bool enable) -{ - // Not implemented for the embedded player -} - -bool KX_BlenderCanvas::GetFullScreen() -{ - // Not implemented for the embedded player - return false; -} - -bool KX_BlenderCanvas::BeginDraw() -{ - // in case of multi-window we need to ensure we are drawing to the correct - // window always, because it may change in window event handling - wm_window_make_drawable(m_wm, m_win); - return true; -} - - -void KX_BlenderCanvas::EndDraw() -{ - // nothing needs to be done here -} - -void KX_BlenderCanvas::BeginFrame() -{ - glEnable(GL_DEPTH_TEST); - glDepthFunc(GL_LEQUAL); -} - - -void KX_BlenderCanvas::EndFrame() -{ - glDisable(GL_FOG); -} - - - -void KX_BlenderCanvas::ClearColor(float r,float g,float b,float a) -{ - glClearColor(r,g,b,a); -} - - - -void KX_BlenderCanvas::ClearBuffer(int type) -{ - int ogltype = 0; - - if (type & RAS_ICanvas::COLOR_BUFFER ) - ogltype |= GL_COLOR_BUFFER_BIT; - - if (type & RAS_ICanvas::DEPTH_BUFFER ) - ogltype |= GL_DEPTH_BUFFER_BIT; - glClear(ogltype); -} - -int KX_BlenderCanvas::GetWidth( -) const { - return m_frame_rect.GetWidth(); -} - -int KX_BlenderCanvas::GetHeight( -) const { - return m_frame_rect.GetHeight(); -} - -int KX_BlenderCanvas::GetMouseX(int x) -{ - int left = GetWindowArea().GetLeft(); - return x - (left - m_area_left); -} - -int KX_BlenderCanvas::GetMouseY(int y) -{ - int top = GetWindowArea().GetTop(); - return y - (m_area_top - top); -} - -float KX_BlenderCanvas::GetMouseNormalizedX(int x) -{ - int can_x = GetMouseX(x); - return float(can_x)/this->GetWidth(); -} - -float KX_BlenderCanvas::GetMouseNormalizedY(int y) -{ - int can_y = GetMouseY(y); - return float(can_y)/this->GetHeight(); -} - -RAS_Rect & -KX_BlenderCanvas:: -GetWindowArea( -) { - return m_area_rect; -} - - void -KX_BlenderCanvas:: -SetViewPort( - int x1, int y1, - int x2, int y2 -) { - /* x1 and y1 are the min pixel coordinate (e.g. 0) - * x2 and y2 are the max pixel coordinate - * the width,height is calculated including both pixels - * therefore: max - min + 1 - */ - int vp_width = (x2 - x1) + 1; - int vp_height = (y2 - y1) + 1; - int minx = m_frame_rect.GetLeft(); - int miny = m_frame_rect.GetBottom(); - - m_area_rect.SetLeft(minx + x1); - m_area_rect.SetBottom(miny + y1); - m_area_rect.SetRight(minx + x2); - m_area_rect.SetTop(miny + y2); - - m_viewport[0] = minx+x1; - m_viewport[1] = miny+y1; - m_viewport[2] = vp_width; - m_viewport[3] = vp_height; - - glViewport(minx + x1, miny + y1, vp_width, vp_height); - glScissor(minx + x1, miny + y1, vp_width, vp_height); -} - - void -KX_BlenderCanvas:: -UpdateViewPort( - int x1, int y1, - int x2, int y2 -) { - m_viewport[0] = x1; - m_viewport[1] = y1; - m_viewport[2] = x2; - m_viewport[3] = y2; -} - - const int* -KX_BlenderCanvas:: -GetViewPort() { -#ifdef DEBUG - // If we're in a debug build, we might as well make sure our values don't differ - // from what the gpu thinks we have. This could lead to nasty, hard to find bugs. - int viewport[4]; - glGetIntegerv(GL_VIEWPORT, viewport); - assert(viewport[0] == m_viewport[0]); - assert(viewport[1] == m_viewport[1]); - assert(viewport[2] == m_viewport[2]); - assert(viewport[3] == m_viewport[3]); -#endif - - return m_viewport; -} - -void KX_BlenderCanvas::SetMouseState(RAS_MouseState mousestate) -{ - m_mousestate = mousestate; - - switch (mousestate) - { - case MOUSE_INVISIBLE: - { - WM_cursor_set(m_win, CURSOR_NONE); - break; - } - case MOUSE_WAIT: - { - WM_cursor_set(m_win, CURSOR_WAIT); - break; - } - case MOUSE_NORMAL: - { - WM_cursor_set(m_win, CURSOR_STD); - break; - } - default: - { - } - } -} - - - -// (0,0) is top left, (width,height) is bottom right -void KX_BlenderCanvas::SetMousePosition(int x,int y) -{ - int winX = m_frame_rect.GetLeft(); - int winY = m_frame_rect.GetBottom(); - int winH = m_frame_rect.GetHeight(); - - WM_cursor_warp(m_win, winX + x, winY + (winH-y)); -} - - -/* get shot from frontbuffer sort of a copy from screendump.c */ -static unsigned int *screenshot(ScrArea *curarea, int *dumpsx, int *dumpsy) -{ - int x=0, y=0; - unsigned int *dumprect= NULL; - - x= curarea->totrct.xmin; - y= curarea->totrct.ymin; - *dumpsx= curarea->totrct.xmax-x; - *dumpsy= curarea->totrct.ymax-y; - - if (*dumpsx && *dumpsy) { - - dumprect= (unsigned int *)MEM_mallocN(sizeof(int) * (*dumpsx) * (*dumpsy), "dumprect"); - glReadBuffer(GL_FRONT); - glReadPixels(x, y, *dumpsx, *dumpsy, GL_RGBA, GL_UNSIGNED_BYTE, dumprect); - glFinish(); - glReadBuffer(GL_BACK); - } - - return dumprect; -} - -void KX_BlenderCanvas::MakeScreenShot(const char *filename) -{ - ScrArea area_dummy= {0}; - unsigned int *dumprect; - int dumpsx, dumpsy; - - area_dummy.totrct.xmin = m_frame_rect.GetLeft(); - area_dummy.totrct.xmax = m_frame_rect.GetRight(); - area_dummy.totrct.ymin = m_frame_rect.GetBottom(); - area_dummy.totrct.ymax = m_frame_rect.GetTop(); - - dumprect = screenshot(&area_dummy, &dumpsx, &dumpsy); - if (!dumprect) { - std::cerr << "KX_BlenderCanvas: Unable to take screenshot!" << std::endl; - return; - } - - /* initialize image file format data */ - Scene *scene = WM_window_get_active_scene(m_win); - ImageFormatData *im_format = (ImageFormatData *)MEM_mallocN(sizeof(ImageFormatData), "im_format"); - - if (scene) - *im_format = scene->r.im_format; - else - BKE_imformat_defaults(im_format); - - /* save_screenshot() frees dumprect and im_format */ - save_screenshot(filename, dumpsx, dumpsy, dumprect, im_format); -} diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h deleted file mode 100644 index 6f408f86551..00000000000 --- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h +++ /dev/null @@ -1,222 +0,0 @@ -/* - * ***** 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 ***** - */ - -/** \file KX_BlenderCanvas.h - * \ingroup blroutines - */ - -#ifndef __KX_BLENDERCANVAS_H__ -#define __KX_BLENDERCANVAS_H__ - -#ifdef WIN32 -#include <windows.h> -#endif - -#include "RAS_ICanvas.h" -#include "RAS_Rect.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -struct ARegion; -struct wmWindow; -struct wmWindowManager; - -/** - * 2D Blender device context abstraction. - * The connection from 3d rendercontext to 2d Blender surface embedding. - */ - -class KX_BlenderCanvas : public RAS_ICanvas -{ -private: - /** - * Rect that defines the area used for rendering, - * relative to the context */ - RAS_Rect m_displayarea; - int m_viewport[4]; - -public: - /* Construct a new canvas. - * - * \param area The Blender ARegion to run the game within. - */ - KX_BlenderCanvas(struct wmWindowManager *wm, struct wmWindow* win, RAS_Rect &rect, struct ARegion* ar); - ~KX_BlenderCanvas(); - - void - Init( - ); - - void - SwapBuffers( - ); - - void - SetSwapInterval( - int interval - ); - - bool - GetSwapInterval( - int &intervalOut - ); - - void GetDisplayDimensions(int &width, int &height); - - void - ResizeWindow( - int width, - int height - ); - - void - SetFullScreen( - bool enable - ); - - bool - GetFullScreen(); - - void - BeginFrame( - ); - - void - EndFrame( - ); - - void - ClearColor( - float r, - float g, - float b, - float a - ); - - void - ClearBuffer( - int type - ); - - int - GetWidth( - ) const; - - int - GetHeight( - ) const; - - int - GetMouseX(int x - ); - - int - GetMouseY(int y - ); - - float - GetMouseNormalizedX(int x - ); - - float - GetMouseNormalizedY(int y - ); - - const - RAS_Rect & - GetDisplayArea( - ) const { - return m_displayarea; - }; - - void - SetDisplayArea(RAS_Rect *rect - ) { - m_displayarea= *rect; - }; - - RAS_Rect & - GetWindowArea( - ); - - void - SetViewPort( - int x1, int y1, - int x2, int y2 - ); - - void - UpdateViewPort( - int x1, int y1, - int x2, int y2 - ); - - const int* - GetViewPort(); - - void - SetMouseState( - RAS_MouseState mousestate - ); - - void - SetMousePosition( - int x, - int y - ); - - void - MakeScreenShot( - const char* filename - ); - - bool - BeginDraw( - ); - - void - EndDraw( - ); - -private: - /** Blender area the game engine is running within */ - struct wmWindowManager *m_wm; - struct wmWindow* m_win; - RAS_Rect m_frame_rect; - RAS_Rect m_area_rect; - int m_area_left; - int m_area_top; - - -#ifdef WITH_CXX_GUARDEDALLOC - MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_BlenderCanvas") -#endif -}; - -#endif /* __KX_BLENDERCANVAS_H__ */ diff --git a/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.cpp b/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.cpp deleted file mode 100644 index 8d224051df4..00000000000 --- a/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - * ***** 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 ***** - */ - -/** \file gameengine/BlenderRoutines/KX_BlenderInputDevice.cpp - * \ingroup blroutines - */ - -#include "KX_BlenderInputDevice.h" - diff --git a/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h b/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h deleted file mode 100644 index a936f328545..00000000000 --- a/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * ***** 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 ***** - */ - -/** \file KX_BlenderInputDevice.h - * \ingroup blroutines - */ - -#ifndef __KX_BLENDERINPUTDEVICE_H__ -#define __KX_BLENDERINPUTDEVICE_H__ - -#ifdef _MSC_VER -# pragma warning(disable:4786) // shut off 255 char limit debug template warning -#endif - -#include <map> - -#include "wm_event_types.h" -#include "WM_types.h" -#include "SCA_IInputDevice.h" -#include "BL_BlenderDataConversion.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -/** - * Base Class for Blender specific inputdevices. - * Blender specific inputdevices are used when the gameengine is running in embedded mode instead of standalone mode. - */ -class BL_BlenderInputDevice : public SCA_IInputDevice -{ -public: - BL_BlenderInputDevice() - { - } - - virtual ~BL_BlenderInputDevice() - { - - } - - KX_EnumInputs ToNative(unsigned short incode) { - return ConvertKeyCode(incode); - } - - virtual bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode)=0; - // virtual const SCA_InputEvent& GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode)=0; - virtual bool ConvertBlenderEvent(unsigned short incode, short val, unsigned int unicode)=0; - - -#ifdef WITH_CXX_GUARDEDALLOC - MEM_CXX_CLASS_ALLOC_FUNCS("GE:BL_BlenderInputDevice") -#endif -}; - -#endif /* __KX_BLENDERINPUTDEVICE_H__ */ diff --git a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp b/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp deleted file mode 100644 index ea78d2d389e..00000000000 --- a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/* - * ***** 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 ***** - */ - -/** \file gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp - * \ingroup blroutines - */ - - -#ifdef _MSC_VER - /* annoying warnings about truncated STL debug info */ -# pragma warning (disable:4786) -#endif - -#include "KX_BlenderKeyboardDevice.h" -#include "KX_KetsjiEngine.h" - -KX_BlenderKeyboardDevice::KX_BlenderKeyboardDevice() - : m_hookesc(false) -{ - -} -KX_BlenderKeyboardDevice::~KX_BlenderKeyboardDevice() -{ - -} - -/** - * IsPressed gives boolean information about keyboard status, true if pressed, false if not - */ - -bool KX_BlenderKeyboardDevice::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode) -{ - const SCA_InputEvent & inevent = m_eventStatusTables[m_currentTable][inputcode]; - bool pressed = (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || - inevent.m_status == SCA_InputEvent::KX_ACTIVE); - return pressed; -} -/*const SCA_InputEvent& KX_BlenderKeyboardDevice::GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode) -{ - return m_eventStatusTables[m_currentTable][inputcode]; -} -*/ -/** - * NextFrame toggles currentTable with previousTable, - * and copy relevant event information from previous to current - * (pressed keys need to be remembered) - */ -void KX_BlenderKeyboardDevice::NextFrame() -{ - SCA_IInputDevice::NextFrame(); - - // now convert justpressed keyevents into regular (active) keyevents - int previousTable = 1-m_currentTable; - for (int keyevent= KX_BEGINKEY; keyevent<= KX_ENDKEY;keyevent++) - { - SCA_InputEvent& oldevent = m_eventStatusTables[previousTable][keyevent]; - if (oldevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || - oldevent.m_status == SCA_InputEvent::KX_ACTIVE ) - { - m_eventStatusTables[m_currentTable][keyevent] = oldevent; - m_eventStatusTables[m_currentTable][keyevent].m_status = SCA_InputEvent::KX_ACTIVE; - } - } -} - -/** - * ConvertBlenderEvent translates blender keyboard events into ketsji kbd events - * extra event information is stored, like ramp-mode (just released/pressed) -*/ -bool KX_BlenderKeyboardDevice::ConvertBlenderEvent(unsigned short incode, short val, unsigned int unicode) -{ - bool result = false; - - // convert event - KX_EnumInputs kxevent = this->ToNative(incode); - - // only process it, if it's a key - if (kxevent >= KX_BEGINKEY && kxevent <= KX_ENDKEY) - { - int previousTable = 1-m_currentTable; - - if (val == KM_PRESS || val == KM_DBL_CLICK) - { - if (kxevent == KX_KetsjiEngine::GetExitKey() && val != 0 && !m_hookesc) - result = true; - if (kxevent == KX_PAUSEKEY && val && (IsPressed(KX_LEFTCTRLKEY) || IsPressed(KX_RIGHTCTRLKEY))) - result = true; - - // todo: convert val ?? - m_eventStatusTables[m_currentTable][kxevent].m_eventval = val ; //??? - m_eventStatusTables[m_currentTable][kxevent].m_unicode = unicode; - - switch (m_eventStatusTables[previousTable][kxevent].m_status) - { - case SCA_InputEvent::KX_JUSTACTIVATED: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_ACTIVE; - break; - } - case SCA_InputEvent::KX_ACTIVE: - - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_ACTIVE; - break; - } - case SCA_InputEvent::KX_NO_INPUTSTATUS: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED; - break; - } - default: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED; - } - } - - } else if (val == KM_RELEASE) - { - // blender eventval == 0 - switch (m_eventStatusTables[previousTable][kxevent].m_status) - { - case SCA_InputEvent::KX_JUSTACTIVATED: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTRELEASED; - break; - } - case SCA_InputEvent::KX_ACTIVE: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTRELEASED; - break; - } - default: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_NO_INPUTSTATUS; - } - } - } - } - return result; -} - -void KX_BlenderKeyboardDevice::HookEscape() -{ - m_hookesc = true; -} diff --git a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h b/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h deleted file mode 100644 index 10a5b00937d..00000000000 --- a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * ***** 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 ***** - */ - -/** \file KX_BlenderKeyboardDevice.h - * \ingroup blroutines - */ - -#ifndef __KX_BLENDERKEYBOARDDEVICE_H__ -#define __KX_BLENDERKEYBOARDDEVICE_H__ - -#include "KX_BlenderInputDevice.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -class KX_BlenderKeyboardDevice : public BL_BlenderInputDevice -{ - bool m_hookesc; -public: - KX_BlenderKeyboardDevice(); - virtual ~KX_BlenderKeyboardDevice(); - - virtual bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode); -// virtual const SCA_InputEvent& GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode); - virtual bool ConvertBlenderEvent(unsigned short incode, short val, unsigned int unicode); - virtual void NextFrame(); - virtual void HookEscape(); -private: - /* short m_exit_key; */ /* UNUSED */ - - -#ifdef WITH_CXX_GUARDEDALLOC - MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_BlenderKeyboardDevice") -#endif -}; - -#endif /* __KX_BLENDERKEYBOARDDEVICE_H__ */ diff --git a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp b/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp deleted file mode 100644 index 9df06e83b92..00000000000 --- a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp +++ /dev/null @@ -1,192 +0,0 @@ -/* - * ***** 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 ***** - */ - -/** \file gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp - * \ingroup blroutines - */ - -#ifdef _MSC_VER - /* annoying warnings about truncated STL debug info */ -# pragma warning (disable:4786) -#endif - -#include "KX_BlenderMouseDevice.h" - -KX_BlenderMouseDevice::KX_BlenderMouseDevice() -{ - -} -KX_BlenderMouseDevice::~KX_BlenderMouseDevice() -{ - -} - -/** - * IsPressed gives boolean information about mouse status, true if pressed, false if not - */ - -bool KX_BlenderMouseDevice::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode) -{ - const SCA_InputEvent & inevent = m_eventStatusTables[m_currentTable][inputcode]; - bool pressed = (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || - inevent.m_status == SCA_InputEvent::KX_ACTIVE); - return pressed; -} -/*const SCA_InputEvent& KX_BlenderMouseDevice::GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode) -{ - return m_eventStatusTables[m_currentTable][inputcode]; -} -*/ - -/** - * NextFrame toggles currentTable with previousTable, - * and copy relevant event information from previous to current - * (pressed keys need to be remembered) - */ -void KX_BlenderMouseDevice::NextFrame() -{ - SCA_IInputDevice::NextFrame(); - - // now convert justpressed keyevents into regular (active) keyevents - int previousTable = 1-m_currentTable; - for (int mouseevent= KX_BEGINMOUSE; mouseevent< KX_ENDMOUSEBUTTONS;mouseevent++) - { - SCA_InputEvent& oldevent = m_eventStatusTables[previousTable][mouseevent]; - if (oldevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || - oldevent.m_status == SCA_InputEvent::KX_ACTIVE ) - { - m_eventStatusTables[m_currentTable][mouseevent] = oldevent; - m_eventStatusTables[m_currentTable][mouseevent].m_status = SCA_InputEvent::KX_ACTIVE; - } - } - for (int mousemove= KX_ENDMOUSEBUTTONS; mousemove< KX_ENDMOUSE;mousemove++) - { - SCA_InputEvent& oldevent = m_eventStatusTables[previousTable][mousemove]; - m_eventStatusTables[m_currentTable][mousemove] = oldevent; - if (oldevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || - oldevent.m_status == SCA_InputEvent::KX_ACTIVE ) - { - - m_eventStatusTables[m_currentTable][mousemove].m_status = SCA_InputEvent::KX_JUSTRELEASED; - } else - { - if (oldevent.m_status == SCA_InputEvent::KX_JUSTRELEASED) - { - - m_eventStatusTables[m_currentTable][mousemove].m_status = SCA_InputEvent::KX_NO_INPUTSTATUS; - } - } - } -} - - -/** - * ConvertBlenderEvent translates blender mouse events into ketsji kbd events - * extra event information is stored, like ramp-mode (just released/pressed) - */ -bool KX_BlenderMouseDevice::ConvertBlenderEvent(unsigned short incode, short val, unsigned int unicode) -{ - bool result = false; - - // convert event - KX_EnumInputs kxevent = this->ToNative(incode); - int previousTable = 1-m_currentTable; - - // only process it, if it's a key - if (kxevent > KX_BEGINMOUSE && kxevent < KX_ENDMOUSEBUTTONS) - { - if (val == KM_PRESS || val == KM_DBL_CLICK) - { - m_eventStatusTables[m_currentTable][kxevent].m_eventval = val ; //??? - - switch (m_eventStatusTables[previousTable][kxevent].m_status) - { - - case SCA_InputEvent::KX_ACTIVE: - case SCA_InputEvent::KX_JUSTACTIVATED: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_ACTIVE; - break; - } - case SCA_InputEvent::KX_JUSTRELEASED: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED; - break; - } - default: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED; - } - } - - } else if (val == KM_RELEASE) - { - // blender eventval == 0 - switch (m_eventStatusTables[previousTable][kxevent].m_status) - { - case SCA_InputEvent::KX_JUSTACTIVATED: - case SCA_InputEvent::KX_ACTIVE: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTRELEASED; - break; - } - default: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_NO_INPUTSTATUS; - } - } - } - } - - if (kxevent > KX_ENDMOUSEBUTTONS && kxevent < KX_ENDMOUSE) - { - m_eventStatusTables[m_currentTable][kxevent].m_eventval = val ; //remember mouse position - - switch (m_eventStatusTables[previousTable][kxevent].m_status) - { - - case SCA_InputEvent::KX_ACTIVE: - case SCA_InputEvent::KX_JUSTACTIVATED: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_ACTIVE; - break; - } - case SCA_InputEvent::KX_JUSTRELEASED: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_ACTIVE; - break; - } - default: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED; - } - } - } - - - return result; -} diff --git a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.h b/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.h deleted file mode 100644 index 04b78aff05c..00000000000 --- a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * ***** 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 ***** - */ - -/** \file KX_BlenderMouseDevice.h - * \ingroup blroutines - */ - -#ifndef __KX_BLENDERMOUSEDEVICE_H__ -#define __KX_BLENDERMOUSEDEVICE_H__ - -#include "KX_BlenderInputDevice.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -class KX_BlenderMouseDevice : public BL_BlenderInputDevice -{ -public: - KX_BlenderMouseDevice(); - virtual ~KX_BlenderMouseDevice(); - - virtual bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode); -// virtual const SCA_InputEvent& GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode); - virtual bool ConvertBlenderEvent(unsigned short incode, short val, unsigned int unicode); - virtual void NextFrame(); - - -#ifdef WITH_CXX_GUARDEDALLOC - MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_BlenderMouseDevice") -#endif -}; - -#endif /* __KX_BLENDERMOUSEDEVICE_H__ */ diff --git a/source/gameengine/BlenderRoutines/KX_BlenderSystem.cpp b/source/gameengine/BlenderRoutines/KX_BlenderSystem.cpp deleted file mode 100644 index 0582e79d269..00000000000 --- a/source/gameengine/BlenderRoutines/KX_BlenderSystem.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * ***** 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 ***** - */ - -/** \file gameengine/BlenderRoutines/KX_BlenderSystem.cpp - * \ingroup blroutines - */ - - -#include "KX_ISystem.h" - -#ifdef _MSC_VER -# pragma warning (disable:4786) -#endif - -#ifdef WIN32 -#include <windows.h> -#endif - -#include <iostream> -#include <stdio.h> -#include "KX_BlenderInputDevice.h" -#include "KX_BlenderSystem.h" - -#include "PIL_time.h" - -KX_BlenderSystem::KX_BlenderSystem() -: KX_ISystem() -{ - m_starttime = PIL_check_seconds_timer(); -} - -double KX_BlenderSystem::GetTimeInSeconds() -{ - return PIL_check_seconds_timer() - m_starttime; -} diff --git a/source/gameengine/BlenderRoutines/KX_BlenderSystem.h b/source/gameengine/BlenderRoutines/KX_BlenderSystem.h deleted file mode 100644 index 0867ef2421f..00000000000 --- a/source/gameengine/BlenderRoutines/KX_BlenderSystem.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * ***** 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 ***** - */ - -/** \file KX_BlenderSystem.h - * \ingroup blroutines - * \brief Blender System embedding. Needed when gameengine runs embedded within Blender. - */ - -#ifndef __KX_BLENDERSYSTEM_H__ -#define __KX_BLENDERSYSTEM_H__ - -#include "KX_ISystem.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -class KX_BlenderSystem : public KX_ISystem -{ - double m_starttime; - -public: - KX_BlenderSystem(); - virtual ~KX_BlenderSystem() {} - virtual double GetTimeInSeconds(); - -#ifdef WITH_CXX_GUARDEDALLOC - MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_BlenderSystem") -#endif -}; - -#endif /* __KX_BLENDERSYSTEM_H__ */ |