Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
the_dungeon_project
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
12
Issues
12
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
genie_logiciel_2015
the_dungeon_project
Commits
54ef1f2f
Commit
54ef1f2f
authored
Jan 04, 2016
by
Huot Mathieu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input config bug fixed
parent
826cac06
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
148 additions
and
36 deletions
+148
-36
configuration.txt~
configuration.txt~
+52
-0
src/assets/configuration/configuration.txt
src/assets/configuration/configuration.txt
+31
-0
src/graphics/graphical_abstraction/panel/menu/ConfigurationPanelAbstractionController.java
...n/panel/menu/ConfigurationPanelAbstractionController.java
+8
-8
src/graphics/guiSkeleton/guiPanel/menuPanel/configuration/ConfigurationFrame.java
.../guiPanel/menuPanel/configuration/ConfigurationFrame.java
+2
-0
src/graphics/guiSkeleton/guiPanel/menuPanel/configuration/ConfigurationPanel.java
.../guiPanel/menuPanel/configuration/ConfigurationPanel.java
+22
-22
src/graphics/ingame_input_listener/InputConfiguration.java
src/graphics/ingame_input_listener/InputConfiguration.java
+33
-6
No files found.
configuration.txt~
0 → 100644
View file @
54ef1f2f
################### THIS FILE IS USED TO HAVE PERSISTENT COMMANDS IN THE GAME ###################
#################################################################################################
###################
MOVE UP:
Left arrow
###################
MOVE DOWN:
Down arrow
###################
MOVE RIGHT:
Right arrow
###################
MOVE LEFT:
Left arrow
###################
ATTACK:
a
###################
ABILITY 1:
z
###################
ABILITY 2:
e
###################
ABILITY 3:
r
###################
BACK TO MAIN:
Escape
###################
###################
###################
###################
###################
###################
###################
###################
src/assets/configuration/configuration.txt
0 → 100644
View file @
54ef1f2f
################### THIS FILE IS USED TO HAVE PERSISTENT COMMANDS IN THE GAME ###################
#################################################################################################
###################
MOVE UP:
Left arrow
###################
MOVE DOWN:
Down arrow
###################
MOVE RIGHT:
Right arrow
###################
MOVE LEFT:
Left arrow
###################
ATTACK:
a
###################
ABILITY 1:
z
###################
ABILITY 2:
e
###################
ABILITY 3:
r
###################
BACK TO MAIN:
Escape
###################
src/graphics/graphical_abstraction/panel/menu/ConfigurationPanelAbstractionController.java
View file @
54ef1f2f
...
@@ -19,14 +19,14 @@ public class ConfigurationPanelAbstractionController extends MenuPanelAbstractio
...
@@ -19,14 +19,14 @@ public class ConfigurationPanelAbstractionController extends MenuPanelAbstractio
//To handle the ask from the user to change the configuration of an input
//To handle the ask from the user to change the configuration of an input
public
void
ConfigUpButtonPressed
(){
this
.
configurationMenuPanel
.
ChangeMoveUpConfig
();}
public
void
ConfigUpButtonPressed
(){
this
.
configurationMenuPanel
.
ChangeMoveUpConfig
();}
public
void
ConfigDownButtonPressed
(){
this
.
configurationMenuPanel
.
ChangeMove
Up
Config
();}
public
void
ConfigDownButtonPressed
(){
this
.
configurationMenuPanel
.
ChangeMove
Down
Config
();}
public
void
ConfigRightButtonPressed
(){
this
.
configurationMenuPanel
.
ChangeMove
Up
Config
();}
public
void
ConfigRightButtonPressed
(){
this
.
configurationMenuPanel
.
ChangeMove
Right
Config
();}
public
void
ConfigLeftButtonPressed
(){
this
.
configurationMenuPanel
.
ChangeMove
Up
Config
();}
public
void
ConfigLeftButtonPressed
(){
this
.
configurationMenuPanel
.
ChangeMove
Left
Config
();}
public
void
ConfigAttackButtonPressed
(){
this
.
configurationMenuPanel
.
Change
MoveUp
Config
();}
public
void
ConfigAttackButtonPressed
(){
this
.
configurationMenuPanel
.
Change
Attack
Config
();}
public
void
ConfigAbility1ButtonPressed
(){
this
.
configurationMenuPanel
.
Change
MoveUp
Config
();}
public
void
ConfigAbility1ButtonPressed
(){
this
.
configurationMenuPanel
.
Change
Ability1
Config
();}
public
void
ConfigAbility2ButtonPressed
(){
this
.
configurationMenuPanel
.
Change
MoveUp
Config
();}
public
void
ConfigAbility2ButtonPressed
(){
this
.
configurationMenuPanel
.
Change
Ability2
Config
();}
public
void
ConfigAbility3ButtonPressed
(){
this
.
configurationMenuPanel
.
Change
MoveUp
Config
();}
public
void
ConfigAbility3ButtonPressed
(){
this
.
configurationMenuPanel
.
Change
Ability3
Config
();}
public
void
ConfigBackToMainButtonPressed
(){
this
.
configurationMenuPanel
.
Change
MoveUp
Config
();}
public
void
ConfigBackToMainButtonPressed
(){
this
.
configurationMenuPanel
.
Change
BackToMain
Config
();}
//To handle the ask from the user to get back to the main menu
//To handle the ask from the user to get back to the main menu
public
void
BackButtonPressed
(){
this
.
configurationMenuPanel
.
BackToMainMenu
();}
public
void
BackButtonPressed
(){
this
.
configurationMenuPanel
.
BackToMainMenu
();}
}
}
\ No newline at end of file
src/graphics/guiSkeleton/guiPanel/menuPanel/configuration/ConfigurationFrame.java
View file @
54ef1f2f
...
@@ -23,6 +23,7 @@ public class ConfigurationFrame extends Frame implements ActionListener{
...
@@ -23,6 +23,7 @@ public class ConfigurationFrame extends Frame implements ActionListener{
this
.
setSize
(
600
,
600
);
this
.
setSize
(
600
,
600
);
this
.
setVisible
(
true
);
this
.
setVisible
(
true
);
this
.
conf
=
conf
;
this
.
conf
=
conf
;
// monoalphabetic keys
// monoalphabetic keys
String
simpleKeyboard
=
"abcdefghijklmnopqrstuvwxyz0123456789+-*(_)=,;:!^$/"
;
String
simpleKeyboard
=
"abcdefghijklmnopqrstuvwxyz0123456789+-*(_)=,;:!^$/"
;
Button
button
;
Button
button
;
...
@@ -148,6 +149,7 @@ public class ConfigurationFrame extends Frame implements ActionListener{
...
@@ -148,6 +149,7 @@ public class ConfigurationFrame extends Frame implements ActionListener{
for
(
int
i
=
0
;
i
<
b
.
size
();
i
++){
for
(
int
i
=
0
;
i
<
b
.
size
();
i
++){
if
(
source
==
b
.
get
(
i
)){
if
(
source
==
b
.
get
(
i
)){
InputConfiguration
.
ChangeInput
(
conf
.
GetInputBeingChanged
(),
b
.
get
(
i
).
getLabel
());
InputConfiguration
.
ChangeInput
(
conf
.
GetInputBeingChanged
(),
b
.
get
(
i
).
getLabel
());
conf
.
ResetInputBeingChanged
();
dispose
();
dispose
();
}
}
}
}
...
...
src/graphics/guiSkeleton/guiPanel/menuPanel/configuration/ConfigurationPanel.java
View file @
54ef1f2f
...
@@ -2,14 +2,12 @@ package graphics.guiSkeleton.guiPanel.menuPanel.configuration;
...
@@ -2,14 +2,12 @@ package graphics.guiSkeleton.guiPanel.menuPanel.configuration;
import
graphics.graphical_abstraction.panel.menu.ConfigurationPanelAbstraction
;
import
graphics.graphical_abstraction.panel.menu.ConfigurationPanelAbstraction
;
import
graphics.graphical_abstraction.panel.menu.ConfigurationPanelAbstractionController
;
import
graphics.graphical_abstraction.panel.menu.ConfigurationPanelAbstractionController
;
import
graphics.guiSkeleton.GUIColorsAndFonts
;
import
graphics.guiSkeleton.GraphicsMaster
;
import
graphics.guiSkeleton.GraphicsMaster
;
import
graphics.guiSkeleton.guiPanel.menuPanel.facilities.ButtonMaker
;
import
graphics.guiSkeleton.guiPanel.menuPanel.facilities.ButtonMaker
;
import
graphics.guiSkeleton.guiPanel.menuPanel.facilities.MenuPanel
;
import
graphics.guiSkeleton.guiPanel.menuPanel.facilities.MenuPanel
;
import
graphics.ingame_input_listener.Input
;
import
graphics.ingame_input_listener.Input
;
import
graphics.ingame_input_listener.InputConfiguration
;
import
graphics.ingame_input_listener.InputConfiguration
;
import
javax.swing.*
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
import
java.awt.event.ActionListener
;
...
@@ -31,13 +29,15 @@ public class ConfigurationPanel extends MenuPanel implements ConfigurationPanelA
...
@@ -31,13 +29,15 @@ public class ConfigurationPanel extends MenuPanel implements ConfigurationPanelA
*/
*/
public
Input
GetInputBeingChanged
(){
return
InputBeingChanged
;}
public
Input
GetInputBeingChanged
(){
return
InputBeingChanged
;}
public
void
ResetInputBeingChanged
(){
InputBeingChanged
=
Input
.
NONE
;}
public
ConfigurationPanel
(
GraphicsMaster
graphicsMaster
)
{
public
ConfigurationPanel
(
GraphicsMaster
graphicsMaster
)
{
super
(
graphicsMaster
);
super
(
graphicsMaster
);
setTitlePanel
(
"Configuration"
);
setTitlePanel
(
"Configuration"
);
addToCentralColumn
(
ButtonMaker
.
makeButton
(
"move up: "
+
MoveUpConfig
(),
configUpListener
),
1
,
1
);
addToCentralColumn
(
ButtonMaker
.
makeButton
(
"move up: "
+
MoveUpConfig
(),
configUpListener
),
1
,
1
);
addToCentralColumn
(
ButtonMaker
.
makeButton
(
"move down: "
+
MoveDownConfig
(),
configDownListener
),
1
,
1
);
addToCentralColumn
(
ButtonMaker
.
makeButton
(
"move down: "
+
MoveDownConfig
(),
configDownListener
),
1
,
1
);
addToCentralColumn
(
ButtonMaker
.
makeButton
(
"move right: "
+
MoveRightConfig
(),
config
Lef
tListener
),
1
,
1
);
addToCentralColumn
(
ButtonMaker
.
makeButton
(
"move right: "
+
MoveRightConfig
(),
config
Righ
tListener
),
1
,
1
);
addToCentralColumn
(
ButtonMaker
.
makeButton
(
"move left: "
+
MoveLeftConfig
(),
config
Righ
tListener
),
1
,
1
);
addToCentralColumn
(
ButtonMaker
.
makeButton
(
"move left: "
+
MoveLeftConfig
(),
config
Lef
tListener
),
1
,
1
);
addToCentralColumn
(
ButtonMaker
.
makeButton
(
"attack: "
+
AttackConfig
(),
configAttackListener
),
1
,
1
);
addToCentralColumn
(
ButtonMaker
.
makeButton
(
"attack: "
+
AttackConfig
(),
configAttackListener
),
1
,
1
);
addToCentralColumn
(
ButtonMaker
.
makeButton
(
"ability 1: "
+
Ability1Config
(),
configAbility1Listener
),
1
,
1
);
addToCentralColumn
(
ButtonMaker
.
makeButton
(
"ability 1: "
+
Ability1Config
(),
configAbility1Listener
),
1
,
1
);
addToCentralColumn
(
ButtonMaker
.
makeButton
(
"ability 2: "
+
Ability2Config
(),
configAbility2Listener
),
1
,
1
);
addToCentralColumn
(
ButtonMaker
.
makeButton
(
"ability 2: "
+
Ability2Config
(),
configAbility2Listener
),
1
,
1
);
...
@@ -136,57 +136,57 @@ public class ConfigurationPanel extends MenuPanel implements ConfigurationPanelA
...
@@ -136,57 +136,57 @@ public class ConfigurationPanel extends MenuPanel implements ConfigurationPanelA
if
(
InputBeingChanged
==
Input
.
NONE
){
if
(
InputBeingChanged
==
Input
.
NONE
){
InputBeingChanged
=
Input
.
UP_ARROW
;
InputBeingChanged
=
Input
.
UP_ARROW
;
new
ConfigurationFrame
(
"Move Up: current control: "
+
MoveUpConfig
(),
ConfigurationPanel
.
this
);
new
ConfigurationFrame
(
"Move Up: current control: "
+
MoveUpConfig
(),
ConfigurationPanel
.
this
);
InputBeingChanged
=
Input
.
NONE
;
}
}
}
}
public
void
ChangeMoveDownConfig
(){
public
void
ChangeMoveDownConfig
(){
if
(
InputBeingChanged
==
Input
.
NONE
){
if
(
InputBeingChanged
==
Input
.
NONE
){
InputBeingChanged
=
Input
.
DOWN_ARROW
;
InputBeingChanged
=
Input
.
DOWN_ARROW
;
new
ConfigurationFrame
(
"Move Down: current control: "
+
Move
Up
Config
(),
ConfigurationPanel
.
this
);
new
ConfigurationFrame
(
"Move Down: current control: "
+
Move
Down
Config
(),
ConfigurationPanel
.
this
);
InputBeingChanged
=
Input
.
NONE
;
}
}
}
}
public
void
ChangeMoveRightConfig
(){
public
void
ChangeMoveRightConfig
(){
if
(
InputBeingChanged
==
Input
.
NONE
){
if
(
InputBeingChanged
==
Input
.
NONE
){
InputBeingChanged
=
Input
.
RIGHT_ARROW
;
InputBeingChanged
=
Input
.
RIGHT_ARROW
;
new
ConfigurationFrame
(
"Move Right: current control: "
+
Move
Up
Config
(),
ConfigurationPanel
.
this
);
new
ConfigurationFrame
(
"Move Right: current control: "
+
Move
Right
Config
(),
ConfigurationPanel
.
this
);
InputBeingChanged
=
Input
.
NONE
;
}
}
}
}
public
void
ChangeMoveLeftConfig
(){
public
void
ChangeMoveLeftConfig
(){
if
(
InputBeingChanged
==
Input
.
NONE
){
if
(
InputBeingChanged
==
Input
.
NONE
){
InputBeingChanged
=
Input
.
LEFT_ARROW
;
InputBeingChanged
=
Input
.
LEFT_ARROW
;
new
ConfigurationFrame
(
"Move Left: current control: "
+
Move
Up
Config
(),
ConfigurationPanel
.
this
);
new
ConfigurationFrame
(
"Move Left: current control: "
+
Move
Left
Config
(),
ConfigurationPanel
.
this
);
InputBeingChanged
=
Input
.
NONE
;
}
}
}
}
public
void
ChangeAttackConfig
(){
public
void
ChangeAttackConfig
(){
if
(
InputBeingChanged
==
Input
.
NONE
){
if
(
InputBeingChanged
==
Input
.
NONE
){
InputBeingChanged
=
Input
.
ATTACK
;
InputBeingChanged
=
Input
.
ATTACK
;
new
ConfigurationFrame
(
"Move Attack: current control: "
+
MoveUp
Config
(),
ConfigurationPanel
.
this
);
new
ConfigurationFrame
(
"Move Attack: current control: "
+
Attack
Config
(),
ConfigurationPanel
.
this
);
InputBeingChanged
=
Input
.
NONE
;
}
}
}
}
public
void
ChangeAbility1Config
(){
public
void
ChangeAbility1Config
(){
if
(
InputBeingChanged
==
Input
.
NONE
){
if
(
InputBeingChanged
==
Input
.
NONE
){
InputBeingChanged
=
Input
.
ABILITY_1
;
InputBeingChanged
=
Input
.
ABILITY_1
;
new
ConfigurationFrame
(
"Ability 1: current control: "
+
MoveUp
Config
(),
ConfigurationPanel
.
this
);
new
ConfigurationFrame
(
"Ability 1: current control: "
+
Ability1
Config
(),
ConfigurationPanel
.
this
);
InputBeingChanged
=
Input
.
NONE
;
}
}
}
}
public
void
ChangeAbility2Config
(){
public
void
ChangeAbility2Config
(){
if
(
InputBeingChanged
==
Input
.
NONE
){
if
(
InputBeingChanged
==
Input
.
NONE
){
InputBeingChanged
=
Input
.
ABILITY_2
;
InputBeingChanged
=
Input
.
ABILITY_2
;
new
ConfigurationFrame
(
"Ability 2: current control: "
+
MoveUp
Config
(),
ConfigurationPanel
.
this
);
new
ConfigurationFrame
(
"Ability 2: current control: "
+
Ability2
Config
(),
ConfigurationPanel
.
this
);
InputBeingChanged
=
Input
.
NONE
;
}
}
}
}
public
void
ChangeAbility3Config
(){
public
void
ChangeAbility3Config
(){
if
(
InputBeingChanged
==
Input
.
NONE
){
if
(
InputBeingChanged
==
Input
.
NONE
){
InputBeingChanged
=
Input
.
ABILITY_3
;
InputBeingChanged
=
Input
.
ABILITY_3
;
new
ConfigurationFrame
(
"Ability 3: current control: "
+
MoveUp
Config
(),
ConfigurationPanel
.
this
);
new
ConfigurationFrame
(
"Ability 3: current control: "
+
Ability3
Config
(),
ConfigurationPanel
.
this
);
InputBeingChanged
=
Input
.
NONE
;
}
}
}
}
public
void
ChangeBackToMainConfig
(){
public
void
ChangeBackToMainConfig
(){
if
(
InputBeingChanged
==
Input
.
NONE
){
if
(
InputBeingChanged
==
Input
.
NONE
){
InputBeingChanged
=
Input
.
ESCAPE
;
InputBeingChanged
=
Input
.
ESCAPE
;
new
ConfigurationFrame
(
"Escape: current control: "
+
MoveUpConfig
(),
ConfigurationPanel
.
this
);
new
ConfigurationFrame
(
"Escape: current control: "
+
BackToMainConfig
(),
ConfigurationPanel
.
this
);}
InputBeingChanged
=
Input
.
NONE
;}
}
public
void
BackToMainMenu
(){
getGraphicsMaster
().
changeGUIStateTo
(
GraphicsMaster
.
GUIStates
.
MAIN_MENU
);
}
}
public
void
BackToMainMenu
(){
getGraphicsMaster
().
changeGUIStateTo
(
GraphicsMaster
.
GUIStates
.
MAIN_MENU
);}
/**###################################**/
/**###################################**/
/** necessary as extension of guiPanel **/
/** necessary as extension of guiPanel **/
...
...
src/graphics/ingame_input_listener/InputConfiguration.java
View file @
54ef1f2f
...
@@ -6,6 +6,31 @@ import java.awt.event.KeyEvent;
...
@@ -6,6 +6,31 @@ import java.awt.event.KeyEvent;
* Created by etouss on 09/11/2015.
* Created by etouss on 09/11/2015.
*/
*/
public
class
InputConfiguration
{
public
class
InputConfiguration
{
// static public int lineError=0;
// static{
// URL url= UsedForLoadingSprites.getInstance().getClass().getResource("./assets/configuration/configuration.txt");
// if(url==null)
// throw new IllegalStateException("Configuration file assets/configuration/configuration.txt not found");
// try(BufferedReader br= new BufferedReader(new InputStreamReader(url.openStream()))){
// System.out.println(br.readLine());
// }catch(IOException e){
// errorMessage(e.getMessage());
// throw new IllegalStateException("Should not access this line");
// }
// }
//
// /**
// * Beware, throw an exception with the given message !
// * @param message
// */
// private static void errorMessage(String message) {
// throw new IllegalStateException("Error parsing configuration: " + System.lineSeparator()+
// "Line"+lineError + message);
// }
/**
/**
* Each action that can be performed in the game
* Each action that can be performed in the game
* is firstly linked with some input which is
* is firstly linked with some input which is
...
@@ -264,6 +289,12 @@ public class InputConfiguration {
...
@@ -264,6 +289,12 @@ public class InputConfiguration {
if
(
string
.
equals
(
"g"
))
{
if
(
string
.
equals
(
"g"
))
{
return
KeyEvent
.
VK_G
;
return
KeyEvent
.
VK_G
;
}
}
if
(
string
.
equals
(
"h"
))
{
return
KeyEvent
.
VK_H
;
}
if
(
string
.
equals
(
"i"
))
{
return
KeyEvent
.
VK_I
;
}
if
(
string
.
equals
(
"j"
))
{
if
(
string
.
equals
(
"j"
))
{
return
KeyEvent
.
VK_J
;
return
KeyEvent
.
VK_J
;
}
}
...
@@ -279,12 +310,6 @@ public class InputConfiguration {
...
@@ -279,12 +310,6 @@ public class InputConfiguration {
if
(
string
.
equals
(
"n"
))
{
if
(
string
.
equals
(
"n"
))
{
return
KeyEvent
.
VK_N
;
return
KeyEvent
.
VK_N
;
}
}
if
(
string
.
equals
(
"m"
))
{
return
KeyEvent
.
VK_M
;
}
if
(
string
.
equals
(
"n"
))
{
return
KeyEvent
.
VK_N
;
}
if
(
string
.
equals
(
"o"
))
{
if
(
string
.
equals
(
"o"
))
{
return
KeyEvent
.
VK_O
;
return
KeyEvent
.
VK_O
;
}
}
...
@@ -540,7 +565,9 @@ public class InputConfiguration {
...
@@ -540,7 +565,9 @@ public class InputConfiguration {
* the key pressed linked to "input" is changed to "j"
* the key pressed linked to "input" is changed to "j"
*/
*/
public
static
void
ChangeInput
(
Input
input
,
String
string
)
{
public
static
void
ChangeInput
(
Input
input
,
String
string
)
{
System
.
out
.
println
(
"Got here"
);
int
j
=
GetIntFromString
(
string
);
int
j
=
GetIntFromString
(
string
);
System
.
out
.
println
(
j
);
switch
(
input
)
{
switch
(
input
)
{
case
ATTACK:
case
ATTACK:
attack
=
j
;
attack
=
j
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment