From 7808dcce355d895b74e315df95de82d1004d0b75 Mon Sep 17 00:00:00 2001 From: Alex Medearis Date: Thu, 8 Nov 2012 12:05:00 -0600 Subject: [PATCH 1/3] Adds horizontal flipping parameter --- .DS_Store | Bin 0 -> 6148 bytes FlipView/.DS_Store | Bin 0 -> 6148 bytes FlipView/Demo/.classpath | 4 +- FlipView/Demo/AndroidManifest.xml | 3 +- .../demo/FlipHorizontalLayoutActivity.java | 148 ++++++++++++++++++ .../aphidmobile/flip/demo/MainActivity.java | 1 + FlipView/FlipLibrary/.classpath | 4 +- FlipView/FlipLibrary/.project | 2 +- .../src/com/aphidmobile/flip/Card.java | 107 +++++++++---- .../src/com/aphidmobile/flip/FlipCards.java | 41 +++-- .../aphidmobile/flip/FlipViewController.java | 14 +- .../com/aphidmobile/flip/ViewDualCards.java | 92 +++++++---- Legacy/Demo-Animation/.classpath | 4 +- 13 files changed, 344 insertions(+), 76 deletions(-) create mode 100644 .DS_Store create mode 100644 FlipView/.DS_Store create mode 100644 FlipView/Demo/src/com/aphidmobile/flip/demo/FlipHorizontalLayoutActivity.java diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a62b7cff4b0c6e778936ad7f2e6f339a661cd7f4 GIT binary patch literal 6148 zcmeHKyNUuq5bQn;7A`R~oL}${2J!p>!B~6*2Z9G8mu}>D`Ds=^5M@^|F_CKMu9=>$ zS+;`hZ4uGwX*&@aiAV!Cl(U7d*|~YgzA~dgIPO@=uk7T1d)(|h)%^+MHZqqzn1A>D z_2Ka99sM^mO9iL^6`%rCfC}^}V7(XCdJWc~jK{$&1tBymRtsK7@lpu^c>HpMGtZ|%IC_1Xeo!L8;3H^bT~2;Po?-j1=c fc0Bf?s4KR{c};8sosPWIf&3XTU1(I`-3nX*0jL#E literal 0 HcmV?d00001 diff --git a/FlipView/.DS_Store b/FlipView/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..ff15e0339fc3c8d76cb375235e4e96e210cea05a GIT binary patch literal 6148 zcmeHKyH3ME5S#-Sk;nnQLP|q}W~IHk zUGLnE;*qTzn%H& z24|J - - + + diff --git a/FlipView/Demo/AndroidManifest.xml b/FlipView/Demo/AndroidManifest.xml index 9edd8af..c915167 100644 --- a/FlipView/Demo/AndroidManifest.xml +++ b/FlipView/Demo/AndroidManifest.xml @@ -19,7 +19,8 @@ - + + diff --git a/FlipView/Demo/src/com/aphidmobile/flip/demo/FlipHorizontalLayoutActivity.java b/FlipView/Demo/src/com/aphidmobile/flip/demo/FlipHorizontalLayoutActivity.java new file mode 100644 index 0000000..6a5c028 --- /dev/null +++ b/FlipView/Demo/src/com/aphidmobile/flip/demo/FlipHorizontalLayoutActivity.java @@ -0,0 +1,148 @@ +/* +Copyright 2012 Aphid Mobile + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + */ + +package com.aphidmobile.flip.demo; + +import android.app.Activity; +import android.content.Context; +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import android.text.Html; +import android.view.*; +import android.widget.*; +import com.aphidmobile.flip.FlipViewController; +import com.aphidmobile.flipview.demo.R; +import com.aphidmobile.utils.AphidLog; +import com.aphidmobile.utils.IO; + +import java.util.ArrayList; +import java.util.List; + +public class FlipHorizontalLayoutActivity extends Activity { + private FlipViewController flipView; + + /** + * Called when the activity is first created. + */ + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setTitle(R.string.activity_title); + + flipView = new FlipViewController(this, false); + + flipView.setAdapter(new MyBaseAdapter(this)); + + setContentView(flipView); + } + + @Override + protected void onResume() { + super.onResume(); + flipView.onResume(); + } + + @Override + protected void onPause() { + super.onPause(); + flipView.onPause(); + } + + private static class MyBaseAdapter extends BaseAdapter { + private static List IMG_DESCRIPTIONS = new ArrayList(); + + static { + IMG_DESCRIPTIONS.add(new Data("Potala Palace", "potala_palace.jpg", "http://en.wikipedia.org/wiki/Potala_Palace", "The Potala Palace is located in Lhasa, Tibet Autonomous Region, China. It is named after Mount Potalaka, the mythical abode of Chenresig or Avalokitesvara.")); + IMG_DESCRIPTIONS.add(new Data("Drepung Monastery", "drepung_monastery.jpg", "http://en.wikipedia.org/wiki/Drepung", "Drepung Monastery, located at the foot of Mount Gephel, is one of the \"great three\" Gelukpa university monasteries of Tibet.")); + IMG_DESCRIPTIONS.add(new Data("Sera Monastery", "sera_monastery.jpg", "http://en.wikipedia.org/wiki/Sera_Monastery", "Sera Monastery is one of the 'great three' Gelukpa university monasteries of Tibet, located 1.25 miles (2.01 km) north of Lhasa.")); + IMG_DESCRIPTIONS.add(new Data("Samye Monastery", "samye_monastery.jpg", "http://en.wikipedia.org/wiki/Samye", "Samye Monastery is the first Buddhist monastery built in Tibet, was most probably first constructed between 775 and 779 CE.")); + IMG_DESCRIPTIONS.add(new Data("Tashilunpo Monastery", "tashilunpo_monastery.jpg", "http://en.wikipedia.org/wiki/Tashilhunpo_Monastery", "Tashilhunpo Monastery, founded in 1447 by Gendun Drup, the First Dalai Lama, is a historic and culturally important monastery next to Shigatse, the second-largest city in Tibet.")); + IMG_DESCRIPTIONS.add(new Data("Zhangmu Port", "zhangmu_port.jpg", "http://en.wikipedia.org/wiki/Zhangmu", "Zhangmu/Dram is a customs town and port of entry located in Nyalam County on the Nepal-China border, just uphill and across the Bhote Koshi River from the Nepalese town of Kodari.")); + IMG_DESCRIPTIONS.add(new Data("Kathmandu", "kathmandu.jpg", "http://en.wikipedia.org/wiki/Kathmandu", "Kathmandu is the capital and, with more than one million inhabitants, the largest metropolitan city of Nepal.")); + IMG_DESCRIPTIONS.add(new Data("Pokhara", "pokhara.jpg", "http://en.wikipedia.org/wiki/Pokhara", "Pokhara Sub-Metropolitan City is the second largest city of Nepal with approximately 250,000 inhabitants and is situated about 200 km west of the capital Kathmandu.")); + IMG_DESCRIPTIONS.add(new Data("Patan", "patan.jpg", "http://en.wikipedia.org/wiki/Patan,_Nepal", "Patan, officially Lalitpur Sub-Metropolitan City, is one of the major cities of Nepal located in the south-central part of Kathmandu Valley.")); + } + + private LayoutInflater inflater; + + private MyBaseAdapter(Context context) { + inflater = LayoutInflater.from(context); + } + + @Override + public int getCount() { + return IMG_DESCRIPTIONS.size(); + } + + @Override + public Object getItem(int position) { + return position; + } + + @Override + public long getItemId(int position) { + return position; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + View layout = convertView; + if (convertView == null) + layout = inflater.inflate(R.layout.complex1, null); + + final Data data = IMG_DESCRIPTIONS.get(position); + + TextView titleView = (TextView) layout.findViewById(R.id.title); + titleView.setText(AphidLog.format("%d. %s", position, data.title)); + + ImageView photoView = (ImageView) layout.findViewById(R.id.photo); + photoView.setImageBitmap(IO.readBitmap(inflater.getContext().getAssets(), data.imageFilename)); + + TextView textView = (TextView) layout.findViewById(R.id.description); + textView.setText(Html.fromHtml(data.description)); + + Button wikipedia = (Button) layout.findViewById(R.id.wikipedia); + wikipedia.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent( + Intent.ACTION_VIEW, + Uri.parse(data.link) + ); + inflater.getContext().startActivity(intent); + } + }); + + return layout; + } + + private static class Data { + public String title; + public String imageFilename; + public String link; + public String description; + + private Data(String title, String imageFilename, String link, String description) { + this.title = title; + this.imageFilename = imageFilename; + this.link = link; + this.description = description; + } + } + } +} diff --git a/FlipView/Demo/src/com/aphidmobile/flip/demo/MainActivity.java b/FlipView/Demo/src/com/aphidmobile/flip/demo/MainActivity.java index dd8e2e1..5ed5ba0 100644 --- a/FlipView/Demo/src/com/aphidmobile/flip/demo/MainActivity.java +++ b/FlipView/Demo/src/com/aphidmobile/flip/demo/MainActivity.java @@ -68,6 +68,7 @@ protected void onListItemClick(ListView l, View v, int position, long id) { addItem(data, "Flip Text Views", FlipTextViewActivity.class); addItem(data, "Flip Buttons", FlipButtonActivity.class); addItem(data, "Flip Complex Layouts", FlipComplexLayoutActivity.class); + addItem(data, "Flip Horizontal", FlipHorizontalLayoutActivity.class); return data; } diff --git a/FlipView/FlipLibrary/.classpath b/FlipView/FlipLibrary/.classpath index a4763d1..3f9691c 100644 --- a/FlipView/FlipLibrary/.classpath +++ b/FlipView/FlipLibrary/.classpath @@ -1,8 +1,8 @@ - - + + diff --git a/FlipView/FlipLibrary/.project b/FlipView/FlipLibrary/.project index 2ffdaf7..2114616 100644 --- a/FlipView/FlipLibrary/.project +++ b/FlipView/FlipLibrary/.project @@ -1,6 +1,6 @@ - Aphid-FlipView-Library + FlipLibrary diff --git a/FlipView/FlipLibrary/src/com/aphidmobile/flip/Card.java b/FlipView/FlipLibrary/src/com/aphidmobile/flip/Card.java index d048ccf..2ff4fef 100644 --- a/FlipView/FlipLibrary/src/com/aphidmobile/flip/Card.java +++ b/FlipView/FlipLibrary/src/com/aphidmobile/flip/Card.java @@ -49,6 +49,8 @@ public class Card { private int axis = AXIS_TOP; + private boolean orientationVertical = true; + private boolean dirty = false; public Texture getTexture() { @@ -89,6 +91,10 @@ public void setAxis(int axis) { this.axis = axis; } + public void setOrientation(boolean orientationVertical) { + this.orientationVertical = orientationVertical; + } + public void draw(GL10 gl) { if (dirty) updateVertices(); @@ -121,17 +127,33 @@ public void draw(GL10 gl) { gl.glPushMatrix(); - if (angle > 0) { - if (axis == AXIS_TOP) { - gl.glTranslatef(0, cardVertices[1], 0f); - gl.glRotatef(-angle, 1f, 0f, 0f); - gl.glTranslatef(0, -cardVertices[1], 0f); - } else { - gl.glTranslatef(0, cardVertices[7], 0f); - gl.glRotatef(angle, 1f, 0f, 0f); - gl.glTranslatef(0, -cardVertices[7], 0f); + if(orientationVertical){ + if (angle > 0) { + if (axis == AXIS_TOP) { + gl.glTranslatef(0, cardVertices[1], 0f); + gl.glRotatef(-angle, 1f, 0f, 0f); + gl.glTranslatef(0, -cardVertices[1], 0f); + } else { + gl.glTranslatef(0, cardVertices[7], 0f); + gl.glRotatef(angle, 1f, 0f, 0f); + gl.glTranslatef(0, -cardVertices[7], 0f); + } + } + } else { + if (angle > 0) { + if (axis == AXIS_TOP) { + gl.glTranslatef(cardVertices[0], 0, 0f); + gl.glRotatef(-angle, 0f, 1f, 0f); + gl.glTranslatef(-cardVertices[0], 0, 0f); + } else { + gl.glTranslatef(cardVertices[6], 0, 0f); + gl.glRotatef(angle, 0f, 1f, 0f); + gl.glTranslatef(-cardVertices[6], 0, 0f); + } } + } + gl.glVertexPointer(3, GL_FLOAT, 0, vertexBuffer); gl.glDrawElements(GL_TRIANGLES, indices.length, GL_UNSIGNED_SHORT, indexBuffer); @@ -150,15 +172,31 @@ public void draw(GL10 gl) { gl.glDisable(GL_DEPTH_TEST); if (axis == AXIS_TOP) { - float w = cardVertices[9] - cardVertices[0]; - float h = (cardVertices[1] - cardVertices[4]) * (1f - FloatMath.cos(d2r(angle))); - float z = (cardVertices[1] - cardVertices[4]) * FloatMath.sin(d2r(angle)); - float[] shadowVertices = new float[]{ - cardVertices[0], h + cardVertices[4], z, - cardVertices[3], cardVertices[4], 0f, - w, cardVertices[7], 0f, - w, h + cardVertices[4], z - }; + float w,h,z; + float[] shadowVertices; + if(orientationVertical){ + w = cardVertices[9] - cardVertices[0]; + h = (cardVertices[1] - cardVertices[4]) * (1f - FloatMath.cos(d2r(angle))); + z = (cardVertices[1] - cardVertices[4]) * FloatMath.sin(d2r(angle)); + shadowVertices = new float[]{ + cardVertices[0], h + cardVertices[4], z, + cardVertices[3], cardVertices[4], 0f, + w, cardVertices[7], 0f, + w, h + cardVertices[4], z + }; + } else { + w = (cardVertices[9] - cardVertices[0]) * (1f - FloatMath.cos(d2r(angle))); + h = (cardVertices[1] - cardVertices[4]); + z = (cardVertices[1] - cardVertices[4]) * FloatMath.sin(d2r(angle)); + + shadowVertices = new float[]{ + cardVertices[9] - w, cardVertices[1], z, + cardVertices[6] - w, cardVertices[4], z, + cardVertices[6], cardVertices[7], 0f, + cardVertices[9], cardVertices[10], 0f + }; + + } float alpha = 1f * (90f - angle) / 90f; @@ -166,16 +204,29 @@ public void draw(GL10 gl) { gl.glVertexPointer(3, GL_FLOAT, 0, toFloatBuffer(shadowVertices)); gl.glDrawElements(GL_TRIANGLES, indices.length, GL_UNSIGNED_SHORT, indexBuffer); } else { - float w = cardVertices[9] - cardVertices[0]; - float h = (cardVertices[1] - cardVertices[4]) * (1f - FloatMath.cos(d2r(angle))); - float z = (cardVertices[1] - cardVertices[4]) * FloatMath.sin(d2r(angle)); - float[] shadowVertices = new float[]{ - cardVertices[0], cardVertices[1], 0f, - cardVertices[3], cardVertices[1] - h, z, - w, cardVertices[1] - h, z, - w, cardVertices[1], 0f - }; - + float w,h,z; + float[] shadowVertices; + if(orientationVertical){ + w = cardVertices[9] - cardVertices[0]; + h = (cardVertices[1] - cardVertices[4]) * (1f - FloatMath.cos(d2r(angle))); + z = (cardVertices[1] - cardVertices[4]) * FloatMath.sin(d2r(angle)); + shadowVertices = new float[]{ + cardVertices[0], cardVertices[1], 0f, + cardVertices[3], cardVertices[1] - h, z, + w, cardVertices[1] - h, z, + w, cardVertices[1], 0f + }; + } else { + w = (cardVertices[9] - cardVertices[0]) * (1f - FloatMath.cos(d2r(angle))); + h = (cardVertices[1] - cardVertices[4]); + z = (cardVertices[1] - cardVertices[4]) * FloatMath.sin(d2r(angle)); + shadowVertices = new float[]{ + cardVertices[0], cardVertices[1], 0f, + cardVertices[3], cardVertices[4], 0f, + cardVertices[0] + w, cardVertices[7], z, + cardVertices[3] + w, cardVertices[10], z + }; + } float alpha = 1f * (90f - angle) / 90f; gl.glColor4f(0f, 0.0f, 0f, alpha); diff --git a/FlipView/FlipLibrary/src/com/aphidmobile/flip/FlipCards.java b/FlipView/FlipLibrary/src/com/aphidmobile/flip/FlipCards.java index ae08b4e..2e03c38 100644 --- a/FlipView/FlipLibrary/src/com/aphidmobile/flip/FlipCards.java +++ b/FlipView/FlipLibrary/src/com/aphidmobile/flip/FlipCards.java @@ -41,7 +41,9 @@ public class FlipCards { private int animatedFrame = 0; private int state = STATE_INIT; + private boolean orientationVertical = true; private float lastY = -1; + private float lastX = -1; @SuppressWarnings("unused") private VelocityTracker velocityTracker; @@ -51,12 +53,12 @@ public class FlipCards { private boolean visible = false; - public FlipCards(FlipViewController controller) { + public FlipCards(FlipViewController controller, boolean orientationVertical) { this.controller = controller; - frontCards = new ViewDualCards(); - backCards = new ViewDualCards(); - + frontCards = new ViewDualCards(orientationVertical); + backCards = new ViewDualCards(orientationVertical); + this.orientationVertical = orientationVertical; resetAxises(); } @@ -67,6 +69,7 @@ public boolean isVisible() { public void setVisible(boolean visible) { this.visible = visible; } + public void reloadTexture(int frontIndex, View frontView, int backIndex, View backView) { synchronized (this) { @@ -208,15 +211,24 @@ public synchronized boolean handleTouchEvent(MotionEvent event, boolean isOnTouc switch (event.getAction()) { case MotionEvent.ACTION_DOWN: lastY = event.getY(); + lastX = event.getX(); return isOnTouchEvent; case MotionEvent.ACTION_MOVE: - delta = lastY - event.getY(); + if(orientationVertical){ + delta = lastY - event.getY(); + } else { + delta = lastX - event.getX(); + } if (Math.abs(delta) > controller.getTouchSlop()) setState(STATE_TOUCH); //XXX: initialize views? if (state == STATE_TOUCH) { controller.showFlipAnimation(); - - final float angleDelta = 180 * delta / controller.getContentHeight() * MOVEMENT_RATE; + final float angleDelta ; + if(orientationVertical){ + angleDelta = 180 * delta / controller.getContentHeight() * MOVEMENT_RATE; + } else { + angleDelta = 180 * delta / controller.getContentWidth() * MOVEMENT_RATE; + } angle += angleDelta; if (backCards.getIndex() == -1) { if (angle >= MAX_TIP_ANGLE) @@ -237,7 +249,11 @@ public synchronized boolean handleTouchEvent(MotionEvent event, boolean isOnTouc angle += 180; } } - lastY = event.getY(); + if(orientationVertical){ + lastY = event.getY(); + } else { + lastX = event.getX(); + } controller.getSurfaceView().requestRender(); return true; } @@ -246,8 +262,13 @@ public synchronized boolean handleTouchEvent(MotionEvent event, boolean isOnTouc case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: if (state == STATE_TOUCH) { - delta = lastY - event.getY(); - rotateBy(180 * delta / controller.getContentHeight() * MOVEMENT_RATE); + if(orientationVertical){ + delta = lastY - event.getY(); + rotateBy(180 * delta / controller.getContentHeight() * MOVEMENT_RATE); + } else { + delta = lastX - event.getX(); + rotateBy(180 * delta / controller.getContentWidth() * MOVEMENT_RATE); + } forward = angle >= 90; setState(STATE_AUTO_ROTATE); controller.getSurfaceView().requestRender(); diff --git a/FlipView/FlipLibrary/src/com/aphidmobile/flip/FlipViewController.java b/FlipView/FlipLibrary/src/com/aphidmobile/flip/FlipViewController.java index 3d83da6..dd602a0 100644 --- a/FlipView/FlipLibrary/src/com/aphidmobile/flip/FlipViewController.java +++ b/FlipView/FlipLibrary/src/com/aphidmobile/flip/FlipViewController.java @@ -32,6 +32,9 @@ import java.util.LinkedList; public class FlipViewController extends AdapterView { + + public static final int ORIENTATION_VERTICAL = 0; + public static final int ORIENTATION_HORIZONTAL = 1; private static final int MSG_SURFACE_CREATED = 1; private Handler handler = new Handler(new Handler.Callback() { @@ -53,6 +56,8 @@ public boolean handleMessage(Message msg) { private int contentWidth; private int contentHeight; + + private boolean orientationVertical; private boolean enableFlipAnimation = true; @@ -87,11 +92,16 @@ public void onChanged() { private float maxVelocity; public FlipViewController(Context context) { + this(context, true); + } + + + public FlipViewController(Context context, boolean orientationVertical) { super(context); ViewConfiguration configuration = ViewConfiguration.get(getContext()); touchSlop = configuration.getScaledTouchSlop(); maxVelocity = configuration.getScaledMaximumFlingVelocity(); - + this.orientationVertical = orientationVertical; setupSurfaceView(); } @@ -261,7 +271,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { private void setupSurfaceView() { surfaceView = new GLSurfaceView(getContext()); - cards = new FlipCards(this); + cards = new FlipCards(this, orientationVertical); renderer = new FlipRenderer(this, cards); surfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0); diff --git a/FlipView/FlipLibrary/src/com/aphidmobile/flip/ViewDualCards.java b/FlipView/FlipLibrary/src/com/aphidmobile/flip/ViewDualCards.java index 5acdcf4..c9ca163 100644 --- a/FlipView/FlipLibrary/src/com/aphidmobile/flip/ViewDualCards.java +++ b/FlipView/FlipLibrary/src/com/aphidmobile/flip/ViewDualCards.java @@ -38,6 +38,14 @@ public class ViewDualCards { private Card topCard = new Card(); private Card bottomCard = new Card(); + private boolean orientationVertical = true; + + public ViewDualCards(boolean orientationVertical) { + topCard.setOrientation(orientationVertical); + bottomCard.setOrientation(orientationVertical); + this.orientationVertical = orientationVertical; + } + public int getIndex() { return index; } @@ -49,7 +57,8 @@ public View getView() { public boolean setView(int index, View view) { UI.assertInMainThread(); this.index = index; - if (getView() == view && (screenshot != null || TextureUtils.isValidTexture(texture))) + if (getView() == view + && (screenshot != null || TextureUtils.isValidTexture(texture))) return false; viewRef = null; if (texture != null) { @@ -106,33 +115,60 @@ public void buildTexture(FlipRenderer renderer, GL10 gl) { final float textureHeight = texture.getHeight(); final float textureWidth = texture.getWidth(); - topCard.setCardVertices(new float[]{ - 0f, viewHeight, 0f, //top left - 0f, viewHeight / 2.0f, 0f, //bottom left - viewWidth, viewHeight / 2f, 0f, //bottom right - viewWidth, viewHeight, 0f //top right - }); - - topCard.setTextureCoordinates(new float[]{ - 0f, 0f, - 0f, viewHeight / 2f / textureHeight, - viewWidth / textureWidth, viewHeight / 2f / textureHeight, - viewWidth / textureWidth, 0f - }); - - bottomCard.setCardVertices(new float[]{ - 0f, viewHeight / 2f, 0f, //top left - 0f, 0f, 0f, //bottom left - viewWidth, 0f, 0f, //bottom right - viewWidth, viewHeight / 2f, 0f //top right - }); - - bottomCard.setTextureCoordinates(new float[]{ - 0f, viewHeight / 2f / textureHeight, - 0f, viewHeight / textureHeight, - viewWidth / textureWidth, viewHeight / textureHeight, - viewWidth / textureWidth, viewHeight / 2f / textureHeight - }); + if (orientationVertical) { + topCard.setCardVertices(new float[] { 0f, viewHeight, 0f, // top + // left + 0f, viewHeight / 2.0f, 0f, // bottom left + viewWidth, viewHeight / 2f, 0f, // bottom right + viewWidth, viewHeight, 0f // top right + }); + + topCard.setTextureCoordinates(new float[] { 0f, 0f, 0f, + viewHeight / 2f / textureHeight, + viewWidth / textureWidth, + viewHeight / 2f / textureHeight, + viewWidth / textureWidth, 0f }); + + bottomCard.setCardVertices(new float[] { 0f, viewHeight / 2f, + 0f, // top left + 0f, 0f, 0f, // bottom left + viewWidth, 0f, 0f, // bottom right + viewWidth, viewHeight / 2f, 0f // top right + }); + + bottomCard.setTextureCoordinates(new float[] { 0f, + viewHeight / 2f / textureHeight, 0f, + viewHeight / textureHeight, viewWidth / textureWidth, + viewHeight / textureHeight, viewWidth / textureWidth, + viewHeight / 2f / textureHeight }); + } else { + topCard.setCardVertices(new float[] { 0f, viewHeight, 0f, // top + // left + 0f, 0f, 0f, // bottom left + viewWidth / 2f, 0f, 0f, // bottom right + viewWidth / 2f, viewHeight, 0f // top right + }); + + topCard.setTextureCoordinates(new float[] { 0f, 0f, 0f, + viewHeight / textureHeight, + viewWidth / 2f / textureWidth, + viewHeight / textureHeight, + viewWidth / 2f / textureWidth, 0f }); + + bottomCard.setCardVertices(new float[] { viewWidth / 2f, + viewHeight, 0f, // top left + viewWidth / 2f, 0f, 0f, // bottom left + viewWidth, 0f, 0f, // bottom right + viewWidth, viewHeight, 0f // top right + }); + + bottomCard.setTextureCoordinates(new float[] { + viewWidth / 2f / textureWidth, 0f, + viewWidth / 2f / textureWidth, + viewHeight / textureHeight, viewWidth / textureWidth, + viewHeight / textureHeight, viewWidth / textureWidth, + 0f }); + } checkError(gl); } diff --git a/Legacy/Demo-Animation/.classpath b/Legacy/Demo-Animation/.classpath index a4763d1..3f9691c 100644 --- a/Legacy/Demo-Animation/.classpath +++ b/Legacy/Demo-Animation/.classpath @@ -1,8 +1,8 @@ - - + + From cfa29d35feefd0c6b6e829234684babc05a37a4c Mon Sep 17 00:00:00 2001 From: Alex Medearis Date: Thu, 8 Nov 2012 12:05:35 -0600 Subject: [PATCH 2/3] remove .DS_Store --- .DS_Store | Bin 6148 -> 0 bytes FlipView/.DS_Store | Bin 6148 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store delete mode 100644 FlipView/.DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index a62b7cff4b0c6e778936ad7f2e6f339a661cd7f4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKyNUuq5bQn;7A`R~oL}${2J!p>!B~6*2Z9G8mu}>D`Ds=^5M@^|F_CKMu9=>$ zS+;`hZ4uGwX*&@aiAV!Cl(U7d*|~YgzA~dgIPO@=uk7T1d)(|h)%^+MHZqqzn1A>D z_2Ka99sM^mO9iL^6`%rCfC}^}V7(XCdJWc~jK{$&1tBymRtsK7@lpu^c>HpMGtZ|%IC_1Xeo!L8;3H^bT~2;Po?-j1=c fc0Bf?s4KR{c};8sosPWIf&3XTU1(I`-3nX*0jL#E diff --git a/FlipView/.DS_Store b/FlipView/.DS_Store deleted file mode 100644 index ff15e0339fc3c8d76cb375235e4e96e210cea05a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKyH3ME5S#-Sk;nnQLP|q}W~IHk zUGLnE;*qTzn%H& z24|J Date: Thu, 8 Nov 2012 12:06:05 -0600 Subject: [PATCH 3/3] gitignore .DS_Store --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 1f04d7e..e6c6527 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ out/ # Local configuration file (sdk path, etc) local.properties + +#Mac folder files +.DS_Store \ No newline at end of file