-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/UQcsse3200/2024-studio-3 in…
…to team1/debugging
- Loading branch information
Showing
34 changed files
with
906 additions
and
707 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
122 changes: 58 additions & 64 deletions
122
source/core/src/main/com/csse3200/game/components/mainmenu/MainMenuBackground.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,70 @@ | ||
package com.csse3200.game.components.mainmenu; | ||
|
||
import com.badlogic.gdx.Gdx; | ||
import com.badlogic.gdx.graphics.Texture; | ||
import com.badlogic.gdx.graphics.g2d.SpriteBatch; | ||
import com.badlogic.gdx.scenes.scene2d.Stage; | ||
import com.badlogic.gdx.scenes.scene2d.ui.Image; | ||
import com.badlogic.gdx.scenes.scene2d.ui.Table; | ||
import com.csse3200.game.components.maingame.PauseMenuDisplay; | ||
import com.csse3200.game.services.ServiceLocator; | ||
import com.csse3200.game.ui.UIComponent; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class MainMenuBackground extends UIComponent{ | ||
|
||
private Table table; | ||
private static final Logger logger = LoggerFactory.getLogger(PauseMenuDisplay.class); | ||
private static final String[] backgroundTextures = {"images/Cutscenes/bg.png"}; | ||
|
||
private float screenWidth = Gdx.graphics.getWidth(); | ||
private float screenHeight = Gdx.graphics.getHeight(); | ||
private String image; | ||
|
||
public MainMenuBackground() { | ||
super(); | ||
} | ||
|
||
@Override | ||
public void create() { | ||
super.create(); | ||
table = new Table(); | ||
table.setFillParent(true); | ||
table.setVisible(true); | ||
stage.addActor(table); | ||
ServiceLocator.getResourceService().loadTextures(backgroundTextures); | ||
|
||
setupBackground(); | ||
} | ||
|
||
public void setupBackground() { | ||
Texture texture = ServiceLocator.getResourceService().getAsset("images/Cutscenes/bg.png", | ||
Texture.class); | ||
Image image = new Image(texture); | ||
image.setFillParent(true); | ||
setImage("images/Cutscenes/bg.png"); | ||
table.add(image); | ||
} | ||
|
||
@Override | ||
protected void draw(SpriteBatch batch) { | ||
} | ||
|
||
@Override | ||
public void setStage(Stage mock) { | ||
} | ||
|
||
public void setTable(Table table) { | ||
this.table = table; | ||
} | ||
|
||
public void setImage(String image){ | ||
this.image = image; | ||
} | ||
|
||
public String getImage(){ | ||
return this.image; | ||
} | ||
|
||
public String getImage(Table table){ | ||
return table.getChildren().get(0).toString(); | ||
} | ||
|
||
|
||
public class MainMenuBackground extends UIComponent { | ||
|
||
private Table table; | ||
private static final Logger logger = LoggerFactory.getLogger(MainMenuBackground.class); // Updated to use MainMenuBackground.class | ||
private static final String BACKGROUND_IMAGE_PATH = "images/Cutscenes/bg.png"; // Defined constant for repeated string | ||
private static final String[] backgroundTextures = {BACKGROUND_IMAGE_PATH}; | ||
|
||
private String image; | ||
|
||
public MainMenuBackground() { | ||
super(); | ||
} | ||
|
||
@Override | ||
public void create() { | ||
super.create(); | ||
table = new Table(); | ||
table.setFillParent(true); | ||
table.setVisible(true); | ||
stage.addActor(table); | ||
ServiceLocator.getResourceService().loadTextures(backgroundTextures); | ||
|
||
setupBackground(); | ||
} | ||
|
||
public void setupBackground() { | ||
Texture texture = ServiceLocator.getResourceService().getAsset(BACKGROUND_IMAGE_PATH, Texture.class); // Used constant for image path | ||
Image bgImage = new Image(texture); // Renamed local variable to avoid conflict with the field 'image' | ||
bgImage.setFillParent(true); | ||
setImage(BACKGROUND_IMAGE_PATH); | ||
table.add(bgImage); | ||
} | ||
|
||
@Override | ||
protected void draw(SpriteBatch batch) { | ||
// Method intentionally left empty (addressed empty method warning) | ||
} | ||
|
||
@Override | ||
public void setStage(Stage mock) { | ||
// Method intentionally left empty (addressed empty method warning) | ||
} | ||
|
||
public void setTable(Table table) { | ||
this.table = table; | ||
} | ||
|
||
public void setImage(String image) { | ||
this.image = image; | ||
} | ||
|
||
public String getImage() { | ||
return this.image; | ||
} | ||
|
||
public String getImage(Table table) { | ||
return table.getChildren().get(0).toString(); | ||
} | ||
} | ||
|
Oops, something went wrong.