Tony Barbour | 2f18b29 | 2016-02-25 15:44:10 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 Google, Inc. |
| 3 | * |
Jon Ashburn | 43b53e8 | 2016-04-19 11:30:31 -0600 | [diff] [blame^] | 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 |
Tony Barbour | 2f18b29 | 2016-02-25 15:44:10 -0700 | [diff] [blame] | 7 | * |
Jon Ashburn | 43b53e8 | 2016-04-19 11:30:31 -0600 | [diff] [blame^] | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Tony Barbour | 2f18b29 | 2016-02-25 15:44:10 -0700 | [diff] [blame] | 9 | * |
Jon Ashburn | 43b53e8 | 2016-04-19 11:30:31 -0600 | [diff] [blame^] | 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. |
Tony Barbour | 2f18b29 | 2016-02-25 15:44:10 -0700 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <string> |
| 18 | #include <vector> |
| 19 | |
| 20 | #include "Smoke.h" |
| 21 | |
| 22 | namespace { |
| 23 | |
| 24 | Game *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 | |
| 36 | int 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_ANDROID_KHR) |
| 49 | |
| 50 | #include <android/log.h> |
| 51 | #include "ShellAndroid.h" |
| 52 | |
| 53 | void android_main(android_app *app) |
| 54 | { |
| 55 | Game *game = create_game(0, nullptr); |
| 56 | |
| 57 | try { |
| 58 | ShellAndroid shell(*app, *game); |
| 59 | shell.run(); |
| 60 | } catch (const std::runtime_error &e) { |
| 61 | __android_log_print(ANDROID_LOG_ERROR, game->settings().name.c_str(), |
| 62 | "%s", e.what()); |
| 63 | } |
| 64 | |
| 65 | delete game; |
| 66 | } |
| 67 | |
| 68 | #elif defined(VK_USE_PLATFORM_WIN32_KHR) |
| 69 | |
| 70 | #include "ShellWin32.h" |
| 71 | |
| 72 | int main(int argc, char **argv) |
| 73 | { |
| 74 | Game *game = create_game(argc, argv); |
| 75 | { |
| 76 | ShellWin32 shell(*game); |
| 77 | shell.run(); |
| 78 | } |
| 79 | delete game; |
| 80 | |
| 81 | return 0; |
| 82 | } |
| 83 | |
| 84 | #endif // VK_USE_PLATFORM_XCB_KHR |