Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on May 01, 2012
@santa4nt santa4nt Code review. bfadfe9
@santa4nt santa4nt Merge branch 'ingame' of github.com:RedditAndroidDev/Tamagotchi into …
…ingame

With initial code review changes.

Conflicts:
	Tamagotchi/src/com/redditandroiddevelopers/tamagotchi/screens/CreatureCreationScreen.java
1b3a122
View
78 Tamagotchi/src/com/redditandroiddevelopers/tamagotchi/screens/CreatureCreationScreen.java
@@ -7,8 +7,7 @@
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.input.GestureDetector;
-import com.badlogic.gdx.input.GestureDetector.GestureListener;
-import com.badlogic.gdx.math.Vector2;
+import com.badlogic.gdx.input.GestureDetector.GestureAdapter;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Group;
import com.badlogic.gdx.scenes.scene2d.Stage;
@@ -36,31 +35,26 @@
private static final String GRP_OVERLAY = "overlay";
private static final String GRP_TEXT = "text";
- // the x coordinates at which the creatures start moving up/down
- private float leftMark = 250;
- private float rightMark = Gdx.graphics.getWidth() - 250;
-
- // list of all displayed creatures
- private final ArrayList<Image> creatureList = new ArrayList<Image>();
+ // fonts
+ private static final String ROBOTO_REGULAR = "fonts/Roboto-Regular.ttf";
- // GestureDetector to handle swipes
- private final GestureDetector gestureDetector = new GestureDetector(new SwipeHandler());
+ // number of creatures to create
+ private static final int NUM_OF_CREATURES = 25;
+
+ private final ArrayList<Image> creatureList;
+ private final GestureDetector gestureDetector;
- // scale factor for smaller creatures
- private final float scaleFactor = 0.75f;
-
- // fonts
- private final String ROBOTO_REGULAR = "fonts/Roboto-Regular.ttf";
+ private float leftMark, rightMark;
+ private float scaleFactor;
// font styles
private Label.LabelStyle labelStyle80;
- private Label.LabelStyle labelStyle40;
-
- // number of creatures to create
- final private int NUM_OF_CREATURES = 25;
+ private Label.LabelStyle labelStyle40;
public CreatureCreationScreen(TamagotchiGame game) {
super(game);
+ creatureList = new ArrayList<Image>();
+ gestureDetector = new GestureDetector(new SwipeHandler());
}
@Override
@@ -70,10 +64,14 @@ protected Stage createStage(SpriteBatch batch) {
@Override
public void show() {
- super.show();
+ super.show();
+ final float padding = 250;
+ leftMark = padding;
+ rightMark = Gdx.graphics.getWidth() - padding;
+ scaleFactor = 0.75f;
initializeInput();
initializeFonts();
- initializeLayouts();
+ initializeLayouts();
}
/**
@@ -124,7 +122,6 @@ private void initializeFirstLayout() {
final TextureRegion overlayGrayTextureRegion = textureAtlas.findRegion("OverlayGray");
// create creatures
-
for (int i = 0; i < NUM_OF_CREATURES; i++) {
creatureList.add(new Image(creatureTextureRegion, Scaling.stretch, Align.CENTER,
"creature" + (i + 1)));
@@ -285,28 +282,8 @@ public void click(Actor actor, float x, float y) {
/**
* Basic GestureListener that handles the swiping motion.
- */
- class SwipeHandler implements GestureListener {
-
- @Override
- public boolean touchDown(int x, int y, int pointer) {
- return false;
- }
-
- @Override
- public boolean tap(int x, int y, int count) {
- return false;
- }
-
- @Override
- public boolean longPress(int x, int y) {
- return false;
- }
-
- @Override
- public boolean fling(float velocityX, float velocityY) {
- return false;
- }
+ */
+ class SwipeHandler extends GestureAdapter {
@Override
public boolean pan(int x, int y, int deltaX, int deltaY) {
@@ -321,17 +298,6 @@ public boolean pan(int x, int y, int deltaX, int deltaY) {
}
return true;
}
-
- @Override
- public boolean zoom(float originalDistance, float currentDistance) {
- return false;
- }
-
- @Override
- public boolean pinch(Vector2 initialFirstPointer, Vector2 initialSecondPointer,
- Vector2 firstPointer, Vector2 secondPointer) {
- return false;
- }
-
+
}
}
View
7 Tamagotchi/src/com/redditandroiddevelopers/tamagotchi/utils/FontHelper.java
@@ -8,11 +8,12 @@
public class FontHelper {
+ public static final String FONT_CHARACTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789][_!$%#@|\\/?-+=()*&.:;,{}\"´`'<>";
+
public static BitmapFont createBitmapFont(String fontFile, float size, Stage stage) {
- final String FONT_CHARACTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789][_!$%#@|\\/?-+=()*&.:;,{}\"´`'<>";
return TrueTypeFontFactory.createBitmapFont(
Gdx.files.internal(fontFile),
- FONT_CHARACTERS, stage.width(), stage.height(), size, Gdx.graphics.getWidth(),
- Gdx.graphics.getHeight());
+ FONT_CHARACTERS, stage.width(), stage.height(), size,
+ Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
}
}

No commit comments for this range

Something went wrong with that request. Please try again.