Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open master #21

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
7 changes: 0 additions & 7 deletions pure2D-demo/.project
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,4 @@
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<linkedResources>
<link>
<name>pure2d-src</name>
<type>2</type>
<location>/usr/local/funzio/pure2d/pure2D/src</location>
</link>
</linkedResources>
</projectDescription>
2 changes: 1 addition & 1 deletion pure2D/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
android:targetSdkVersion="19" />

<application
android:allowBackup="true"
Expand Down
2 changes: 1 addition & 1 deletion pure2D/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-17
target=android-19
android.library=true
2 changes: 1 addition & 1 deletion pure2D/src/com/funzio/pure2D/animators/TweenAnimator.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public boolean update(final int deltaTime) {
timeline = ((float) mElapsedTime % (float) mDuration) / mDuration;
} else if (mLoopMode == LoopModes.LOOP_REVERSE) {
timeline = ((float) mElapsedTime % (float) mDuration) / mDuration;
if (trips % 2 == 1) {
if (trips % 2 != 0) {
// reverse
timeline = 1 - timeline;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ protected void onUpdate(final float value) {
int index = (int) Math.floor(mElapsedTime / mSegmentDuration);
if (index != mCurrentSegment) {
mCurrentSegment = index;
if (index % 2 == 1) {
if (index % 2 != 0) {
mModStartX = mModX;
mModStartY = mModY;
// go backward
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
import java.util.Arrays;
import java.util.Comparator;

import javax.microedition.khronos.opengles.GL10;

import android.content.res.AssetManager;
import android.graphics.Point;
import android.graphics.PointF;
Expand Down Expand Up @@ -59,7 +57,7 @@ public class ImageSequenceBufferAtlas extends Atlas {
public static final String TAG = ImageSequenceBufferAtlas.class.getSimpleName();

private GLState mGLState;
private GL10 mGL;
// private GL10 mGL;
private BufferTexture mTexture;
private FrameBuffer mFrameBuffer;

Expand Down Expand Up @@ -106,7 +104,7 @@ public ImageSequenceBufferAtlas(final GLState glState) {
Log.v(TAG, "ImageSequenceAtlas()");

mGLState = glState;
mGL = mGLState.mGL;
// mGL = mGLState.mGL;

if (!FrameBuffer.isSupported()) {
Log.e(TAG, "FrameBuffer is not supported!\n" + Log.getStackTraceString(new Exception()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected BufferTexture(final GLState glState, final int width, final int height
super(glState);

// create an blank texture
load(null, Math.round(width), Math.round(height), 0);
load(null, width, height, 0);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,11 @@ protected boolean runTasks() {
fileHasSpecificVersion = true;
Log.d(TAG, relativePathFromVersionFile + " has new version: " + remoteFileVersion);
}

// put to the local version file
localVersionProperties.put(relativePathFromVersionFile, remoteFileVersion);
}

// put to the local version file
localVersionProperties.put(relativePathFromVersionFile, remoteFileVersion);
// flag to update the file
localVersionFileUpdated |= fileHasSpecificVersion;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ protected void createManipulators() {
mTimeline.start();

// optional emitter animator
if (mEmitterVO.animator != null && mEmitterVO.animator != "") {
if (mEmitterVO.animator != null && !"".equals(mEmitterVO.animator)) {
mAnimator = mFactory.createAnimator(this, mFactory.mNovaVO.getAnimatorVO(mEmitterVO.animator), -1);

if (mAnimator != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ public void resetAnimator(final int emitIndex, final Manipulatable target, final
super.resetAnimator(emitIndex, target, animator);

final RecursiveTrajectoryAnimator move = (RecursiveTrajectoryAnimator) animator;
if (move != null) {
if (deceleration_rate != null) {
move.setDecelerationRate(NovaConfig.getFloat(deceleration_rate, emitIndex, 0));
}
// if (move != null) {
if (deceleration_rate != null) {
move.setDecelerationRate(NovaConfig.getFloat(deceleration_rate, emitIndex, 0));
}
// }
}

}
1 change: 0 additions & 1 deletion pure2D/src/com/funzio/pure2D/shapes/Polyline3D.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ protected void validateVertices() {
if (points instanceof Point3D[]) {
final Point3D[] point3Ds = (Point3D[]) points;

mPoints = points;
final int len = mPoints.length;

allocateVertices(len * 2, VERTEX_POINTER_SIZE);// each point has upper and lower points
Expand Down
10 changes: 10 additions & 0 deletions pure2D/src/com/funzio/pure2D/text/BmfTextObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public class BmfTextObject extends BaseDisplayObject implements Cacheable {
protected static final String ATT_TEXT = "text";
protected static final String ATT_TEXT_ALIGN = "textAlign";
protected static final String ATT_FONT = "font";
protected static final String ATT_SIZE = "size";

protected BitmapFont mBitmapFont;
protected TextOptions mTextOptions;
Expand Down Expand Up @@ -454,6 +455,15 @@ public void setXMLAttributes(final XmlPullParser xmlParser, final UIManager mana
if (bitmapFont != null) {
setBitmapFont(bitmapFont);
setText(manager.evalString(xmlParser.getAttributeValue(null, ATT_TEXT)));
final String sizeAttr = xmlParser.getAttributeValue(null, ATT_SIZE);
if (sizeAttr != null) {
try {
final int size = Integer.parseInt(sizeAttr);
setScale(size / bitmapFont.getTextOptions().inTextPaint.getTextSize());
} catch (NumberFormatException e) {
Log.e(TAG, "Invalid value of 'size': " + sizeAttr);
}
}

final String letterSpacing = xmlParser.getAttributeValue(null, ATT_LETTER_SPACING);
if (letterSpacing != null) {
Expand Down
1 change: 0 additions & 1 deletion pure2D/src/com/funzio/pure2D/ui/Button.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public class Button extends DisplayGroup implements UIObject {
protected int mState = STATE_UP;
protected Texture[] mTextures;

protected boolean mTouchable = true; // true by default
protected boolean mFocus = false;
private int mTouchPointerID = -1;

Expand Down
12 changes: 6 additions & 6 deletions pure2D/src/com/funzio/pure2D/ui/PageStacker.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ public void run() {
// slide out the current page
if (currentPage != null) {
currentPage.transitionOut(false);
}

// slide in the previous page
if (!currentPage.isPageFloating()) {
if (previousPage != null) {
mContainer.addChild(previousPage);
previousPage.transitionIn(false);
// slide in the previous page
if (!currentPage.isPageFloating()) {
if (previousPage != null) {
mContainer.addChild(previousPage);
previousPage.transitionIn(false);
}
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions pure2D/src/com/funzio/pure2D/ui/UIConstraint.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.xmlpull.v1.XmlPullParser;

import com.funzio.pure2D.DisplayObject;
import com.funzio.pure2D.Scene;
import com.funzio.pure2D.containers.Container;
import com.funzio.pure2D.containers.DisplayGroup;
import com.funzio.pure2D.containers.LinearGroup;
Expand Down Expand Up @@ -87,7 +86,7 @@ public static enum UNIT {
public UNIT childrenGapUnit = UNIT.UNSET;

private UIConfigVO mUIConfigVO;
private int mAxisSystem = Scene.AXIS_BOTTOM_LEFT;
// private int mAxisSystem = Scene.AXIS_BOTTOM_LEFT;
private boolean mHasAttributes = false;

public UIConstraint() {
Expand All @@ -100,7 +99,7 @@ public UIConstraint(final XmlPullParser parser, final UIManager manager) {

public void setAttributes(final XmlPullParser parser, final UIManager manager) {
mUIConfigVO = manager.getConfig();
mAxisSystem = manager.getTextureManager().getGLState().getAxisSystem();
// mAxisSystem = manager.getTextureManager().getGLState().getAxisSystem();
mHasAttributes = false;

widthUnit = getAttributeUnit(parser, ATT_WIDTH);
Expand Down
2 changes: 1 addition & 1 deletion pure2D/src/com/funzio/pure2D/ui/UIManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ public DisplayObject load(final int xmlResource) {
public TextureOptions getTextureOptions() {
if (mTextureOptions == null) {
mTextureOptions = TextureOptions.getDefault();
mTextureOptions.inMipmaps = mConfigVO.texture_manager.texture_options.mipmaps;

if (mConfigVO != null) {
mTextureOptions.inMipmaps = mConfigVO.texture_manager.texture_options.mipmaps;
// apply scale to texture options
mTextureOptions.inScaleX = mTextureOptions.inScaleY = mConfigVO.screen_scale;
}
Expand Down
1 change: 0 additions & 1 deletion pure2D/src/com/funzio/pure2D/utils/Pure2DUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,6 @@ public static int getNextPO2(int n) {
n = n | (n >> 4);
n = n | (n >> 8);
n = n | (n >> 16);
n = n | (n >> 32);
return n + 1;
}

Expand Down