| 1453 | } |
| 1454 | |
| 1455 | void Graphics::SetFromConfig(const Config& config, bool dynamic) { |
| 1456 | if (dynamic && config_.full_screen() == FullscreenMode::kWindowed) { |
| 1457 | config_.SetScreenWidth(config["screenwidth"].toNumber<int>()); |
| 1458 | config_.SetScreenHeight(config["screenheight"].toNumber<int>()); |
| 1459 | } |
| 1460 | if (!dynamic) { |
| 1461 | config_.SetScreenWidth(config["screenwidth"].toNumber<int>()); |
| 1462 | config_.SetScreenHeight(config["screenheight"].toNumber<int>()); |
| 1463 | config_.SetFullscreen(static_cast<FullscreenMode::Mode>(config["fullscreen"].toNumber<int>())); |
| 1464 | config_.SetTextureReduce(config["texture_reduce"].toNumber<int>()); |
| 1465 | config_.SetFSAASamples(config["multisample"].toNumber<int>()); |
| 1466 | config_.SetAnisotropy(config["anisotropy"].toNumber<float>()); |
| 1467 | config_.SetVSync(config["vsync"].toNumber<bool>()); |
| 1468 | config_.SetLimitFpsInGame(config["limit_fps_in_game"].toNumber<bool>()); |
| 1469 | config_.SetMaxFrameRate(config["max_frame_rate"].toNumber<int>()); |
| 1470 | config_.SetGPUSkinning(config["gpu_skinning"].toNumber<bool>()); |
| 1471 | config_.motion_blur_amount_ = config["motion_blur_amount"].toNumber<float>(); |
| 1472 | config_.SetSimpleFog(config["simple_fog"].toNumber<bool>()); |
| 1473 | config_.SetDetailObjects(config["detail_objects"].toNumber<bool>()); |
| 1474 | config_.SetDetailObjectDecals(config["detail_object_decals"].toNumber<bool>()); |
| 1475 | config_.SetDetailObjectLowres(config["detail_object_lowres"].toNumber<bool>()); |
| 1476 | config_.SetDetailObjectShadows(!config["detail_object_disable_shadows"].toNumber<bool>()); |
| 1477 | config_.SetDepthOfField(config["depth_of_field"].toNumber<bool>()); |
| 1478 | config_.SetDepthOfFieldReduced(config["depth_of_field_reduced"].toNumber<bool>()); |
| 1479 | } |
| 1480 | config_.SetBlood(config["blood"].toNumber<int>()); |
| 1481 | config_.SetBloodColor(GraphicsConfig::BloodColorFromString(config["blood_color"].str())); |
| 1482 | config_.SetSplitScreen(config["split_screen"].toNumber<bool>()); |
| 1483 | config_.seamless_cubemaps_ = config["seamless_cubemaps"].toNumber<bool>(); |
| 1484 | setSimpleShadows(config["simple_shadows"].toNumber<bool>()); |
| 1485 | setSimpleWater(config["simple_water"].toNumber<bool>()); |
| 1486 | SetParticleFieldSimple(config["particle_field_simple"].toNumber<bool>()); |
| 1487 | SetDetailObjectsReduced(config["detail_objects_reduced"].toNumber<bool>()); |
| 1488 | g_attrib_envobj_instancing_enabled = config["attrib_envobj_instancing"].toNumber<bool>(); |
| 1489 | g_perform_occlusion_query = config["occlusion_query"].toNumber<bool>(); |
| 1490 | g_gamma_correct_final_output = config["gamma_correct_final_output"].toNumber<bool>(); |
| 1491 | |
| 1492 | config_.SetTargetMonitor(config["target_monitor"].toNumber<int>()); |
| 1493 | } |
| 1494 | |
| 1495 | void Graphics::SetWindowGrab(bool val) { |
| 1496 | if (!val || SDL_GetKeyboardFocus() == sdl_window_) { |
no test coverage detected