Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

init

  • Loading branch information...
commit fd3579c25661771564c18cc6c49a0d4a166fa6d4 0 parents
Nicholas Kinsey authored
2  .gitignore
@@ -0,0 +1,2 @@
+/.lock-wscript
+/build/
1  index.coffee
@@ -0,0 +1 @@
+module.exports = require './lib/bullet.coffee'
7 lib/bullet.coffee
@@ -0,0 +1,7 @@
+Bullet = require '../build/default/bullet'
+# Bullet = bullet.Bullet
+# Image = bullet.DefaultCollisionConfiguration
+
+exports = module.exports = Bullet
+
+exports.VERSION = '0.1.0'
43 package.coffee
@@ -0,0 +1,43 @@
+{
+ name: 'bullet'
+ description: '''"Bullet" physics for node.js'''
+
+ keywords: ['bullet', 'physics', 'dynamics', 'engine', 'binding', 'wrapper']
+
+ version: '0.1.0'
+
+ author: 'Feisty Studios <node-bullet@feistystudios.com> (http://feistystudios.com/)'
+
+ licenses: [
+ {
+ type: 'FEISTY'
+ url: 'http://github.com/feisty/license/LICENSE'
+ }
+ ]
+
+ contributors: [
+ 'Nicholas Kinsey <nicholas.kinsey@feistystudios.com>'
+ ]
+
+ repository:
+ type: 'git'
+ url: 'http://github.com/feisty/node-bullet.git'
+ private: 'git@github.com:feisty/node-bullet.git'
+ web: 'http://github.com/feisty/node-bullet'
+
+ bugs:
+ mail: 'node-bullet@feistystudios.com'
+ web: 'http://github.com/feisty/node-bullet/issues'
+
+ directories:
+ lib: './lib'
+ doc: './doc'
+
+ main: './lib/bullet.coffee'
+
+ dependencies:
+ 'coffee-script': '= 1.0.0'
+
+ engines:
+ node: '= 0.3.2'
+}
35 package.json
@@ -0,0 +1,35 @@
+{
+ name: 'bullet',
+ description: '"Bullet" physics for node.js',
+ keywords: ['bullet', 'physics', 'dynamics', 'engine', 'binding', 'wrapper'],
+ version: '0.1.0',
+ author: 'Feisty Studios <node-bullet@feistystudios.com> (http://feistystudios.com/)',
+ licenses: [
+ {
+ type: 'FEISTY',
+ url: 'http://github.com/feisty/license/LICENSE'
+ }
+ ],
+ contributors: ['Nicholas Kinsey <nicholas.kinsey@feistystudios.com>'],
+ repository: {
+ type: 'git',
+ url: 'http://github.com/feisty/node-bullet.git',
+ private: 'git@github.com:feisty/node-bullet.git',
+ web: 'http://github.com/feisty/node-bullet'
+ },
+ bugs: {
+ mail: 'node-bullet@feistystudios.com',
+ web: 'http://github.com/feisty/node-bullet/issues'
+ },
+ directories: {
+ lib: './lib',
+ doc: './doc'
+ },
+ main: './lib/bullet.coffee',
+ dependencies: {
+ 'coffee-script': '= 1.0.0'
+ },
+ engines: {
+ node: '= 0.3.2'
+ }
+}
32 src/Bullet.cc
@@ -0,0 +1,32 @@
+#include "Bullet.h"
+
+Persistent<FunctionTemplate> Bullet::constructor;
+
+void
+Bullet::Initialize(Handle<Object> target) {
+ HandleScope scope;
+
+ constructor = Persistent<FunctionTemplate>::New(FunctionTemplate::New(Bullet::New));
+ constructor->InstanceTemplate()->SetInternalFieldCount(1);
+ constructor->SetClassName(String::NewSymbol("Bullet"));
+
+ Local<ObjectTemplate> proto = constructor->PrototypeTemplate();
+
+ target->Set(String::NewSymbol("Bullet"), constructor->GetFunction());
+}
+
+Handle<Value>
+Bullet::New(const Arguments &args) {
+ HandleScope scope;
+
+ Bullet* bullet = new Bullet();
+ bullet->Wrap(args.This());
+
+ return args.This();
+}
+
+Bullet::Bullet(): ObjectWrap() {
+}
+
+Bullet::~Bullet() {
+}
24 src/Bullet.h
@@ -0,0 +1,24 @@
+#ifndef __NODE_BULLET_H__
+#define __NODE_BULLET_H__
+
+#include <v8.h>
+#include <node.h>
+#include <node_object_wrap.h>
+
+using namespace v8;
+using namespace node;
+
+class Bullet: public node::ObjectWrap {
+ public:
+ static Persistent<FunctionTemplate> constructor;
+
+ static void Initialize(Handle<Object> target);
+ static Handle<Value> New(const Arguments &args);
+
+ Bullet();
+
+ private:
+ ~Bullet();
+};
+
+#endif
10 src/init.cc
@@ -0,0 +1,10 @@
+// #include "btBulletDynamicsCommon.h"
+
+#include "Bullet.h"
+
+extern "C" void
+init (Handle<Object> target) {
+ HandleScope scope;
+
+ Bullet::Initialize(target);
+}
5 test/master.coffee
@@ -0,0 +1,5 @@
+{Bullet} = require '../index.coffee'
+
+bullet = new Bullet
+
+console.log bullet
5 test/npm.coffee
@@ -0,0 +1,5 @@
+{Bullet} = require 'bullet'
+
+b = new Bullet
+
+console.log b
20 wscript
@@ -0,0 +1,20 @@
+srcdir = '.'
+
+blddir = 'build'
+
+VERSION = '0.1.0'
+
+def set_options(opt):
+ opt.tool_options('compiler_cxx')
+
+def configure(conf):
+ conf.check_tool('compiler_cxx')
+ conf.check_tool('node_addon')
+
+ conf.check_cfg(package='bullet', args='--cflags --libs', mandatory=True)
+
+def build(bld):
+ bullet = bld.new_task_gen('cxx', 'shlib', 'node_addon')
+ bullet.target = 'bullet'
+ bullet.source = bld.glob('src/*.cc')
+ bullet.uselib = ['BULLET']
Please sign in to comment.
Something went wrong with that request. Please try again.