Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Creating a camera class


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
4 replies to this topic

#1 Key   Members   -  Reputation: 112

Like
0Likes
Like

Posted 04 June 2012 - 02:15 PM

I'm in the process of porting my C#/XNA game to Java/LWJGL, but a few things I can't figure out.
I'm using a Vector2f from LWJGL for a Vector2, but what are the equivalents of a Vector2 and the get/set accessors and the keyword value in Java with LWJGL?


		#region Declarations
		private static Vector2 position = Vector2.Zero;
		private static Vector2 viewPortSize = Vector2.Zero;
		private static Rectangle worldBoundary = new Rectangle(0, 0, 0, 0);
		#endregion
		#region Properties
		public static Vector2 Position
		{
			get { return position; }
			set
			{
				position = new Vector2(
					MathHelper.Clamp(value.X, worldBoundary.X, worldBoundary.Width - ViewPortWidth),
					MathHelper.Clamp(value.Y, worldBoundary.Y, worldBoundary.Height - ViewPortHeight));
			}
		}

Edited by Key, 04 June 2012 - 03:39 PM.


Sponsor:

#2 dAND3h   Members   -  Reputation: 214

Like
0Likes
Like

Posted 04 June 2012 - 02:38 PM

Maybe it is just me, but I don't really understand your question. You are using a Vector2 class with

LWJGL and asking what the equivalent is in

LWJGL ?



#3 Key   Members   -  Reputation: 112

Like
0Likes
Like

Posted 04 June 2012 - 02:54 PM

Maybe it is just me, but I don't really understand your question. You are using a Vector2 class with

LWJGL and asking what the equivalent is in

LWJGL ?



I'm asking what is the Java/LWJGL equivalent of a Vector2 from C#

#4 dAND3h   Members   -  Reputation: 214

Like
0Likes
Like

Posted 04 June 2012 - 03:05 PM

As far as I am aware, there is no native Vector2 class in java. I am not familiar with LWJGL, but a quick google search leads me back to the Vector2f class you defined above, which is equivalent to the Vector2 from C#(assuming you are using an outside graphics framework because C# does not natively have a any of those types of classes).

Edited by dAND3h, 04 June 2012 - 03:10 PM.


#5 bobbias   Members   -  Reputation: 120

Like
0Likes
Like

Posted 05 June 2012 - 09:58 AM

The best choice is to avoid the org.lwjgl.util classes and go with the vector classes from javax.vecmath which is part of the java3d package.

The lwjgl util package is slated for removal because the vector and matrix classes there are crippled compared to those defined in the javax.vecmath package.

Most of the time you'll be passing either float arrays or FloatBuffers to lwjgl functions anyway, vector2f/vector3f etc. are really just used for convenience.




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