View previous topic :: View next topic |
Author |
Message |
Ax3l Cheater
Reputation: 1
Joined: 22 May 2011 Posts: 37
|
Posted: Wed Jun 01, 2011 5:35 am Post subject: C++ Classes in Java ? |
|
|
How would I use C++ classes in Java ?
Or C# classes would be fine too (not JNBridge please )
|
|
Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Wed Jun 01, 2011 6:02 am Post subject: |
|
|
http://en.wikipedia.org/wiki/Java_Native_Interface
I haven't used JNI much, but I know that you can load and use .dlls written in native languages. I also have heard horror stories about how big of a bitch it is to get setup. There is less information on it available than other libraries but you should be able to find enough to get you going with basics.
PS. I don't think you can use class files directly, only compiled .dlls with exported functions
_________________
|
|
Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Wed Jun 01, 2011 6:10 am Post subject: |
|
|
I've only used JNA which is supposed to be the better option and is still pretty much a bitch to use. Even to have a small piece of native code, you must first declare the function signature in terms of Java basic types. It should be avoided except where possible simply because of the hassle and the hit on readability you'll get. Rethink whether you really need to do this..
I think there are simpler ways where you call exported functions instead which require less work on the Java side but still.. should be avoided where necessary.
|
|
Back to top |
|
 |
Ax3l Cheater
Reputation: 1
Joined: 22 May 2011 Posts: 37
|
Posted: Wed Jun 01, 2011 2:40 pm Post subject: |
|
|
Well I want to use directX things in Java
But its pretty darn hard to find out how to do it in Java
|
|
Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Wed Jun 01, 2011 4:14 pm Post subject: |
|
|
just use an already made wrapper.
opengl is probably more common though. look at http://lwjgl.org/
|
|
Back to top |
|
 |
Ax3l Cheater
Reputation: 1
Joined: 22 May 2011 Posts: 37
|
Posted: Thu Jun 02, 2011 5:20 am Post subject: |
|
|
slovach wrote: | just use an already made wrapper.
opengl is probably more common though. look at |
Does it have something like Xinput ?
|
|
Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Thu Jun 02, 2011 6:00 am Post subject: |
|
|
it looks like an input library is included as well
|
|
Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Thu Jun 02, 2011 8:35 am Post subject: |
|
|
lwjgl is pretty nice. If you just want to do simple 2d stuff, use Slick2D which is a lwjgl wrapper with 2d focus.
_________________
|
|
Back to top |
|
 |
|