Package fr.formiko.views.gui2d
Class ViewGUI2d
java.lang.Object
fr.formiko.views.gui2d.ViewGUI2d
- All Implemented Interfaces:
fr.formiko.usual.Progression,View
View Graphics User Interface in 2 dimention.
- Author:
- Hydrolien
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate booleanprivate CCaseprivate intprivate FFrameMainMain windowsprivate FFrameLauncherprivate booleanprivate booleanprivate booleanprivate booleanprivate Thprivate Thprivate Timerprivate ThTriche -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanLaunch action game part.voidCenter map panel over a Case.booleanclose()close all the thing that need to be close after using view.voidremove FPanelChargement & listen mouse clic on the map.voidClose the game launcher.private booleanreturn endTurnAuto depending of Options & endTurn button.booleanendActionGame(boolean withButton, int nextLevel, String message, GJoueur gj, boolean canResumeGame) Stop game and print the end menu.booleanintgetAntChoice(int[] t) Return the chosen value for ant action.booleangetCCase()Return the chosen CCase.intgetData()getF()getFl()intgetJcc()Return the value of the looked CCase.booleanTrue if in moveMode.getPa()getPb()getPc()getPch()getPcp()getPd()getPdi()getPe()getPGej()getPi()getPigm()getPij()getPj()getPm()getPmmc()getPmmo()getPmu()getPnp()getPp()getPs()getPsd()getPText()getPz()intgetWidth()booleanini()Initialize all the thing that need to be Initialize before using view.private voidInitialize the discord integration.private voidiniFont()ini font at default value for all graphics components.voidInitialize the game launcher.private voidInitialize cheat code listener if it haven't been yet.booleanTrue if grass blades are enable.private voidLaunch refrech of main Frame.private voidLoad graphics during menu time.voidloadingMessage(String message, int percentageDone) Print a loading message.intmakeUserChooseInt(int min, int max, String varName) Make user choose an int in [min, max].makeUserChooseOnArray(String[] array, String varName) Make user choose in a String array.booleanLoad the save load menu.booleanmenuMain()Load main menu.booleanLoad new game menu.booleanoptions menu.booleanpersonalise a game menu.voidPrint a message.voidmove(ObjetSurCarteAId o, CCase from, CCase to) Move ObjetSurCarteAId.booleanpaint()Refrech actual view without constant fps.booleanpaintGUI()Refrech actual view with constant fps.intStop game and print the escape menu.voidpopUpMessage(String message) Print a message in a new window.popUpQuestion(String message) Print a question in a new window.booleanpopUpQuestionYN(String message, boolean important, fr.formiko.usual.CheckFunction cf) Print a question in a new window.private voidTool to print mains FPanelx infos.voidsetBladeChanged(boolean b) voidsetButtonRetryVisible(boolean visible) Hide or show buttonRetry of FFrameLauncher.voidvoidsetCurentFPS(int x) voidsetDownloadingMessage(String message) Update downloading message.voidsetDownloadingValue(int state) Update downloading %age.voidsetLaunchFromPm(boolean b) booleansetLookedCCase(CCase cc) Change the value of the loked Case.voidsetMessageDesc(String message) set the description message.voidsetMessageDesc(String message, boolean mouseLocated) set the description message.voidsetMoveMode(boolean b) Default fontion to move.voidDefine this as the next playing ant.voidset playing ant.voidWait for end turn if we need.voidA loop to wait for game launch.private voidWait that all Thread that we need to launch game are OK.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface fr.formiko.views.View
popUpQuestionYN, popUpQuestionYN
-
Field Details
-
actionGameOn
private boolean actionGameOn -
trich
-
f
Main windows -
fl
-
needToWaitForGameLaunch
private boolean needToWaitForGameLaunch -
timer
-
curentFPS
private int curentFPS -
ccaseClicked
-
moveMode
private boolean moveMode -
launchFromPm
private volatile boolean launchFromPm -
bladeChanged
private boolean bladeChanged -
thTemp1
-
thTemp2
-
haveAskToDownloadNewVersion
private boolean haveAskToDownloadNewVersion
-
-
Constructor Details
-
ViewGUI2d
public ViewGUI2d()
-
-
Method Details
-
getActionGameOn
public boolean getActionGameOn()- Specified by:
getActionGameOnin interfaceView
-
getF
-
getFl
-
getPp
-
getPj
-
getPm
-
getPnp
-
getPGej
-
getJcc
-
getPcp
-
getPb
-
getPText
-
getPc
-
getPi
-
getPij
-
getPz
-
getPigm
-
getPmu
-
getPa
-
getPch
-
getPs
-
getPsd
-
getPe
-
getPd
-
getPdi
-
getPmmc
-
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. -
close
public boolean close()close all the thing that need to be close after using view. -
paint
public boolean paint()Refrech actual view without constant fps. -
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:
actionGamein interfaceView- 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:
pauseActionGamein interfaceView- 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:
endActionGamein interfaceView- 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
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:
setLookedCCasein interfaceView- Returns:
- Return true if it work well. (Nothing goes wrong.)
-
getLookedCCase
Return the value of the looked CCase.
This action can only be run if action game is on.- Specified by:
getLookedCCasein interfaceView- 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:
getAntChoicein interfaceView- Parameters:
t- Array of aviable action id- Returns:
- Return ant choice.
-
getCCase
Return the chosen CCase.
It is used to move ant. -
setCCase
-
message
Print a message.
If message.equals("") we may need to delete last message, but we don't need to print a new message. -
loadingMessage
Print a loading message.- Specified by:
loadingMessagein interfaceView- Parameters:
message- the message to print.percentageDone- the percentage of loading curently done.
-
popUpMessage
Print a message in a new window.- Specified by:
popUpMessagein interfaceView- Parameters:
message- the message to print.
-
popUpQuestion
Print a question in a new window.- Specified by:
popUpQuestionin interfaceView- 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:
popUpQuestionYNin interfaceView- Parameters:
message- the message to print.important- some gui action will be done if truecf- 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
set playing ant.
This action can only be run if action game is on.- Specified by:
setPlayingAntin interfaceView
-
move
Move ObjetSurCarteAId.
This action can only be run if action game is on. -
waitForEndTurn
public void waitForEndTurn()Wait for end turn if we need.- Specified by:
waitForEndTurnin interfaceView
-
waitForGameLaunch
public void waitForGameLaunch()A loop to wait for game launch. -
iniLauncher
public void iniLauncher()Initialize the game launcher.- Specified by:
iniLauncherin interfacefr.formiko.usual.Progression
-
closeLauncher
public void closeLauncher()Close the game launcher.- Specified by:
closeLauncherin interfacefr.formiko.usual.Progression
-
setDownloadingMessage
Update downloading message.- Specified by:
setDownloadingMessagein interfacefr.formiko.usual.Progression- Parameters:
message- the message
-
setDownloadingValue
public void setDownloadingValue(int state) Update downloading %age.- Specified by:
setDownloadingValuein interfacefr.formiko.usual.Progression- Parameters:
state- the state as a %age
-
setButtonRetryVisible
public void setButtonRetryVisible(boolean visible) Hide or show buttonRetry of FFrameLauncher.- Specified by:
setButtonRetryVisiblein interfacefr.formiko.usual.Progression
-
setMessageDesc
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 descriptionmouseLocated- if true message is print at mouse location, only if mouse don't move
-
setMessageDesc
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:
getMoveModein interfaceView
-
setMoveMode
public void setMoveMode(boolean b) Description copied from interface:ViewDefault fontion to move.- Specified by:
setMoveModein interfaceView
-
centerOverCase
Center map panel over a Case.- Specified by:
centerOverCasein interfaceView- Parameters:
c- case to center over
-
isBladesEnable
public boolean isBladesEnable()True if grass blades are enable.- Specified by:
isBladesEnablein interfaceView
-
makeUserChooseOnArray
Make user choose in a String array.- Specified by:
makeUserChooseOnArrayin interfaceView- Parameters:
array- the array where to choosevarName- the name of the variable tp choose
-
makeUserChooseInt
Make user choose an int in [min, max].- Specified by:
makeUserChooseIntin interfaceView- Parameters:
min- the min valuemax- the max valuevarName- the name of the variable tp choose
-
getData
-
setNextPlayingAnt
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.
-