Minor cleanup and fix for the cannot launch apps bug if the screen is still creeping.
This commit is contained in:
+5
-17
@@ -1,7 +1,7 @@
|
||||
#pragma version(1)
|
||||
#pragma stateVertex(PV)
|
||||
#pragma stateFragment(PF)
|
||||
#pragma stateFragmentStore(PFS)
|
||||
#pragma stateFragment(PFTexLinear)
|
||||
#pragma stateStore(PSIcons)
|
||||
|
||||
#define PI 3.14159f
|
||||
|
||||
@@ -89,7 +89,6 @@ void fling() {
|
||||
if (g_PosPage > (g_PageCount - 1)) {
|
||||
g_PosVelocity = minf(0, g_PosVelocity);
|
||||
}
|
||||
//g_Zoom += (maxf(fabsf(g_PosVelocity), 3) - 3) / 2.f;
|
||||
}
|
||||
|
||||
void touchUp() {
|
||||
@@ -128,18 +127,10 @@ void updatePos() {
|
||||
return;
|
||||
}
|
||||
|
||||
//debugF("g_PosPage", g_PosPage);
|
||||
//debugF(" g_PosVelocity", g_PosVelocity);
|
||||
|
||||
float tablePosNorm = fracf(g_PosPage + 0.5f);
|
||||
float tablePosF = tablePosNorm * g_PhysicsTableSize;
|
||||
int tablePosI = tablePosF;
|
||||
float tablePosFrac = tablePosF - tablePosI;
|
||||
//debugF("tablePosNorm", tablePosNorm);
|
||||
//debugF("tablePosF", tablePosF);
|
||||
//debugF("tablePosI", tablePosI);
|
||||
//debugF("tablePosFrac", tablePosFrac);
|
||||
|
||||
float accel = lerpf(g_AttractionTable[tablePosI],
|
||||
g_AttractionTable[tablePosI + 1],
|
||||
tablePosFrac) * g_DT;
|
||||
@@ -257,14 +248,14 @@ draw_page(int icon, int lastIcon, float centerAngle, float scale)
|
||||
|
||||
color(1.0f, 1.0f, 1.0f, 0.99f);
|
||||
if (state->selectedIconIndex == icon) {
|
||||
bindTexture(NAMED_PF, 0, state->selectedIconTexture);
|
||||
bindTexture(NAMED_PFTexLinear, 0, state->selectedIconTexture);
|
||||
drawQuadTexCoords(
|
||||
iconLeftX, iconTextureTop, iconLeftZ, 0.0f, 0.0f,
|
||||
iconRightX, iconTextureTop, iconRightZ, 1.0f, 0.0f,
|
||||
iconRightX, iconTextureBottom, iconRightZ, 1.0f, 1.0f,
|
||||
iconLeftX, iconTextureBottom, iconLeftZ, 0.0f, 1.0f);
|
||||
} else {
|
||||
bindTexture(NAMED_PF, 0, loadI32(ALLOC_ICON_IDS, icon));
|
||||
bindTexture(NAMED_PFTexLinear, 0, loadI32(ALLOC_ICON_IDS, icon));
|
||||
drawQuadTexCoords(
|
||||
iconLeftX, iconTextureTop, iconLeftZ, 0.0f, 0.0f,
|
||||
iconRightX, iconTextureTop, iconRightZ, 1.0f, 0.0f,
|
||||
@@ -281,7 +272,7 @@ draw_page(int icon, int lastIcon, float centerAngle, float scale)
|
||||
float labelLeftX = centerX - farLabelWidth * 0.5f;
|
||||
float labelRightX = centerX + farLabelWidth * 0.5f;
|
||||
|
||||
bindTexture(NAMED_PF, 0, loadI32(ALLOC_LABEL_IDS, icon));
|
||||
bindTexture(NAMED_PFTexLinear, 0, loadI32(ALLOC_LABEL_IDS, icon));
|
||||
drawQuadTexCoords(
|
||||
labelLeftX, labelTop, centerZ, 0.0f, 0.0f,
|
||||
labelRightX, labelTop, centerZ, labelTextureWidth, 0.0f,
|
||||
@@ -346,9 +337,6 @@ main(int launchID)
|
||||
//debugF(" draw g_PosPage", g_PosPage);
|
||||
|
||||
// Draw the icons ========================================
|
||||
bindProgramVertex(NAMED_PV);
|
||||
bindProgramFragment(NAMED_PF);
|
||||
bindProgramFragmentStore(NAMED_PFS);
|
||||
|
||||
// Bug makes 1.0f alpha fail.
|
||||
color(1.0f, 1.0f, 1.0f, 0.99f);
|
||||
|
||||
@@ -262,7 +262,7 @@ public class AllAppsView extends RSSurfaceView
|
||||
return;
|
||||
}
|
||||
int index = mRollo.mState.selectedIconIndex;
|
||||
if (mRollo.mState.flingVelocityX == 0 && index >= 0 && index < mAllAppsList.size()) {
|
||||
if (mRollo.mReadback.velocity < 1 && index >= 0 && index < mAllAppsList.size()) {
|
||||
ApplicationInfo app = mAllAppsList.get(index);
|
||||
mLauncher.startActivitySafely(app.intent);
|
||||
}
|
||||
@@ -416,17 +416,13 @@ public class AllAppsView extends RSSurfaceView
|
||||
private Script.Invokable mInvokeSetZoom;
|
||||
private Script.Invokable mInvokeTouchUp;
|
||||
|
||||
private Sampler mSampler;
|
||||
private Sampler mSamplerText;
|
||||
private ProgramStore mPSBackground;
|
||||
private ProgramStore mPSIcons;
|
||||
private ProgramStore mPSText;
|
||||
private ProgramFragment mPFDebug;
|
||||
private ProgramFragment mPFImages;
|
||||
private ProgramFragment mPFOrtho;
|
||||
private ProgramFragment mPFColor;
|
||||
private ProgramFragment mPFTexLinear;
|
||||
private ProgramFragment mPFTexNearest;
|
||||
private ProgramVertex mPV;
|
||||
private ProgramVertex.MatrixAllocation mPVAlloc;
|
||||
private ProgramVertex mPVOrtho;
|
||||
private ProgramVertex.MatrixAllocation mPVOrthoAlloc;
|
||||
|
||||
private Allocation mScrollHandle;
|
||||
|
||||
@@ -518,75 +514,76 @@ public class AllAppsView extends RSSurfaceView
|
||||
mRes = res;
|
||||
mWidth = width;
|
||||
mHeight = height;
|
||||
initProgramVertex();
|
||||
initProgramFragment();
|
||||
initProgramStore();
|
||||
initGl();
|
||||
initData();
|
||||
initTouchState();
|
||||
initRs();
|
||||
}
|
||||
|
||||
private void initGl() {
|
||||
Sampler.Builder sb = new Sampler.Builder(mRS);
|
||||
sb.setMin(Sampler.Value.LINEAR);//_MIP_LINEAR);
|
||||
sb.setMag(Sampler.Value.LINEAR);
|
||||
sb.setWrapS(Sampler.Value.CLAMP);
|
||||
sb.setWrapT(Sampler.Value.CLAMP);
|
||||
mSampler = sb.create();
|
||||
|
||||
sb.setMin(Sampler.Value.NEAREST);
|
||||
sb.setMag(Sampler.Value.NEAREST);
|
||||
mSamplerText = sb.create();
|
||||
|
||||
ProgramFragment.Builder dbg = new ProgramFragment.Builder(mRS, null, null);
|
||||
mPFDebug = dbg.create();
|
||||
mPFDebug.setName("PFDebug");
|
||||
|
||||
ProgramFragment.Builder bf = new ProgramFragment.Builder(mRS, null, null);
|
||||
bf.setTexEnable(true, 0);
|
||||
bf.setTexEnvMode(ProgramFragment.EnvMode.MODULATE, 0);
|
||||
mPFImages = bf.create();
|
||||
mPFImages.setName("PF");
|
||||
mPFImages.bindSampler(mSampler, 0);
|
||||
|
||||
bf.setTexEnvMode(ProgramFragment.EnvMode.MODULATE, 0);
|
||||
//mPFOrtho = bf.create();
|
||||
mPFOrtho = (new ProgramFragment.Builder(mRS, null, null)).create();
|
||||
mPFOrtho.setName("PFOrtho");
|
||||
mPFOrtho.bindSampler(mSamplerText, 0);
|
||||
|
||||
ProgramStore.Builder bs = new ProgramStore.Builder(mRS, null, null);
|
||||
bs.setDepthFunc(ProgramStore.DepthFunc.ALWAYS);
|
||||
bs.setDitherEnable(false);
|
||||
bs.setDepthMask(true);
|
||||
bs.setBlendFunc(ProgramStore.BlendSrcFunc.SRC_ALPHA,
|
||||
ProgramStore.BlendDstFunc.ONE_MINUS_SRC_ALPHA);
|
||||
mPSBackground = bs.create();
|
||||
mPSBackground.setName("PFS");
|
||||
|
||||
bs.setDepthFunc(ProgramStore.DepthFunc.ALWAYS);
|
||||
bs.setDepthMask(false);
|
||||
bs.setBlendFunc(ProgramStore.BlendSrcFunc.SRC_ALPHA,
|
||||
ProgramStore.BlendDstFunc.ONE_MINUS_SRC_ALPHA);
|
||||
mPSText = bs.create();
|
||||
mPSText.setName("PFSText");
|
||||
|
||||
mPVAlloc = new ProgramVertex.MatrixAllocation(mRS);
|
||||
mPVAlloc.setupProjectionNormalized(mWidth, mHeight);
|
||||
private void initProgramVertex() {
|
||||
ProgramVertex.MatrixAllocation pva = new ProgramVertex.MatrixAllocation(mRS);
|
||||
pva.setupProjectionNormalized(mWidth, mHeight);
|
||||
|
||||
ProgramVertex.Builder pvb = new ProgramVertex.Builder(mRS, null, null);
|
||||
mPV = pvb.create();
|
||||
mPV.setName("PV");
|
||||
mPV.bindAllocation(mPVAlloc);
|
||||
|
||||
mPVOrthoAlloc = new ProgramVertex.MatrixAllocation(mRS);
|
||||
mPVOrthoAlloc.setupOrthoWindow(mWidth, mHeight);
|
||||
mPV.bindAllocation(pva);
|
||||
|
||||
pva = new ProgramVertex.MatrixAllocation(mRS);
|
||||
pva.setupOrthoWindow(mWidth, mHeight);
|
||||
pvb.setTextureMatrixEnable(true);
|
||||
mPVOrtho = pvb.create();
|
||||
mPVOrtho.setName("PVOrtho");
|
||||
mPVOrtho.bindAllocation(mPVOrthoAlloc);
|
||||
mPVOrtho.bindAllocation(pva);
|
||||
|
||||
mRS.contextBindProgramVertex(mPV);
|
||||
}
|
||||
|
||||
private void initProgramFragment() {
|
||||
Sampler.Builder sb = new Sampler.Builder(mRS);
|
||||
sb.setMin(Sampler.Value.LINEAR);
|
||||
sb.setMag(Sampler.Value.LINEAR);
|
||||
sb.setWrapS(Sampler.Value.CLAMP);
|
||||
sb.setWrapT(Sampler.Value.CLAMP);
|
||||
Sampler linear = sb.create();
|
||||
|
||||
sb.setMin(Sampler.Value.NEAREST);
|
||||
sb.setMag(Sampler.Value.NEAREST);
|
||||
Sampler nearest = sb.create();
|
||||
|
||||
ProgramFragment.Builder bf = new ProgramFragment.Builder(mRS, null, null);
|
||||
mPFColor = bf.create();
|
||||
mPFColor.setName("PFColor");
|
||||
|
||||
bf.setTexEnable(true, 0);
|
||||
bf.setTexEnvMode(ProgramFragment.EnvMode.MODULATE, 0);
|
||||
mPFTexLinear = bf.create();
|
||||
mPFTexLinear.setName("PFTexLinear");
|
||||
mPFTexLinear.bindSampler(linear, 0);
|
||||
|
||||
mPFTexNearest = bf.create();
|
||||
mPFTexNearest.setName("PFTexNearest");
|
||||
mPFTexNearest.bindSampler(nearest, 0);
|
||||
}
|
||||
|
||||
private void initProgramStore() {
|
||||
ProgramStore.Builder bs = new ProgramStore.Builder(mRS, null, null);
|
||||
bs.setDepthFunc(ProgramStore.DepthFunc.ALWAYS);
|
||||
bs.setDitherEnable(true);
|
||||
bs.setBlendFunc(ProgramStore.BlendSrcFunc.SRC_ALPHA,
|
||||
ProgramStore.BlendDstFunc.ONE_MINUS_SRC_ALPHA);
|
||||
mPSIcons = bs.create();
|
||||
mPSIcons.setName("PSIcons");
|
||||
|
||||
//bs.setDitherEnable(false);
|
||||
//mPSText = bs.create();
|
||||
//mPSText.setName("PSText");
|
||||
}
|
||||
|
||||
private void initGl() {
|
||||
mTouchXBorders = new int[Defines.COLUMNS_PER_PAGE+1];
|
||||
mAllocTouchXBorders = Allocation.createSized(mRS, Element.USER_I32(mRS),
|
||||
mTouchXBorders.length);
|
||||
|
||||
Reference in New Issue
Block a user