-
Notifications
You must be signed in to change notification settings - Fork 0
/
ArcadeMenu.pde
executable file
·154 lines (118 loc) · 3.03 KB
/
ArcadeMenu.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
import java.awt.Frame;
import javax.swing.JFrame;
import com.sun.jna.platform.win32.User32;
import com.sun.jna.platform.win32.*;
import com.melloware.jintellitype.HotkeyListener;
import com.melloware.jintellitype.IntellitypeListener;
import com.melloware.jintellitype.JIntellitype;
import processing.video.*;
import java.io.File;
JIntellitypeTester mainFrame = new JIntellitypeTester();
GameData currentlySelectedGame;
String platform = "windows";
String selectedTheme = "centered list";
boolean useJoyToKey = true;
boolean displayLogo = true;
String joy2keyPath;
int savedTime;
int totalTime = 5000;
PImage logo;
GameDataManager dataManager;
Themes theme;
//boolean sketchFullScreen() { return false; }
boolean gameIsRunning = false;
void setup()
{
staticWindow = new Window(null);
joy2keyPath = dataPath("joyToKey/JoyToKey.exe");
lastTimeCheck = millis();
readConfig();
//noCursor();
size(displayWidth, displayHeight);
savedTime = millis();
logo = loadImage("logo.png");
dataManager = new GameDataManager(this);
theme = new Themes();
initGlobalKeyListener();
try{
Runtime.getRuntime().exec(joy2keyPath + " menuselect.cfg");
}
catch(Exception ex)
{
println("error launching joy2key");
}
}
float escapeKeyTimer = 0;
void draw()
{
background(0);
//theme.drawADefaultTheme(selectedTheme);
newCenteredRoulette();
if(displayLogo)
drawLogo();
if(gameIsRunning)
{
/*
if(HoldingEscapeKeys())
{
println("holding escape keys");
if(escapeKeyTimer == 0)
escapeKeyTimer = millis();
if(millis() > escapeKeyTimer + 2000)
{
closeGameOpenMenu();
escapeKeyTimer = 0;
}
}
else escapeKeyTimer = 0;
*/
}
manageTopWindow();
//drawLoadingMessage();
}
void readConfig()
{
try
{
JSONObject config = loadJSONObject(dataPath("config.json"));
platform = config.getString("platform");
selectedTheme = config.getString("theme");
useJoyToKey = evaluateIfTrue(config.getString("use joy2key"));
println(useJoyToKey);
displayLogo = evaluateIfTrue(config.getString("display logo"));
}
catch(RuntimeException ex)
{
println("error reading config.JSON file! using defaults instead.");
println("make sure config.json exists in the data folder and is formatted according to the instructions in the README file.");
}
}
boolean evaluateIfTrue(String str)
{
str = str.toLowerCase();
if(str.equals("true")|| str.equals("t") || str.equals("yes") || str.equals("y"))
{
return true;
}
else if(str.equals("false") || str.equals("f") || str.equals("no")|| str.equals("n"))
{
return false;
}else{
println("error! I don't understand \"" + str + "\"");
return false;
}
}
void stop()
{
for(int i = 0; i!= dataManager.games.size(); i++)
{
GameData g = (GameData) dataManager.games.get(i);
g._video.stop();
}
}
void drawLogo()
{
int temp = int(width * .09);
logo.resize(temp, 0);
image(logo, 30, 0);
}