Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - graydsl

#1
Nexus One is a very nice phone with decent stats. But that's only a developer phone from my company, so i dont own it. ^^ I will buy a HTC Desire, because it's very similar to the One, but with hardware buttons. I was able to get my hands on the galaxy s but frankly I dont like it much. In my opinion it's slightly to big to be handled well. But if it's only for development purposes, you can go with nexus one, desire, galaxy s, i think.
#2
Support / Re: CameraMovement
October 15, 2010, 11:59:50 AM
I figured it out. :) BTW it's an vertical scrolling camera. Works pretty nice right now. But I'm open for suggestions. ^^

onDrawFrame:

public void onDrawFrame(GL10 gl) {
if (mCameraSpeed < 0) {
mWorld.getCamera().moveCamera(Camera.CAMERA_MOVEUP, -mCameraSpeed);
} else {
mWorld.getCamera().moveCamera(Camera.CAMERA_MOVEDOWN, mCameraSpeed);
}

mCameraSpeed *= mCameraSlowing;

fb.clear(new RGBColor(220, 220, 220));
mWorld.renderScene(fb);
mWorld.draw(fb);
fb.display();
}


moveCamera:

private void moveCamera(float pX, float pY) {
if (!mCameraMoving) {
lastX = pX;
lastY = pY;
mCameraMoving = true;
return;
} else {
if (lastX == pX && lastY == pY) {
return;
} else {
mCameraSpeed += (lastY - pY) / 150f;
}
lastX = pX;
lastY = pY;
}
}
#3
Support / CameraMovement
October 15, 2010, 10:26:53 AM
Hiho,

I'm developing a top secret app for my bachelor thesis. :D But I have some problems implementing camera movement. It's working, but for very small finger movement, it's not moving at all, because of slowCamMovement. But if i do it without slowCamMovement it's moving much to fast. So my question is, if there is a general strategy to implement this, which is much better than my approach? Thanks guys!



private void moveCamera(float pX, float pY) {
if (!mCameraMoving) {
mLastX = pX;
mLastY = pY;
mCameraMoving = true;
return;
} else {
if (mLastX == pX && mLastY == pY) {
return;
} else if (mLastY > pY) {
// downwards
Camera cam = mWorld.getCamera();
float speed = (mLastY - pY) / slowCamMovement; // slowCamMovement = 100f;
cam.moveCamera(Camera.CAMERA_MOVEDOWN, speed);
} else {
// upwards
Camera cam = mWorld.getCamera();
float speed = (mLastY - pY) / slowCamMovement;
cam.moveCamera(Camera.CAMERA_MOVEUP, -speed);
}
lastX = pX;
lastY = pY;
}
}