added screen index for multiple monitors. fixed scroll wheel zoom crash due to negative max dist
Former-commit-id: 26e86f54547bcb5420667a15ddeb40842f2cb8f7 Former-commit-id: 5d84159b16a0c9a0ef487f10c1377b420af9f5e9
This commit is contained in:
parent
bdaae19854
commit
b6e5a03cd2
|
@ -117,6 +117,7 @@ AircraftData::AircraftData(){
|
||||||
appData.screen_height = 0;
|
appData.screen_height = 0;
|
||||||
appData.screen_depth = 32;
|
appData.screen_depth = 32;
|
||||||
appData.fullscreen = 0;
|
appData.fullscreen = 0;
|
||||||
|
appData.screen_index = 0;
|
||||||
|
|
||||||
// Initialize status
|
// Initialize status
|
||||||
Status.msgRate = 0;
|
Status.msgRate = 0;
|
||||||
|
|
10
Input.cpp
10
Input.cpp
|
@ -13,6 +13,10 @@ static uint64_t mstime(void) {
|
||||||
return mst;
|
return mst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T> int sgn(T val) {
|
||||||
|
return (T(0) < val) - (val < T(0));
|
||||||
|
}
|
||||||
|
|
||||||
void Input::getInput()
|
void Input::getInput()
|
||||||
{
|
{
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
@ -39,7 +43,11 @@ void Input::getInput()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_MOUSEWHEEL:
|
case SDL_MOUSEWHEEL:
|
||||||
appData.maxDist *= 1.0 + event.wheel.y / 10.0;
|
appData.maxDist *= 1.0 + 0.5 * sgn(event.wheel.y);
|
||||||
|
if(appData.maxDist < 0.001f) {
|
||||||
|
appData.maxDist = 0.001f;
|
||||||
|
}
|
||||||
|
|
||||||
appData.mapTargetMaxDist = 0;
|
appData.mapTargetMaxDist = 0;
|
||||||
appData.mapMoved = 1;
|
appData.mapMoved = 1;
|
||||||
break;
|
break;
|
||||||
|
|
2
init.c
2
init.c
|
@ -36,7 +36,7 @@ void init(char *title) {
|
||||||
appData.screen_height= DM.h;
|
appData.screen_height= DM.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
appData.window = SDL_CreateWindow(title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, appData.screen_width, appData.screen_height, flags);
|
appData.window = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED_DISPLAY(appData.screen_index), SDL_WINDOWPOS_CENTERED_DISPLAY(appData.screen_index), appData.screen_width, appData.screen_height, flags);
|
||||||
appData.renderer = SDL_CreateRenderer(appData.window, -1, SDL_RENDERER_ACCELERATED);
|
appData.renderer = SDL_CreateRenderer(appData.window, -1, SDL_RENDERER_ACCELERATED);
|
||||||
appData.mapTexture = SDL_CreateTexture(appData.renderer,
|
appData.mapTexture = SDL_CreateTexture(appData.renderer,
|
||||||
SDL_PIXELFORMAT_ARGB8888,
|
SDL_PIXELFORMAT_ARGB8888,
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
3e3eb8a1241fe042f8979c8ab0fb931f24e6100f
|
dbb808dc2f784e53f7c3967e7b0bb11f9ef1a825
|
|
@ -70,6 +70,7 @@ void showHelp(void) {
|
||||||
"--help Show this help\n"
|
"--help Show this help\n"
|
||||||
"--uiscale <factor> UI global scaling (default: 1)\n"
|
"--uiscale <factor> UI global scaling (default: 1)\n"
|
||||||
"--screensize <width> <height> Set frame buffer resolution (default: screen resolution)\n"
|
"--screensize <width> <height> Set frame buffer resolution (default: screen resolution)\n"
|
||||||
|
"--screenindex <i> Set the index of the display to use (default: 0)\n"
|
||||||
"--fullscreen Start fullscreen\n"
|
"--fullscreen Start fullscreen\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -94,9 +95,7 @@ int main(int argc, char **argv) {
|
||||||
for (j = 1; j < argc; j++) {
|
for (j = 1; j < argc; j++) {
|
||||||
int more = ((j + 1) < argc); // There are more arguments
|
int more = ((j + 1) < argc); // There are more arguments
|
||||||
|
|
||||||
if (!strcmp(argv[j],"--net-bo-port") && more) {
|
if (!strcmp(argv[j],"--port") && more) {
|
||||||
aircraftData.modes.net_input_beast_port = atoi(argv[++j]);
|
|
||||||
} else if (!strcmp(argv[j],"--port") && more) {
|
|
||||||
aircraftData.modes.net_input_beast_port = atoi(argv[++j]);
|
aircraftData.modes.net_input_beast_port = atoi(argv[++j]);
|
||||||
} else if (!strcmp(argv[j],"--server") && more) {
|
} else if (!strcmp(argv[j],"--server") && more) {
|
||||||
std::strcpy(aircraftData.server, argv[++j]);
|
std::strcpy(aircraftData.server, argv[++j]);
|
||||||
|
@ -110,6 +109,8 @@ int main(int argc, char **argv) {
|
||||||
aircraftData.modes.metric = 1;
|
aircraftData.modes.metric = 1;
|
||||||
} else if (!strcmp(argv[j],"--fullscreen")) {
|
} else if (!strcmp(argv[j],"--fullscreen")) {
|
||||||
appData.fullscreen = 1;
|
appData.fullscreen = 1;
|
||||||
|
} else if (!strcmp(argv[j],"--screenindex")) {
|
||||||
|
appData.screen_index = atoi(argv[++j]);
|
||||||
} else if (!strcmp(argv[j],"--uiscale") && more) {
|
} else if (!strcmp(argv[j],"--uiscale") && more) {
|
||||||
appData.screen_uiscale = atoi(argv[++j]);
|
appData.screen_uiscale = atoi(argv[++j]);
|
||||||
} else if (!strcmp(argv[j],"--screensize") && more) {
|
} else if (!strcmp(argv[j],"--screensize") && more) {
|
||||||
|
|
Loading…
Reference in a new issue