package com.lucasdnd.ags.ui;
import org.newdawn.slick.Font;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;
import com.lucasdnd.ags.gameplay.Business;
import com.lucasdnd.ags.gameplay.market.Market;
import com.lucasdnd.ags.system.MainState;
public class FinancesPanel extends Panel {
private ManagementList managementList;
private FinancesList financesList;
public FinancesPanel(String title, float xPos, float yPos, float width, float height,
Business business, Market market) throws SlickException {
// Super
super(title, xPos, yPos, width, height);
managementList = new ManagementList(xPos, yPos + 12f, width, height, business, market);
financesList = new FinancesList(xPos, yPos + 200f, width, height, business);
}
public void update(GameContainer container, StateBasedGame game, Business business, int delta,
MainState mainState, boolean leftMouseClicked, int mouseX, int mouseY, boolean leftMouseDown, boolean isShiftDown) throws SlickException {
managementList.update(container, game, delta, mainState, business, leftMouseClicked, leftMouseDown, mouseX, mouseY, isShiftDown);
financesList.update(container, game, delta, mainState, business, leftMouseClicked, mouseX, mouseY);
}
public void render(GameContainer container, StateBasedGame game, Graphics g, Font panelFont, Font disabledFont, Font shadowFont) throws SlickException {
// Let the Panel render
super.render(container, game, g, panelFont, shadowFont);
if(visible) {
managementList.render(container, game, g, panelFont, disabledFont, shadowFont);
financesList.render(container, game, g, panelFont, disabledFont, shadowFont);
}
}
@Override
public boolean gotLeftClicked(boolean leftMouseClicked, int mouseX, int mouseY) {
if((leftMouseClicked) &&
(mouseX >= this.xPos && mouseX <= this.xPos + this.width) &&
(mouseY >= this.yPos && mouseY <= this.yPos + this.height)
)
return true;
return false;
}
@Override
public boolean gotRightClicked(boolean rightMouseClicked, int mouseX, int mouseY) {
if((rightMouseClicked) &&
(mouseX >= this.xPos && mouseX <= this.xPos + this.width) &&
(mouseY >= this.yPos && mouseY <= this.yPos + this.height)
)
return true;
return false;
}
public FinancesList getFinancesList() {
return financesList;
}
}