diff options
author | Chris Xiong <chirs241097@gmail.com> | 2015-10-05 23:49:07 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2015-10-05 23:49:07 +0800 |
commit | 7f6e5a022b800af0a2f7ab502743805e6fbc448c (patch) | |
tree | 6a96d4b0d49fc0f0325dc26661cbfc6d2ec3781a /src/core/bullet.hpp | |
parent | 068cfdc8fb0e31c9ff736ee426f1291d07115c11 (diff) | |
download | bullet-lab-remix-7f6e5a022b800af0a2f7ab502743805e6fbc448c.tar.xz |
Enable the BLR script VM (prototype).
The code (definitely) still require improvements.
TODOs:
Reimplement the call stack.
Unify float data types.
Diffstat (limited to 'src/core/bullet.hpp')
-rw-r--r-- | src/core/bullet.hpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/core/bullet.hpp b/src/core/bullet.hpp index b240e81..e3dc8fe 100644 --- a/src/core/bullet.hpp +++ b/src/core/bullet.hpp @@ -38,8 +38,32 @@ private: public: void init(); void deinit(); - template<class T>int allocBullet(); - template<class T>int createBullet(); + template<class T>int allocBullet() + { + if(!alloced) + { + alloced=1; + bullets[0]=new T; + return 0; + } + else + { + int i; + for(i=0;i<alloced;++i) + if(!bullets[i]->exist)break; + if(i==alloced) + bullets[alloced++]=new T; + return i; + } + return -1; + } + template<class T>int createBullet() + { + //stub... + int ptr=allocBullet<T>(); + bullets[ptr]->init(); + return ptr; + } void updateBullet(); void renderBullet(); bulletBase* getHandle(int id); |