Jump to content

View more

Image of the Day

Inventory ! Va falloir trouver une autre couleur pour le cadre D: #AzTroScreenshot #screenshotsaturday https://t.co/PvxhGL7cOH
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Creating a camera class

4: Adsense

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   

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.


#2 dAND3h   Members   

220
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   

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   

220
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   

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.