A little while ago, I decided I wanted the FPS of my game to display onscreen.
In other engines this seems to be a trivial task (something along the lines of "print fps" or "g.drawString(fps,0,0);" normally does the trick)
But being the inexperienced Java coder I am, I'm unused to how to seek what I desire from a new set of Java libraries (namely jPCT).
I found there wasn't really a way to do 2D at all... or if there is it's extremely convoluted so I went for just seeing if I could get a picture to display on a plane and have that constantly infront of the camera.
First, it took me a while to figure out how to get transparency to work because the Java docs are wrong (it says the maximum value for setTransparency is 0 - which it isn't: it's 5)
After getting a plane with an alpha mapped .png image to render correctly I then searched for something resembling "position object x,y,z" or "setObjectPosition(float x,float y,float z)" but the only things I can find are all these translate, transform, origin, centre and matrix commands. - I honestly can't tell from the Java docs which one would do what I'd want.
All the positioning commands seem relative to previous movement. - Surely I mustn't have to store the vector an object was translated by, then reverse the translation just to move it somewhere else every time?
I wish to position an object at the camera, then move it forward a unit or so every cycle. But I can't see how in the world I'm supposed to achieve this. xD
Something like this:
while(running){
plane.positionObject(camera.getPositionX(),camera.getPositionY(),camera.getPositionZ());
plane.rotateObject(camera.getAngleX(),camera.getAngleY(),camera.getAngleZ());
plane.translate(0,0,1);
}
I feel incredibly stupid or like I'm missing a huge chunk of methods or something...
This kind of thing is nice and easy in DarkBASICPro/C++/other3Dengines as far as I'm aware.
Someone point me in the right direction D: