Add right side DialogueMenu
parent
e49c4cf4e8
commit
75257a29fe
|
@ -13,19 +13,28 @@ public class DialogueMenu extends TextBox implements Serializable {
|
|||
public BufferedImageWrapper PORTRAIT;
|
||||
public int currentFrame = 0;
|
||||
public int frameCounter = 0;
|
||||
public boolean isNarrator;
|
||||
|
||||
public DialogueMenu(int y, int yHeight, Font font, BufferedImageWrapper portrait) {
|
||||
public DialogueMenu(int y, int yHeight, Font font, BufferedImageWrapper portrait, boolean isNarrator) {
|
||||
super(y, GamePanel.GAME_WIDTH - PORTRAIT_WIDTH - PADDING*3, yHeight, 0, font, null, null);
|
||||
newX = PORTRAIT_WIDTH + PADDING*2;
|
||||
PORTRAIT = portrait;
|
||||
if (isNarrator) {
|
||||
newX = PORTRAIT_WIDTH + PADDING*2;
|
||||
} else {
|
||||
newX = PADDING;
|
||||
}
|
||||
this.isNarrator = isNarrator;
|
||||
}
|
||||
|
||||
public void drawCenteredTextBox(Graphics g, String text, Color backgroundColor, Color textColor) {
|
||||
text = text.substring(0, currentFrame);
|
||||
if (backgroundColor != null) {
|
||||
g.setColor(textColor);
|
||||
// TODO: make drawn line widths consistent
|
||||
if (isNarrator) {
|
||||
g.drawImage(PORTRAIT.image, newX - PORTRAIT_WIDTH - PADDING, newY, PORTRAIT_WIDTH, yHeight, null);
|
||||
} else {
|
||||
g.drawImage(PORTRAIT.image, GamePanel.GAME_WIDTH - PORTRAIT_WIDTH - PADDING, newY, PORTRAIT_WIDTH, yHeight, null);
|
||||
}
|
||||
((Graphics2D)g).setStroke(new BasicStroke(4f));
|
||||
g.drawRect(newX, newY, xWidth, yHeight - 4);
|
||||
g.setColor(backgroundColor);
|
||||
|
|
|
@ -85,7 +85,7 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ
|
|||
cloudTwoBackground = new BackgroundImage(600, 250, cloud2, cloud2.image.getWidth(), cloud3.image.getHeight(), 5, camera);
|
||||
cloudThreeBackground = new BackgroundImage(1000, 200, cloud3, cloud2.image.getWidth(), cloud3.image.getHeight(), 5, camera);
|
||||
pauseMenu = new PauseMenu(GAME_HEIGHT/2, 100, 400, 400, GAME_WIDTH, new Font(Font.MONOSPACED, Font.BOLD, 60), "Paused");
|
||||
dialogueMenu = new DialogueMenu(GAME_HEIGHT-100, 200, new Font(Font.MONOSPACED, Font.BOLD, 20), onePortrait);
|
||||
dialogueMenu = new DialogueMenu(GAME_HEIGHT-100, 200, new Font(Font.MONOSPACED, Font.BOLD, 20), onePortrait, true);
|
||||
dialogueArray.add("Lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum");
|
||||
dialogueArray.add("I told you so");
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue