Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Converting C# to Java


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Key   Members   -  Reputation: 112

Like
0Likes
Like

Posted 02 June 2012 - 07:04 PM

I'm attempting to convert my C# project that I have been working on to Java.
I'll have more questions as I am converting it, but what is the Java equivalent of a Vector2 in C#? Will it require a framework or API?

Edited by Key, 02 June 2012 - 07:13 PM.


Sponsor:

#2 frob   Moderators   -  Reputation: 22226

Like
0Likes
Like

Posted 02 June 2012 - 07:20 PM

There is none in either language.

There are many graphics packages (including one by Sun) that define their own numeric vector classes.

That said, if you are using XNA or some other library for your graphics, it almost certainly contains numeric vector classes. The same holds true for Java and 3D packages available in it.

Edited by frob, 02 June 2012 - 08:07 PM.
Clarify that these are numeric vectors, not the general container vector.

Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.

Also check out my personal website at bryanwagstaff.com, where I write about assorted stuff.


#3 Kyan   Members   -  Reputation: 395

Like
0Likes
Like

Posted 02 June 2012 - 07:26 PM

In the vanilla JDK there is no such thing, although it is fairly easy to roll your own.

That said, there are plenty of 3rd party options. LibGDX, JME, et. al. all have their own [internal] math libraries you can use if you'd like. The easiest would probably be to use the Vecmath (javax.vecmath) package, which is a standalone library that was liberated from J3D. There are many ways to obtain it (package managers, Maven, etc.), but it's homepage for the source is here: http://java.net/projects/vecmath. The corresponding class to C#'s Vector2 would be Vector2f.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS