public void frame__windowStateChanged(WindowEvent e) { if ((e.getNewState() & Frame.ICONIFIED) == Frame.ICONIFIED) { stateMachine.minimized = true; KeyHook.unblockWindowsKey(); } else if ((e.getNewState() & Frame.NORMAL) == Frame.NORMAL) { stateMachine.minimized = false; KeyHook.blockWindowsKey(); } }
public void keyPressed() { if (keyCode == ESC || key == ESC) { key = 0; keyCode = 0; stateMachine.Pop(); } }
public void setup() { size((int) (displayWidth * SCALE), (int) (displayWidth * SCALE / ASPECT_RATIO), P2D); // size(1920,1080); frame.setTitle("Customer Simulator v0.0.1"); KeyHook.blockWindowsKey(); ui = new ControlP5(this); String dir = System.getProperty("user.dir"); font = createFont(dir + "/src/Data/arialbd.ttf", 48); stateMachine = new StateMachine(); stateMachine.Push(new States.State_1(this, ui, font)); }
@Override public void endEvent() { if (turn == 2) { // The way the battle ends if you win. StateMachine.Change("StartGame"); StateMachine.Remove("BattleState"); } else if (turn == 3) { // The way the battle ends if you die StateMachine.Change("MainMenu"); StateMachine.Remove("BattleState"); } else if (turn == 4) { // The way the battle ends if you run away StateMachine.Change("StartGame"); StateMachine.Remove("BattleState"); } }
public void draw() { stateMachine.Update(); stateMachine.Render(); }