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

KX_BlenderDevice.cpp

Go to the documentation of this file.
00001 // when embedded within Blender, here are some 'hook' functions
00002 // An alternative is using Glut routines, or for example Playstation 2 specific functionality
00003 // define BL_NO_EMBEDDED_ROUTINES to disable embedded blender usage
00004 
00005 
00006 #include "KX_BlenderDevice.h"
00007 
00008 #ifndef BL_NO_EMBEDDED_ROUTINES
00009 
00010 extern "C" int blender_timer();
00011 extern "C" int Gdfra;
00012 extern "C" int Gdfras;
00013 extern "C" int Gdfrao;
00014 
00015 extern "C" struct Global G;
00016 extern "C" short simulvals[256];
00017 extern "C" int update_time();
00018 extern "C" double tottime;
00019 extern "C" double speed_to_swaptime(int);
00020 extern "C" unsigned short screen_qread(short *val);
00021 extern "C" unsigned short qtest();
00022 extern "C" void set_dtime(int dtime);
00023 
00024 static double swaptime;
00025 #include "blender.h"
00026 #include "exports.h"
00027 
00028 #endif //BL_NO_EMBEDDED_ROUTINES
00029 
00030 
00031 #include "mydevice.h"
00032 
00033 // return 0 iff no event
00034 unsigned short BL_qtest()

00035 {
00036 #ifndef BL_NO_EMBEDDED_ROUTINES
00037         return qtest();
00038 #else
00039         return 1;
00040 #endif //BL_NO_EMBEDDED_ROUTINES
00041 
00042 }
00043 
00044 void BL_usleep(int millisec)

00045 {
00046         usleep(millisec);
00047 }
00048 
00049 void BL_UpdateKeyboard(unsigned short &event,short &val)

00050 {
00051 
00052 #ifndef BL_NO_EMBEDDED_ROUTINES
00053          event = screen_qread(&val);
00054                 if(event>20) {
00055                         simulvals[ event & 255 ] = val;
00056                 }
00057 #endif //BL_NO_EMBEDDED_ROUTINES
00058 
00059 }
00060 
00061 void BL_InitTime()

00062 {
00063 #ifndef BL_NO_EMBEDDED_ROUTINES
00064 
00065         update_time();
00066         tottime=0.0;
00067         swaptime=speed_to_swaptime(G.animspeed);
00068 #endif //BL_NO_EMBEDDED_ROUTINES
00069 }
00070 
00071 
00072 extern "C" int dbswaptime;      /* global in life.c, voor print */
00073 
00074 
00075 
00076 void BL_BeginTimeFrame(int dtime)

00077 {
00078 #ifndef BL_NO_EMBEDDED_ROUTINES
00079         Gdfrao= Gdfra;
00080                 
00081         G.fields=0;
00082                 
00083         set_dtime(dtime);       /* global in object.c, ook voor cameranet */
00084         dbswaptime= dtime;      
00085 #endif
00086 }
00087 
00088 int BL_UpdateGdfra()

00089 {
00090 #ifndef BL_NO_EMBEDDED_ROUTINES
00091         Gdfra++;
00092         Gdfras= Gdfra;
00093         //sectcount++;
00094 
00095         G.fields++;
00096         return (Gdfra & 1);             
00097 #else
00098         return 0;
00099 #endif 
00100 }
00101 
00102 /*
00103 int     BL_blender_timer()

00104 {

00105         return blender_timer();

00106 }

00107 
00108 */

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