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 boolean
private boolean
private CCase
private int
private FFrameMain
Main windowsprivate FFrameLauncher
private boolean
private boolean
private boolean
private boolean
private Th
private Th
private Timer
private ThTriche
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Launch action game part.void
Center map panel over a Case.boolean
close()
close all the thing that need to be close after using view.void
remove FPanelChargement & listen mouse clic on the map.void
Close the game launcher.private boolean
return endTurnAuto depending of Options & endTurn button.boolean
endActionGame
(boolean withButton, int nextLevel, String message, GJoueur gj, boolean canResumeGame) Stop game and print the end menu.boolean
int
getAntChoice
(int[] t) Return the chosen value for ant action.boolean
getCCase()
Return the chosen CCase.int
getData()
getF()
getFl()
int
getJcc()
Return the value of the looked CCase.boolean
True 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()
int
getWidth()
boolean
ini()
Initialize all the thing that need to be Initialize before using view.private void
Initialize the discord integration.private void
iniFont()
ini font at default value for all graphics components.void
Initialize the game launcher.private void
Initialize cheat code listener if it haven't been yet.boolean
True if grass blades are enable.private void
Launch refrech of main Frame.private void
Load graphics during menu time.void
loadingMessage
(String message, int percentageDone) Print a loading message.int
makeUserChooseInt
(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.boolean
Load the save load menu.boolean
menuMain()
Load main menu.boolean
Load new game menu.boolean
options menu.boolean
personalise a game menu.void
Print a message.void
move
(ObjetSurCarteAId o, CCase from, CCase to) Move ObjetSurCarteAId.boolean
paint()
Refrech actual view without constant fps.boolean
paintGUI()
Refrech actual view with constant fps.int
Stop game and print the escape menu.void
popUpMessage
(String message) Print a message in a new window.popUpQuestion
(String message) Print a question in a new window.boolean
popUpQuestionYN
(String message, boolean important, fr.formiko.usual.CheckFunction cf) Print a question in a new window.private void
Tool to print mains FPanelx infos.void
setBladeChanged
(boolean b) void
setButtonRetryVisible
(boolean visible) Hide or show buttonRetry of FFrameLauncher.void
void
setCurentFPS
(int x) void
setDownloadingMessage
(String message) Update downloading message.void
setDownloadingValue
(int state) Update downloading %age.void
setLaunchFromPm
(boolean b) boolean
setLookedCCase
(CCase cc) Change the value of the loked Case.void
setMessageDesc
(String message) set the description message.void
setMessageDesc
(String message, boolean mouseLocated) set the description message.void
setMoveMode
(boolean b) Default fontion to move.void
Define this as the next playing ant.void
set playing ant.void
Wait for end turn if we need.void
A loop to wait for game launch.private void
Wait 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, wait
Methods 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:
getActionGameOn
in 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:
actionGame
in 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:
pauseActionGame
in 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:
endActionGame
in 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:
setLookedCCase
in 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:
getLookedCCase
in 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:
getAntChoice
in 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:
loadingMessage
in interfaceView
- Parameters:
message
- the message to print.percentageDone
- the percentage of loading curently done.
-
popUpMessage
Print a message in a new window.- Specified by:
popUpMessage
in interfaceView
- Parameters:
message
- the message to print.
-
popUpQuestion
Print a question in a new window.- Specified by:
popUpQuestion
in 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:
popUpQuestionYN
in 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:
setPlayingAnt
in 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:
waitForEndTurn
in interfaceView
-
waitForGameLaunch
public void waitForGameLaunch()A loop to wait for game launch. -
iniLauncher
public void iniLauncher()Initialize the game launcher.- Specified by:
iniLauncher
in interfacefr.formiko.usual.Progression
-
closeLauncher
public void closeLauncher()Close the game launcher.- Specified by:
closeLauncher
in interfacefr.formiko.usual.Progression
-
setDownloadingMessage
Update downloading message.- Specified by:
setDownloadingMessage
in interfacefr.formiko.usual.Progression
- Parameters:
message
- the message
-
setDownloadingValue
public void setDownloadingValue(int state) Update downloading %age.- Specified by:
setDownloadingValue
in 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:
setButtonRetryVisible
in 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:
getMoveMode
in interfaceView
-
setMoveMode
public void setMoveMode(boolean b) Description copied from interface:View
Default fontion to move.- Specified by:
setMoveMode
in interfaceView
-
centerOverCase
Center map panel over a Case.- Specified by:
centerOverCase
in interfaceView
- Parameters:
c
- case to center over
-
isBladesEnable
public boolean isBladesEnable()True if grass blades are enable.- Specified by:
isBladesEnable
in interfaceView
-
makeUserChooseOnArray
Make user choose in a String array.- Specified by:
makeUserChooseOnArray
in 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:
makeUserChooseInt
in 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.
-