Exemple #1
0
static ERL_NIF_TERM new_btDiscreteDynamicsWorld(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) {

    return wrap_pointer(env,
        btDynamicsWorld_resource,
        new btDiscreteDynamicsWorld(
            (btCollisionDispatcher*)unwrap_pointer(
                env,
                btCollisionDispatcher_resource,
                argv[0]
             ),
            (btBroadphaseInterface*)unwrap_pointer(
                env,
                btBroadphaseInterface_resource,
                argv[1]
            ),
            (btSequentialImpulseConstraintSolver*)unwrap_pointer(
                env,
                btSequentialImpulseConstraintSolver_resource,
                argv[2]
             ),
            (btDefaultCollisionConfiguration*)unwrap_pointer(
                env,
                btDefaultCollisionConfiguration_resource,
                argv[3]
             )
    ));
}
value_t wrap_string(const std::string& str) {
    double_storage_t* storage = alloc_double_storage();
    storage->header = make_header(true, STRING_TYPE_MASK, MARK_POLICY_NONE);
    storage->first_slot = (uint64_t) new std::string(str);

    return wrap_pointer(storage);
}
Exemple #3
0
JNIEXPORT jobject JNICALL OS_NATIVE(_1makeShot)
(JNIEnv *env, jclass jclazz, jobject jwnd)
{
	WebWindow* wnd = getWebWindow(env, jwnd);
	HBITMAP hBmp = printWindow(wnd->getWebViewWindowHandle());
	return wrap_pointer(env, hBmp);
}
Exemple #4
0
static ERL_NIF_TERM new_btRigidBodyConstructionInfo(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) {
    double mass;
    btVector3 inertia = get_vector(env,argv[3]);
    enif_get_double(env, argv[0], &mass);
    return wrap_pointer(env,btRigidBodyConstructionInfo_resource, new btRigidBody::btRigidBodyConstructionInfo(
        mass,
        (btMotionState*)unwrap_pointer(env,btMotionState_resource,argv[1]),
        (btCollisionShape*)unwrap_pointer(env,btCollisionShape_resource,argv[2]),
        inertia
        ));
}
Exemple #5
0
JNIEXPORT jobject JNICALL OS_NATIVE(_1create)
	(JNIEnv *env, jclass jclazz, jobject jcallback)
{
	// always check for no_proxy env variable
	checkNoProxy();

	WebWindow *wnd = new WebWindow();
	if (wnd->initWithCallback(jcallback, env)) {
		return wrap_pointer(env, wnd);
	}
	delete wnd;
	return NULL;
}
Exemple #6
0
static ERL_NIF_TERM new_btCollisionDispatcher(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) {

    return wrap_pointer(
        env,
        btCollisionDispatcher_resource,
        new btCollisionDispatcher(
            (btDefaultCollisionConfiguration*)unwrap_pointer(
                env,
                btDefaultCollisionConfiguration_resource,
                argv[0]
                )
        )
    );
}
	// Menu Screen Shot
	JNIEXPORT JHANDLE JNICALL OS_NATIVE(_1fetchPopupMenuVisualData)(JNIEnv *env, jclass that, JHANDLE jshell, JHANDLE jmenu, jintArray jsizes) {
		// initializing
		HWND oldFocused = GetFocus();
		hCallWndHook = NULL;
		hwndPopupMenu = NULL;
		hdefaultDC = NULL;
		hDC = NULL;
		hBitmap = NULL;
		wpOrigEditProc = NULL;
		calcSizeDone = false;
		hWnd = (HWND)unwrap_pointer(env, jshell);
		hMenu = (HMENU)unwrap_pointer(env, jmenu);
		// install hook
//		DWORD ourThreadID = GetWindowThreadProcessId(hWnd, NULL);
		DWORD ourThreadID = GetCurrentThreadId();
		hCallWndHook = SetWindowsHookEx(WH_CALLWNDPROC, (HOOKPROC)CallWndProc,	NULL, ourThreadID);
		if (hCallWndHook == NULL) {
			return NULL;
		}
		// prepare dimensions array elements
		jsize sizesSize = env->GetArrayLength(jsizes);
		sizes = new jint[sizesSize];
		// display menu window
		SetForegroundWindow(hWnd);
		TrackPopupMenuEx(hMenu, TPM_HORIZONTAL | TPM_LEFTALIGN | TPM_NOANIMATION, 100, 100, hWnd, NULL);
		// copy dimensions into java array
		env->SetIntArrayRegion(jsizes, 0, sizesSize, sizes);
		// remove hook and clean up
		UnhookWindowsHookEx(hCallWndHook);
		hCallWndHook = NULL;
		if (hdefaultDC) {
			ReleaseDC(NULL, hdefaultDC);
		}
		if (hDC) {
			DeleteDC(hDC);
		}
		delete []sizes;
		// restore focus
		if (oldFocused != NULL) {
			SetFocus(oldFocused);
		}
		// return bitmap (may be NULL)
		return wrap_pointer(env, hBitmap);
	}
Exemple #8
0
static ERL_NIF_TERM new_btDefaultMotionState(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) {
    return wrap_pointer(env,btMotionState_resource,new btDefaultMotionState(get_transform(env,argv[0])));
}
Exemple #9
0
static ERL_NIF_TERM new_btSequentialImpulseConstraintSolver(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) {

    return wrap_pointer(env,btSequentialImpulseConstraintSolver_resource,new btSequentialImpulseConstraintSolver());
}
Exemple #10
0
static ERL_NIF_TERM new_btDefaultCollisionConfiguration(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) {

    return wrap_pointer(env,btDefaultCollisionConfiguration_resource,new btDefaultCollisionConfiguration());
}
Exemple #11
0
static ERL_NIF_TERM new_btDbvtBroadphase(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) {

    return wrap_pointer(env,btBroadphaseInterface_resource,new btDbvtBroadphase());
}
Exemple #12
0
static ERL_NIF_TERM btIntToBody(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) {
    int ptrInt;
    enif_get_int(env, argv[0], &ptrInt);
    return wrap_pointer(env,btRigidBody_resource, (btRigidBody*)(ptrInt));
}
Exemple #13
0
static ERL_NIF_TERM new_btRigidBody(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) {
    btRigidBody::btRigidBodyConstructionInfo *rbCI = (btRigidBody::btRigidBodyConstructionInfo*)unwrap_pointer(env,btRigidBodyConstructionInfo_resource,argv[0]);
    btRigidBody *bady = new btRigidBody(*rbCI);
    return wrap_pointer(env,btRigidBody_resource, new btRigidBody(*rbCI));
}
Exemple #14
0
static ERL_NIF_TERM new_btCylinderShape(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) {
    return wrap_pointer(env,btCollisionShape_resource,new btCapsuleShape(get_vector(env,argv[0]).x(),get_vector(env,argv[0]).y()));
}
Exemple #15
0
static ERL_NIF_TERM new_btSphereShape(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) {
    double radius;
    enif_get_double(env, argv[0], &radius);
    return wrap_pointer(env,btCollisionShape_resource,(void*)new btSphereShape(radius));
}
Exemple #16
0
static ERL_NIF_TERM new_btBoxShape(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) {
    return wrap_pointer(env,btCollisionShape_resource,(void*)new btBoxShape(get_vector(env,argv[0])));
}
void protect_storage(double_storage_t* storage) {
	protected_pool.push_front(wrap_pointer(storage));
}