1/* 2 * Copyright (C) 2016 Google, Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#include <string> 18#include <vector> 19 20#include "Smoke.h" 21 22namespace { 23 24Game *create_game(int argc, char **argv) 25{ 26 std::vector<std::string> args(argv, argv + argc); 27 return new Smoke(args); 28} 29 30} // namespace 31 32#if defined(VK_USE_PLATFORM_XCB_KHR) 33 34#include "ShellXcb.h" 35 36int main(int argc, char **argv) 37{ 38 Game *game = create_game(argc, argv); 39 { 40 ShellXcb shell(*game); 41 shell.run(); 42 } 43 delete game; 44 45 return 0; 46} 47 48#elif defined(VK_USE_PLATFORM_WAYLAND_KHR) 49 50#include "ShellWayland.h" 51 52int main(int argc, char **argv) { 53 Game *game = create_game(argc, argv); 54 { 55 ShellWayland shell(*game); 56 shell.run(); 57 } 58 delete game; 59 60 return 0; 61} 62 63#elif defined(VK_USE_PLATFORM_ANDROID_KHR) 64 65#include <android/log.h> 66#include "ShellAndroid.h" 67 68void android_main(android_app *app) 69{ 70 Game *game = create_game(0, nullptr); 71 72 try { 73 ShellAndroid shell(*app, *game); 74 shell.run(); 75 } catch (const std::runtime_error &e) { 76 __android_log_print(ANDROID_LOG_ERROR, game->settings().name.c_str(), 77 "%s", e.what()); 78 } 79 80 delete game; 81} 82 83#elif defined(VK_USE_PLATFORM_WIN32_KHR) 84 85#include "ShellWin32.h" 86 87int main(int argc, char **argv) 88{ 89 Game *game = create_game(argc, argv); 90 { 91 ShellWin32 shell(*game); 92 shell.run(); 93 } 94 delete game; 95 96 return 0; 97} 98 99#endif // VK_USE_PLATFORM_XCB_KHR 100