Commit d4bcc1b1 authored by Tor Martin Frøberg Wang's avatar Tor Martin Frøberg Wang
Browse files

Made a leftover font scale with the device width. Completes issue #102

parent 4637363d
......@@ -4,6 +4,7 @@ import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.utils.Json;
import com.badlogic.gdx.utils.JsonReader;
......
package com.gameware.game.sprites;
package com.gameware.game.sprites.bubbleWrapSprites;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Sound;
......@@ -7,6 +7,8 @@ import com.gameware.game.GameWare;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Vector3;
import com.gameware.game.sprites.Sprite;
import java.util.ArrayList;
import java.util.Random;
......
package com.gameware.game.sprites;
package com.gameware.game.sprites.colorRushSprites;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Sound;
......@@ -6,8 +6,9 @@ import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Vector3;
import com.gameware.game.GameWare;
import com.gameware.game.sprites.Sprite;
public class ColorRushButton extends Sprite{
public class ColorRushButton extends Sprite {
private Texture mainTexture;
private Texture disabledTexture;
private int colorNum;
......
package com.gameware.game.sprites;
package com.gameware.game.sprites.colorRushSprites;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Vector3;
import com.gameware.game.sprites.Sprite;
public class ColorRushTarget extends Sprite{
public class ColorRushTarget extends Sprite {
private int nextHeight;
private Vector3 velocity;
private Texture mainTexture;
......
package com.gameware.game.sprites;
package com.gameware.game.sprites.fruitSlicerSprites;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Vector3;
import com.gameware.game.sprites.Sprite;
public class Fruit extends Sprite {
......
package com.gameware.game.sprites;
package com.gameware.game.sprites.fruitSlicerSprites;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Vector3;
import com.gameware.game.sprites.Sprite;
public class SlicingCircle extends Sprite {
private Texture slicingVFX;
......
package com.gameware.game.sprites.PauseStateSprites;
package com.gameware.game.sprites.pauseStateSprites;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
......
package com.gameware.game.sprites.PauseStateSprites;
package com.gameware.game.sprites.pauseStateSprites;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
......
package com.gameware.game.sprites.PauseStateSprites;
package com.gameware.game.sprites.pauseStateSprites;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
......
......@@ -5,10 +5,10 @@ import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.gameware.game.GameWare;
import com.gameware.game.sprites.ConfirmationBox;
import com.gameware.game.sprites.pauseStateSprites.ConfirmationBox;
import com.gameware.game.sprites.LoadingText;
import com.gameware.game.sprites.PauseCircle;
import com.gameware.game.sprites.PauseMenuButton;
import com.gameware.game.sprites.pauseStateSprites.PauseCircle;
import com.gameware.game.sprites.pauseStateSprites.PauseMenuButton;
import com.gameware.game.states.games.PlayStateUnion;
import java.util.ArrayList;
......@@ -231,5 +231,9 @@ public class PauseState extends State {
}
@Override
public void reset() { }
public void reset() {
this.needsConfirmation = false;
this.countdownStarted = false;
this.countdownDurationLeft = 3f;
}
}
......@@ -3,7 +3,7 @@ package com.gameware.game.states.games;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.gameware.game.sprites.Bubble;
import com.gameware.game.sprites.bubbleWrapSprites.Bubble;
import com.gameware.game.states.GameStateManager;
import java.util.ArrayList;
......
......@@ -2,8 +2,8 @@ package com.gameware.game.states.games;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.gameware.game.sprites.ColorRushButton;
import com.gameware.game.sprites.ColorRushTarget;
import com.gameware.game.sprites.colorRushSprites.ColorRushButton;
import com.gameware.game.sprites.colorRushSprites.ColorRushTarget;
import com.gameware.game.states.GameStateManager;
import java.util.ArrayList;
......
......@@ -6,8 +6,8 @@ import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Vector3;
import com.gameware.game.GameWare;
import com.gameware.game.sprites.Fruit;
import com.gameware.game.sprites.SlicingCircle;
import com.gameware.game.sprites.fruitSlicerSprites.Fruit;
import com.gameware.game.sprites.fruitSlicerSprites.SlicingCircle;
import com.gameware.game.states.GameStateManager;
import java.util.ArrayList;
......@@ -35,6 +35,8 @@ public class FruitSlicerState extends PlayStateUnion {
super(gsm);
super.setTotalGameTime(60f);
super.screenshot = new Texture(Gdx.files.internal("gameTextures/FruitSlicer/FruitSlicerPhotoEdit.png"));
super.setFontColorWhite();
super.setPauseButtonWhite();
this.sliceWhooshSound = Gdx.audio.newSound(Gdx.files.internal("sfx/FruitSlicerWhooshSound.mp3"));
this.sliceSquishSound = Gdx.audio.newSound(Gdx.files.internal("sfx/FruitSlicerSquishSound.mp3"));
......@@ -78,6 +80,12 @@ public class FruitSlicerState extends PlayStateUnion {
this.oldTouchPosition.x = touchX;
this.oldTouchPosition.y = touchY;
}
// Adds new slicing circles if the user is touching
if(Gdx.input.isTouched()) {
this.slicingCircles.add(new SlicingCircle(Gdx.input.getX(), Gdx.graphics.getHeight() - Gdx.input.getY(), this.slicingCircleVFX));
}
}
@Override
......@@ -87,11 +95,6 @@ public class FruitSlicerState extends PlayStateUnion {
this.handleInput();
// Adds new slicing circles if the user is touching
if(Gdx.input.isTouched()) {
this.slicingCircles.add(new SlicingCircle(Gdx.input.getX(), Gdx.graphics.getHeight() - Gdx.input.getY(), this.slicingCircleVFX));
}
// Updates the slicing circles
for(SlicingCircle slicingCircle : this.slicingCircles){
slicingCircle.update(dt);
......@@ -165,7 +168,7 @@ public class FruitSlicerState extends PlayStateUnion {
// Four different emit modes: from left, from right, from entire bottom, and from bottom center with different velocity angles
int emitMode = (int) (Math.random() * 4);
Fruit fruit;
Texture fruitTexture = this.fruitTextures.get((int) (Math.random() * 20));
Texture fruitTexture = this.fruitTextures.get((int) (Math.random() * this.fruitTextures.size()));
Vector3 velocity = new Vector3(Gdx.graphics.getWidth() * 3 / 4, 0, 0);
int x, y, emitAngle;
......
......@@ -71,7 +71,7 @@ public abstract class PlayStateUnion extends State {
// Default font (black color)
font = new BitmapFont();
font.setColor(Color.BLACK);
font.getData().setScale((float) (Gdx.graphics.getWidth()/GameWare.WIDTH*1.75));
font.getData().setScale((float) (Gdx.graphics.getWidth()/GameWare.WIDTH*2.5));
}
// Override methods
......@@ -139,12 +139,13 @@ public abstract class PlayStateUnion extends State {
if(this.timeLeftVisible && this.totalGameTime > 0f) {
sb.begin();
// Time left
this.font.draw(sb, "Time: " + String.valueOf(Math.max(Math.round((this.totalGameTime - this.currentDuration) * 100), 0.00) / 100.0), Gdx.graphics.getWidth() / 40, Gdx.graphics.getHeight() - Gdx.graphics.getHeight() / 40 - Gdx.graphics.getHeight() / 60);
this.font.draw(sb, "Time: " + String.valueOf(Math.max(Math.round((this.totalGameTime - this.currentDuration) * 100), 0.00) / 100.0), Gdx.graphics.getWidth() / 40, Gdx.graphics.getHeight() - Gdx.graphics.getHeight() / 20);
sb.end();
}
if(this.currentScoreVisible){
sb.begin();
//Score
this.font.draw(sb, "Score: " + String.valueOf(this.score), Gdx.graphics.getWidth() / 40, Gdx.graphics.getHeight() - Gdx.graphics.getHeight() / 100);
sb.end();
......
......@@ -34,9 +34,10 @@ import com.gameware.game.states.State;
public abstract class MenuStateUnion extends State {
// Font
protected final float fontScale = 3f;
protected final float tinierTitleFontBigScale = 1.5f;
protected final float titleFontBigScale = 2.5f;
protected final float scaleRatio = Float.valueOf(Gdx.graphics.getWidth()) / 1080f;
protected final float fontScale = 3f * scaleRatio;
protected final float tinierTitleFontBigScale = 1.5f * scaleRatio;
protected final float titleFontBigScale = 2.5f * scaleRatio;
// Spacing
protected final float spacingLittle = Gdx.graphics.getHeight()/50;
......@@ -73,7 +74,10 @@ public abstract class MenuStateUnion extends State {
public MenuStateUnion(GameStateManager gsm){
super(gsm);
// Scales the font according to the ratio between the screen width and the default 1080 width
skin.getFont("font").getData().setScale(fontScale);
skin.getFont("font-big").getData().setScale(this.scaleRatio);
// Add sound effects
this.checkBoxSound = Gdx.audio.newSound(Gdx.files.internal("sfx/check_box.ogg"));
......
......@@ -139,7 +139,7 @@ public class ViewTournamentState extends MenuStateUnion {
rootTable.add(innerTable).colspan(2);
rootTable.row();
rootTable.add(makeBackBtn()).expand().bottom().left();
roundDeadline.setFontScale(0.8f);
roundDeadline.setFontScale(0.8f * super.scaleRatio);
rootTable.add(roundDeadline).expand().bottom().right();
stage.addActor(rootTable);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment