Skip to content

Commit c915b83

Browse files
committed
Azerty
Added controls for people with azerty based keyboards.
1 parent 37b6970 commit c915b83

File tree

2 files changed

+202
-74
lines changed

2 files changed

+202
-74
lines changed

src/com/redomar/game/Game.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import java.awt.Color;
66
import java.awt.Dimension;
77
import java.awt.Graphics;
8+
import java.awt.im.InputContext;
89
import java.awt.image.BufferStrategy;
910
import java.awt.image.BufferedImage;
1011
import java.awt.image.DataBufferInt;
@@ -56,7 +57,8 @@ public class Game extends Canvas implements Runnable {
5657
private static int steps;
5758
private static boolean devMode;
5859
private static boolean closingMode;
59-
60+
private static boolean isAzertyCountry;
61+
6062
private static JFrame frame;
6163

6264
private static boolean running = false;
@@ -88,12 +90,14 @@ public class Game extends Canvas implements Runnable {
8890
private static GameClient socketClient;
8991
private GameServer socketServer;
9092
private Printing print = new Printing();
91-
93+
private static InputContext context;
94+
9295
/**
9396
* @author Redomar
9497
* @version Alpha 1.8
9598
*/
9699
public Game() {
100+
context = InputContext.getInstance();
97101
setMinimumSize(new Dimension(WIDTH * SCALE, HEIGHT * SCALE));
98102
setMaximumSize(new Dimension(WIDTH * SCALE, HEIGHT * SCALE));
99103
setPreferredSize(new Dimension(WIDTH * SCALE, HEIGHT * SCALE));
@@ -328,7 +332,15 @@ public void render() {
328332
+ WordUtils.capitalizeFully(player
329333
.getSantizedUsername()), 3, getHeight() - 17);
330334
g.setColor(Color.ORANGE);
331-
g.drawString("Press Q to quit", (getWidth()/2)-("Press Q to quit".length()*3), getHeight() -17);
335+
336+
if(context.getLocale().getCountry().equals("BE") || context.getLocale().getCountry().equals("FR"))
337+
{
338+
g.drawString("Press A to quit", (getWidth()/2)-("Press A to quit".length()*3), getHeight() -17);
339+
}
340+
else
341+
{
342+
g.drawString("Press Q to quit", (getWidth()/2)-("Press Q to quit".length()*3), getHeight() -17);
343+
}
332344
g.setColor(Color.YELLOW);
333345
g.drawString(time.getTime(), (getWidth() - 58), (getHeight() - 3));
334346
g.setColor(Color.WHITE);

0 commit comments

Comments
 (0)