| 203 | } // namespace |
| 204 | |
| 205 | int main(int argc, char * argv[]) |
| 206 | { |
| 207 | // Our double parsing code (base/string_utils.hpp) needs dots as a floating point delimiters, not commas. |
| 208 | // TODO: Refactor our doubles parsing code to use locale-independent delimiters. |
| 209 | // For example, https://github.com/google/double-conversion can be used. |
| 210 | // See http://dbaron.org/log/20121222-locale for more details. |
| 211 | (void)::setenv("LC_NUMERIC", "C", 1); |
| 212 | |
| 213 | Platform & platform = GetPlatform(); |
| 214 | |
| 215 | LOG(LINFO, ("Developer Render Sandbox", platform.Version(), "detected CPU cores:", platform.CpuCores())); |
| 216 | |
| 217 | gflags::SetUsageMessage("Developer Sandbox."); |
| 218 | gflags::SetVersionString(platform.Version()); |
| 219 | gflags::ParseCommandLineFlags(&argc, &argv, true); |
| 220 | |
| 221 | if (!FLAGS_resources_path.empty()) |
| 222 | platform.SetResourceDir(FLAGS_resources_path); |
| 223 | if (!FLAGS_data_path.empty()) |
| 224 | platform.SetWritableDirForTests(FLAGS_data_path); |
| 225 | |
| 226 | if (auto const logLevel = base::FromString(FLAGS_log_abort_level); logLevel) |
| 227 | base::g_LogAbortLevel = *logLevel; |
| 228 | else |
| 229 | LOG(LCRITICAL, ("Invalid log level:", FLAGS_log_abort_level)); |
| 230 | |
| 231 | #if defined(OMIM_OS_LINUX) |
| 232 | auto guiThread = std::make_unique<LinuxGuiThread>(); |
| 233 | auto guiThreadPtr = guiThread.get(); |
| 234 | platform.SetGuiThread(std::move(guiThread)); |
| 235 | #endif |
| 236 | |
| 237 | // Init GLFW. |
| 238 | glfwSetErrorCallback(errorCallback); |
| 239 | if (!glfwInit()) |
| 240 | return -1; |
| 241 | glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); |
| 242 | #if defined(OMIM_OS_WINDOWS) |
| 243 | glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE); |
| 244 | #endif |
| 245 | auto monitor = glfwGetPrimaryMonitor(); |
| 246 | auto mode = glfwGetVideoMode(monitor); |
| 247 | GLFWwindow * window = glfwCreateWindow(mode->width, mode->height, "Developer Render Sandbox", nullptr, nullptr); |
| 248 | int fbWidth = 0, fbHeight = 0; |
| 249 | glfwGetFramebufferSize(window, &fbWidth, &fbHeight); |
| 250 | float xs = 1.0f, ys = 1.0f; |
| 251 | glfwGetWindowContentScale(window, &xs, &ys); |
| 252 | float visualScale = std::max(xs, ys); |
| 253 | glfwSetGamma(monitor, 1.0f); |
| 254 | |
| 255 | IMGUI_CHECKVERSION(); |
| 256 | ImGui::CreateContext(); |
| 257 | ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; |
| 258 | ImGui::StyleColorsClassic(); |
| 259 | glfwMaximizeWindow(window); |
| 260 | |
| 261 | platform.SetupMeasurementSystem(); |
| 262 |
nothing calls this directly
no test coverage detected