summaryrefslogtreecommitdiffstats
path: root/res/raw
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2009-10-06 14:33:15 -0700
committerJason Sams <rjsams@android.com>2009-10-06 14:33:15 -0700
commit12c14a8559375a457bd73fd16c6815df9c38cb06 (patch)
treeabe9a1d9b38582fa8fb2abf662379ed39ee41206 /res/raw
parent5779e2a70862f3237f5ee4cdec783a739c66fc08 (diff)
downloadandroid_packages_apps_Trebuchet-12c14a8559375a457bd73fd16c6815df9c38cb06.tar.gz
android_packages_apps_Trebuchet-12c14a8559375a457bd73fd16c6815df9c38cb06.tar.bz2
android_packages_apps_Trebuchet-12c14a8559375a457bd73fd16c6815df9c38cb06.zip
Use push from script. Remove old readback and instant animation code.
Diffstat (limited to 'res/raw')
-rw-r--r--res/raw/rollo.c52
1 files changed, 30 insertions, 22 deletions
diff --git a/res/raw/rollo.c b/res/raw/rollo.c
index 2b15d7f55..e60b8a271 100644
--- a/res/raw/rollo.c
+++ b/res/raw/rollo.c
@@ -19,11 +19,31 @@ float g_DT;
int g_LastTime;
int g_PageCount;
float g_Zoom;
-float g_ZoomTarget;
// Drawing constants, should be parameters ======
#define VIEW_ANGLE 1.28700222f
+float g_OldPosPage;
+float g_OldPosVelocity;
+float g_OldZoom;
+
+void updateReadback() {
+ if ((g_OldPosPage != g_PosPage) ||
+ (g_OldPosVelocity != g_PosVelocity) ||
+ (g_OldZoom != g_Zoom)) {
+
+ g_OldPosPage = g_PosPage;
+ g_OldPosVelocity = g_PosVelocity;
+ g_OldZoom = g_Zoom;
+
+ int i[3];
+ i[0] = g_PosPage * (1 << 16);
+ i[1] = g_PosVelocity * (1 << 16);
+ i[2] = g_OldZoom * (1 << 16);
+ sendToClient(&i[0], 1, 12, 1);
+ }
+}
+
void init() {
g_AttractionTable[0] = 6.5f;
g_AttractionTable[1] = 6.5f;
@@ -50,7 +70,6 @@ void init() {
g_LastTouchDown = 0;
g_LastPositionX = 0;
g_Zoom = 0;
- g_ZoomTarget = 0;
}
void move() {
@@ -97,16 +116,6 @@ void touchUp() {
g_LastTouchDown = 0;
}
-void setZoomTarget() {
- g_ZoomTarget = state->zoomTarget;
- //debugF("zoom target", g_ZoomTarget);
-}
-
-void setZoom() {
- readback->zoom = g_Zoom = g_ZoomTarget = state->zoom;
- //debugF("zoom", g_ZoomTarget);
-}
-
int
count_pages(int iconCount)
{
@@ -301,8 +310,8 @@ main(int launchID)
g_LastTime = newTime;
//debugF("zoom", g_Zoom);
- if (g_Zoom != g_ZoomTarget) {
- float dz = (g_ZoomTarget - g_Zoom) * g_DT * 5;
+ if (g_Zoom != state->zoomTarget) {
+ float dz = (state->zoomTarget - g_Zoom) * g_DT * 5;
if (dz && (fabsf(dz) < 0.03f)) {
if (dz > 0) {
dz = 0.03f;
@@ -310,22 +319,22 @@ main(int launchID)
dz = -0.03f;
}
}
- if (fabsf(g_Zoom - g_ZoomTarget) < fabsf(dz)) {
- g_Zoom = g_ZoomTarget;
+ if (fabsf(g_Zoom - state->zoomTarget) < fabsf(dz)) {
+ g_Zoom = state->zoomTarget;
} else {
g_Zoom += dz;
}
- readback->zoom = g_Zoom;
+ updateReadback();
}
// Set clear value to dim the background based on the zoom position.
- if (g_Zoom < 0.001f) {
+ if ((g_Zoom < 0.001f) && (state->zoomTarget < 0.001f)) {
pfClearColor(0.0f, 0.0f, 0.0f, 0.0f);
// When we're zoomed out and not tracking motion events, reset the pos to 0.
if (!g_LastTouchDown) {
g_PosPage = 0;
}
- return 1; // 0;
+ return 1;//0;
} else if (g_Zoom < 0.85f) {
pfClearColor(0.0f, 0.0f, 0.0f, g_Zoom);
} else {
@@ -337,8 +346,7 @@ main(int launchID)
g_PageCount = count_pages(iconCount);
updatePos(0.1f);
- readback->posX = g_PosPage;
- readback->velocity = g_PosVelocity;
+ updateReadback();
//debugF(" draw g_PosPage", g_PosPage);
@@ -393,6 +401,6 @@ main(int launchID)
// Bug workaround where the last frame is not always displayed
// So we keep rendering until the bug is fixed.
- return 1; //(g_PosVelocity != 0) || fracf(g_PosPage) || g_Zoom != g_ZoomTarget);
+ return 1;//(g_PosVelocity != 0) || fracf(g_PosPage) || (g_Zoom != state->zoomTarget);
}