Skip to content

Commit

Permalink
Fixed some code smells from random files that I saw.
Browse files Browse the repository at this point in the history
  • Loading branch information
max9753 committed Oct 16, 2023
1 parent 5d41139 commit 858fa9b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ public class ForestGameArea extends GameArea {
"sounds/mobs/archerArrow.mp3"

};
private static final String backgroundMusic = "sounds/background/Sci-Fi1.ogg";
private static final String BACKGROUND_MUSIC = "sounds/background/Sci-Fi1.ogg";

private static final String[] forestMusic = {backgroundMusic};
private static final String[] forestMusic = {BACKGROUND_MUSIC};
private Entity player;
private Entity waves;

Expand Down Expand Up @@ -893,7 +893,7 @@ private void spawnDroidTower() {
}

private void playMusic() {
Music music = ServiceLocator.getResourceService().getAsset(backgroundMusic, Music.class);
Music music = ServiceLocator.getResourceService().getAsset(BACKGROUND_MUSIC, Music.class);
music.setLooping(true);
music.setVolume(0.3f);
music.play();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class CurrencyDisplay extends UIComponent {
private TextButton scrapsTb;
private TextButton crystalsTb;
private Sound clickSound;
private static final String defaultFont = "determination_mono_18";
private static final String DEFAULT_FONT = "determination_mono_18";

/**
* Adds actors to stage
Expand Down Expand Up @@ -63,7 +63,7 @@ private void addActors() {
private TextButton createButton(String imageFilePath, int value) {
Drawable drawable = new TextureRegionDrawable(new TextureRegion(new Texture(imageFilePath)));
TextButton.TextButtonStyle style = new TextButton.TextButtonStyle(
drawable, drawable, drawable, getSkin().getFont(defaultFont));
drawable, drawable, drawable, getSkin().getFont(DEFAULT_FONT));

// create button
TextButton tb = new TextButton(String.format("%d", value), style);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.TextTooltip;
import com.badlogic.gdx.scenes.scene2d.ui.TooltipManager;
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.utils.Align;
Expand All @@ -16,7 +15,7 @@

public class EngineerCountDisplay extends UIComponent {
private TextButton engineerTb;
private static final String defaultFont = "determination_mono_18";
private static final String DEFAULT_FONT = "determination_mono_18";

@Override
public void create() {
Expand All @@ -37,7 +36,7 @@ private void addActors() {
Drawable drawable = new TextureRegionDrawable(new TextureRegion(
new Texture("images/engineers/engineerBanner.png")));
TextButton.TextButtonStyle style = new TextButton.TextButtonStyle(
drawable, drawable, drawable, getSkin().getFont(defaultFont));
drawable, drawable, drawable, getSkin().getFont(DEFAULT_FONT));

String text = String.format("%d", ServiceLocator.getGameEndService().getEngineerCount());
engineerTb = new TextButton(text, style);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public class PauseMenuButtonComponent extends UIComponent {
private static final float Z_INDEX = 2f;
private Window window;
private final GdxGame game;
private static final float windowSizeX = 300;
private static final float windowSizeY = 400;
private static final float WINDOW_SIZE_X = 300;
private static final float WINDOW_SIZE_Y = 400;
private final String[] sounds = {
"sounds/ui/click/click_01.ogg",
"sounds/ui/open_close/close_01.ogg",
Expand Down Expand Up @@ -110,10 +110,10 @@ public void changed(ChangeEvent changeEvent, Actor actor) {
window.add(planetSelectBtn).center();
window.row();
window.add(mainMenuBtn).center();
window.setWidth(windowSizeX);
window.setHeight(windowSizeY);
window.setX((ServiceLocator.getRenderService().getStage().getWidth() / 2) - (windowSizeX / 2));
window.setY((ServiceLocator.getRenderService().getStage().getHeight() / 2) - (windowSizeY / 2));
window.setWidth(WINDOW_SIZE_X);
window.setHeight(WINDOW_SIZE_Y);
window.setX((ServiceLocator.getRenderService().getStage().getWidth() / 2) - (WINDOW_SIZE_X / 2));
window.setY((ServiceLocator.getRenderService().getStage().getHeight() / 2) - (WINDOW_SIZE_Y / 2));

stage.addActor(window);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class PauseMenuTimeStopComponent extends Component {

private Array<Entity> freezeList;
public PauseMenuTimeStopComponent() {
// Not implemented
}

/**
Expand Down

0 comments on commit 858fa9b

Please sign in to comment.