• Advertisement
Sign in to follow this  

Creating a camera class

This topic is 2054 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?


[CODE]
#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));
}
}
[/CODE] Edited by Key

Share this post


Link to post
Share on other sites
Advertisement
Maybe it is just me, but I don't really understand your question. You are using a Vector2 class with [color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][size=3][left][background=rgb(250, 251, 252)]LWJGL and asking what the equivalent is in [/background][/left][/size][/font][/color][color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][size=3][left][background=rgb(250, 251, 252)]LWJGL ?[/background][/left][/size][/font][/color]

Share this post


Link to post
Share on other sites
[quote name='dAND3h' timestamp='1338842283' post='4946221']
Maybe it is just me, but I don't really understand your question. You are using a Vector2 class with
[left][background=rgb(250, 251, 252)]LWJGL and asking what the equivalent is in [/background][/left]
[left][color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][size=3][background=rgb(250, 251, 252)]LWJGL ?[/background][/size][/font][/color][/left]

[/quote]

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement