-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
91 lines (79 loc) · 3.82 KB
/
Copy pathmain.cpp
File metadata and controls
91 lines (79 loc) · 3.82 KB
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
#include "DVDBounce.h"
int main(int argc, char* argv[]) {
DVDBounce game;
bool useOriginalColors = false;
bool backgroundless = false;
std::string logoFile = "dvdlogo.png";
float initialSpeed = 1.0f;
for (int i = 1; i < argc; i++) {
std::string arg = argv[i];
if (arg == "--original") {
useOriginalColors = true;
} else if (arg == "--backgroundless") {
backgroundless = true;
} else if (arg == "--logo" && i + 1 < argc) {
logoFile = argv[++i];
} else if (arg == "--speed" && i + 1 < argc) {
try {
initialSpeed = std::stof(argv[++i]);
if (initialSpeed <= 0) {
std::cerr << "Speed must be positive, using default 1.0" << std::endl;
initialSpeed = 1.0f;
}
} catch (const std::exception&) {
std::cerr << "Invalid speed value, using default 1.0" << std::endl;
initialSpeed = 1.0f;
}
} else if (arg == "--help" || arg == "-h") {
std::cout << "DVD Bounce - Transparent Desktop Overlay" << std::endl;
std::cout << "Usage: " << argv[0] << " [options]" << std::endl;
std::cout << "Options:" << std::endl;
std::cout << " --original Use original logo colors (default: inverted/white)" << std::endl;
std::cout << " --backgroundless Skip clearing the background (useful for other overlays)" << std::endl;
std::cout << " --logo <file> Use custom logo image (default: dvdlogo.png)" << std::endl;
std::cout << " --speed <float> Set initial speed multiplier (default: 1.0)" << std::endl;
std::cout << " --help, -h Show this help message" << std::endl;
std::cout << std::endl;
std::cout << "Features:" << std::endl;
std::cout << " • Appears above dock, taskbar, and menu bars on all platforms" << std::endl;
std::cout << " • High DPI support for crisp graphics" << std::endl;
std::cout << " • Corner hit detection with celebration messages" << std::endl;
std::cout << std::endl;
std::cout << "Runtime Controls:" << std::endl;
std::cout << " ESC, Q, X Quit the program" << std::endl;
std::cout << " SPACE Pause/Resume animation" << std::endl;
std::cout << " C Change logo color" << std::endl;
std::cout << " I Toggle info overlay" << std::endl;
std::cout << " +/= Increase speed" << std::endl;
std::cout << " - Decrease speed" << std::endl;
std::cout << " R Reset position and speed" << std::endl;
std::cout << " H Show help during runtime" << std::endl;
return 0;
}
}
game.setInvertColors(!useOriginalColors);
game.setBackgroundless(backgroundless);
if (!game.initialize()) {
std::cerr << "Failed to initialize!" << std::endl;
return -1;
}
if (!game.loadLogo(logoFile)) {
std::cerr << "Failed to load logo!" << std::endl;
return -1;
}
game.setStartingPosition();
if (initialSpeed != 1.0f) {
game.setSpeedMultiplier(initialSpeed);
std::cout << "Initial speed set to " << initialSpeed << "x" << std::endl;
}
if (useOriginalColors) {
std::cout << "Running with original colors (black logo)" << std::endl;
} else {
std::cout << "Running with inverted colors (white logo)" << std::endl;
}
if (backgroundless) {
std::cout << "Running with backgroundless mode (skipping background clear)" << std::endl;
}
game.run();
return 0;
}