Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

KetsjiEntry.cpp

Go to the documentation of this file.
00001 //Ketsji
00002 //K  X
00003 // initial version by Erwin Coumans
00004 // Version: $Id: KetsjiEntry_cpp-source.html,v 1.2 2001/02/01 12:25:07 coockie Exp $
00005 
00006 #pragma warning (disable :4786)
00007 
00008 #include "KX_BlenderCanvas.h"
00009 #include "KX_BlenderRenderTools.h"
00010 #include "KX_KetsjiEngine.h"
00011 #include "KX_BlenderGL.h"
00012 #include "KX_BlenderDevice.h"
00013 #include "BL_BlenderDataConversion.h"
00014 #include "KX_BlenderKeyboardDevice.h"
00015 #include "KX_BlenderMouseDevice.h"
00016 #include "SM_Scene.h"
00017 #include "KX_Scene.h"
00018 #include "KX_PythonInit.h"
00019 #include "KX_BlenderClientObject.h"
00020 #include "KX_Camera.h"
00021 
00025 
00026 extern "C" int Ketsji_Start1(Global* glob,ScrArea *curarea)

00027 {
00028         bool bRestoreSituation=true;
00029 
00030         // save some state variables that blender needs
00031         BL_SaveState();
00032         
00033         BL_InitSectorVisibility();
00034         
00035         KX_BlenderKeyboardDevice* keyinputdev   =               new KX_BlenderKeyboardDevice();
00036         KX_BlenderMouseDevice* mouseinputdev    =               new KX_BlenderMouseDevice();
00037 
00038         SCA_ISystem* kxsystem           =               NewKX_System();
00039         
00040         kxsystem->SetKeyboardDevice(keyinputdev);
00041         kxsystem->SetMouseDevice(mouseinputdev);
00042         
00043         // other devices can be added by:
00044         //kxsystem->AddInputDevice(inputdev);
00045                 
00046         KX_KetsjiEngine* ketsjieng      =               new KX_KetsjiEngine(kxsystem);
00047 
00048         
00049         KX_Scene* kxscene = new KX_Scene(kxsystem);
00050         ketsjieng->SetScene(kxscene);
00051 
00052         // create a 2D canvas, that is embedded within Blender
00053         RAS_ICanvas* canvas = new KX_BlenderCanvas();
00054 
00055         /* Fire up python hooks */
00056         PyObject* dictobj = initGamePythonScripting("Ketsji");
00057         initGameLogic();
00058         initGameKeys();
00059         initRasterizer(canvas);
00060         
00061         BL_ConvertBlenderObjects(glob,kxscene,dictobj,keyinputdev);
00062 
00063 
00064         RAS_IRenderTools* rendertools = new KX_BlenderRenderTools();
00065 
00066         if (ketsjieng->Init(glob,curarea,canvas,rendertools))
00067         {
00068                 BL_InitTime();
00069                 ketsjieng->Run();
00070         }
00071 
00072         // shutdown all gameengine submodules, and give control back to blender
00073         ketsjieng->Exit();
00074 
00075         // release the memory
00076         delete kxscene;
00077         delete ketsjieng;
00078         delete kxsystem;
00079         delete keyinputdev;
00080         delete mouseinputdev;
00081         
00082         // clears meshes, and hashmaps from blender to gameengine data
00083         BL_ClearConvert();
00084 
00085         exitGamePythonScripting();
00086                 
00087         BL_ExitSectorVisibility(bRestoreSituation);
00088 
00089         BL_RestoreState();
00090 
00091         return 1969;
00092 }
00093 
00094 
00095 
00096 

Generated at Thu Feb 1 13:03:03 2001 for Ketsji Game Engine by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000