Class ViewGUI2d

java.lang.Object
fr.formiko.views.gui2d.ViewGUI2d
All Implemented Interfaces:
fr.formiko.usual.Progression, View

public class ViewGUI2d extends Object implements View
View Graphics User Interface in 2 dimention.
Author:
Hydrolien
  • Field Details

    • actionGameOn

      private boolean actionGameOn
    • trich

      private ThTriche trich
    • f

      private FFrameMain f
      Main windows
    • fl

      private FFrameLauncher fl
    • needToWaitForGameLaunch

      private boolean needToWaitForGameLaunch
    • timer

      private Timer timer
    • curentFPS

      private int curentFPS
    • ccaseClicked

      private CCase ccaseClicked
    • moveMode

      private boolean moveMode
    • launchFromPm

      private volatile boolean launchFromPm
    • bladeChanged

      private boolean bladeChanged
    • thTemp1

      private Th thTemp1
    • thTemp2

      private Th thTemp2
    • haveAskToDownloadNewVersion

      private boolean haveAskToDownloadNewVersion
  • Constructor Details

    • ViewGUI2d

      public ViewGUI2d()
  • Method Details

    • getActionGameOn

      public boolean getActionGameOn()
      Specified by:
      getActionGameOn in interface View
    • getF

      public FFrameMain getF()
    • getFl

      public FFrameLauncher getFl()
    • getPp

      public FPanelPrincipal getPp()
    • getPj

      public FPanelJeu getPj()
    • getPm

      public FPanelMenu getPm()
    • getPnp

      public FPanelNouvellePartie getPnp()
    • getPGej

      public FPanelGEtiquetteJoueur getPGej()
    • getJcc

      public JColorChooser getJcc()
    • getPcp

      public FPanelChoixPartie getPcp()
    • getPb

      public FPanelBouton getPb()
    • getPText

      public FPanel getPText()
    • getPc

      public FPanelCarte getPc()
    • getPi

      public FPanelInfo getPi()
    • getPij

      public FPanelInfoText getPij()
    • getPz

      public FPanelZoom getPz()
    • getPigm

      public FPanelIngameMenu getPigm()
    • getPmu

      public FPanelMusic getPmu()
    • getPa

      public FPanelAction getPa()
    • getPch

      public FPanelChargement getPch()
    • getPs

      public FPanelSup getPs()
    • getPsd

      public FPanelSupDialog getPsd()
    • getPe

      public FPanelEchap getPe()
    • getPd

      public FPanelDialogue getPd()
    • getPdi

      public FPanelDialogueInf getPdi()
    • getPmmc

      public FPanelMiniMapContainer getPmmc()
    • getPmmo

      public FPanelPanelMove getPmmo()
    • getCurentFPS

      public int getCurentFPS()
    • setCurentFPS

      public void setCurentFPS(int x)
    • getWidth

      public int getWidth()
    • getHeight

      public int getHeight()
    • setLaunchFromPm

      public void setLaunchFromPm(boolean b)
    • getBladeChanged

      public boolean getBladeChanged()
    • setBladeChanged

      public void setBladeChanged(boolean b)
    • ini

      public boolean ini()
      Initialize all the thing that need to be Initialize before using view.
      Specified by:
      ini in interface View
      Returns:
      Return true if it work well. (Nothing goes wrong.)
    • close

      public boolean close()
      close all the thing that need to be close after using view.
      Specified by:
      close in interface View
      Returns:
      Return true if it work well. (Nothing goes wrong.)
    • paint

      public boolean paint()
      Refrech actual view without constant fps.
      Specified by:
      paint in interface View
      Returns:
      Return true if it work well. (Nothing goes wrong.)
    • paintGUI

      public boolean paintGUI()
      Refrech actual view with constant fps.
      It use timer & patch all Java swing issues.
      Returns:
      Return true if it work well. (Nothing goes wrong.)
    • actionGame

      public boolean actionGame()
      Launch action game part.
      Specified by:
      actionGame in interface View
      Returns:
      Return true if it work well. (Nothing goes wrong.)
    • pauseActionGame

      public int pauseActionGame()
      Stop game and print the escape menu.
      This action can only be run if action game is on.
      Specified by:
      pauseActionGame in interface View
      Returns:
      Return true if it work well. (Nothing goes wrong.)
    • endActionGame

      public boolean endActionGame(boolean withButton, int nextLevel, String message, GJoueur gj, boolean canResumeGame)
      Stop game and print the end menu.
      This action can only be run if action game is on.
      Specified by:
      endActionGame in interface View
      Parameters:
      withButton - true if we need to add button "return to main menu" and "next level".
      nextLevel - the number of the next level to link to the button. -1 = no next level.
      message - message to print.
      gj - sorted player list to print.
      Returns:
      Return true if it work well. (Nothing goes wrong.)
    • setLookedCCase

      public boolean setLookedCCase(CCase cc)
      Change the value of the loked Case.
      We need to repaint the information about this Case.
      This action can only be run if action game is on.
      Specified by:
      setLookedCCase in interface View
      Returns:
      Return true if it work well. (Nothing goes wrong.)
    • getLookedCCase

      public CCase getLookedCCase()
      Return the value of the looked CCase.
      This action can only be run if action game is on.
      Specified by:
      getLookedCCase in interface View
      Returns:
      lookedCCase.
    • getAntChoice

      public int getAntChoice(int[] t)
      Return the chosen value for ant action.
      It update button panel. Then it wait for the ant to be notify when button panel get an input.
      This action can only be run if action game is on.
      Specified by:
      getAntChoice in interface View
      Parameters:
      t - Array of aviable action id
      Returns:
      Return ant choice.
    • getCCase

      public CCase getCCase()
      Return the chosen CCase.
      It is used to move ant.
      Specified by:
      getCCase in interface View
    • setCCase

      public void setCCase(CCase cc)
    • message

      public void message(String message, boolean doWeNeedToDoNextCmdNow)
      Print a message.
      If message.equals("") we may need to delete last message, but we don't need to print a new message.
      Specified by:
      message in interface View
      Parameters:
      message - the message to print.
      doWeNeedToDoNextCmdNow - true if we need to do next commande now.
    • loadingMessage

      public void loadingMessage(String message, int percentageDone)
      Print a loading message.
      Specified by:
      loadingMessage in interface View
      Parameters:
      message - the message to print.
      percentageDone - the percentage of loading curently done.
    • popUpMessage

      public void popUpMessage(String message)
      Print a message in a new window.
      Specified by:
      popUpMessage in interface View
      Parameters:
      message - the message to print.
    • popUpQuestion

      public String popUpQuestion(String message)
      Print a question in a new window.
      Specified by:
      popUpQuestion in interface View
      Parameters:
      message - the message to print.
      Returns:
      the answer.
    • popUpQuestionYN

      public boolean popUpQuestionYN(String message, boolean important, fr.formiko.usual.CheckFunction cf)
      Print a question in a new window.
      Specified by:
      popUpQuestionYN in interface View
      Parameters:
      message - the message to print.
      important - some gui action will be done if true
      cf - CheckFunction to use to get text, default checked & launch function
      Returns:
      the answer as a boolean.
    • closeFPanelChargement

      public void closeFPanelChargement()
      remove FPanelChargement & listen mouse clic on the map.
    • setPlayingAnt

      public void setPlayingAnt(Fourmi f)
      set playing ant.
      This action can only be run if action game is on.
      Specified by:
      setPlayingAnt in interface View
    • move

      public void move(ObjetSurCarteAId o, CCase from, CCase to)
      Move ObjetSurCarteAId.
      This action can only be run if action game is on.
      Specified by:
      move in interface View
      Parameters:
      o - object to move.
      from - CCase that o leave.
      to - CCase were o is going.
    • waitForEndTurn

      public void waitForEndTurn()
      Wait for end turn if we need.
      Specified by:
      waitForEndTurn in interface View
    • waitForGameLaunch

      public void waitForGameLaunch()
      A loop to wait for game launch.
    • iniLauncher

      public void iniLauncher()
      Initialize the game launcher.
      Specified by:
      iniLauncher in interface fr.formiko.usual.Progression
    • closeLauncher

      public void closeLauncher()
      Close the game launcher.
      Specified by:
      closeLauncher in interface fr.formiko.usual.Progression
    • setDownloadingMessage

      public void setDownloadingMessage(String message)
      Update downloading message.
      Specified by:
      setDownloadingMessage in interface fr.formiko.usual.Progression
      Parameters:
      message - the message
    • setDownloadingValue

      public void setDownloadingValue(int state)
      Update downloading %age.
      Specified by:
      setDownloadingValue in interface fr.formiko.usual.Progression
      Parameters:
      state - the state as a %age
    • setButtonRetryVisible

      public void setButtonRetryVisible(boolean visible)
      Hide or show buttonRetry of FFrameLauncher.
      Specified by:
      setButtonRetryVisible in interface fr.formiko.usual.Progression
    • setMessageDesc

      public void setMessageDesc(String message, boolean mouseLocated)
      set the description message.
      Description message can be mouse located or not. Mouse located message are used when they concerne only small grpahics items.
      Null safe.
      Parameters:
      message - the message to print as description
      mouseLocated - if true message is print at mouse location, only if mouse don't move
    • setMessageDesc

      public void setMessageDesc(String message)
      set the description message.
      Description message can be mouse located or not. Mouse located message are used when they concerne only small grpahics items.
      MouseLocated is false. Null safe.
      Parameters:
      message - the message to print as description
    • getMoveMode

      public boolean getMoveMode()
      True if in moveMode.
      Specified by:
      getMoveMode in interface View
    • setMoveMode

      public void setMoveMode(boolean b)
      Description copied from interface: View
      Default fontion to move.
      Specified by:
      setMoveMode in interface View
    • centerOverCase

      public void centerOverCase(Case c)
      Center map panel over a Case.
      Specified by:
      centerOverCase in interface View
      Parameters:
      c - case to center over
    • isBladesEnable

      public boolean isBladesEnable()
      True if grass blades are enable.
      Specified by:
      isBladesEnable in interface View
    • makeUserChooseOnArray

      public String makeUserChooseOnArray(String[] array, String varName)
      Make user choose in a String array.
      Specified by:
      makeUserChooseOnArray in interface View
      Parameters:
      array - the array where to choose
      varName - the name of the variable tp choose
    • makeUserChooseInt

      public int makeUserChooseInt(int min, int max, String varName)
      Make user choose an int in [min, max].
      Specified by:
      makeUserChooseInt in interface View
      Parameters:
      min - the min value
      max - the max value
      varName - the name of the variable tp choose
    • getData

      public Data getData()
    • setNextPlayingAnt

      public void setNextPlayingAnt(Fourmi f)
      Define this as the next playing ant.
    • loadGraphics

      private void loadGraphics()
      Load graphics during menu time.
    • waitForPanelLoadDone

      private void waitForPanelLoadDone()
      Wait that all Thread that we need to launch game are OK.
    • iniThTriche

      private void iniThTriche()
      Initialize cheat code listener if it haven't been yet.
    • iniDiscordIntergation

      private void iniDiscordIntergation()
      Initialize the discord integration.
    • launchFrameRefresh

      private void launchFrameRefresh()
      Launch refrech of main Frame.
      It have been add to solve all GUI issues of Java Swing.
      It use 1 timer and a simple refrech task repeat fps times per second.
    • printPanelInfo

      private void printPanelInfo()
      Tool to print mains FPanelx infos.
    • iniFont

      private void iniFont()
      ini font at default value for all graphics components.
    • doNotNeedToEndTurnAuto

      private boolean doNotNeedToEndTurnAuto()
      return endTurnAuto depending of Options & endTurn button.