blob: 4f24b74b999c7d9a19df92988399c64c0144d791 [file] [log] [blame]
Tony Barbour2f18b292016-02-25 15:44:10 -07001/*
2 * Copyright (C) 2016 Google, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#include <string>
24#include <vector>
25
26#include "Smoke.h"
27
28namespace {
29
30Game *create_game(int argc, char **argv)
31{
32 std::vector<std::string> args(argv, argv + argc);
33 return new Smoke(args);
34}
35
36} // namespace
37
38#if defined(VK_USE_PLATFORM_XCB_KHR)
39
40#include "ShellXcb.h"
41
42int main(int argc, char **argv)
43{
44 Game *game = create_game(argc, argv);
45 {
46 ShellXcb shell(*game);
47 shell.run();
48 }
49 delete game;
50
51 return 0;
52}
53
54#elif defined(VK_USE_PLATFORM_ANDROID_KHR)
55
56#include <android/log.h>
57#include "ShellAndroid.h"
58
59void android_main(android_app *app)
60{
61 Game *game = create_game(0, nullptr);
62
63 try {
64 ShellAndroid shell(*app, *game);
65 shell.run();
66 } catch (const std::runtime_error &e) {
67 __android_log_print(ANDROID_LOG_ERROR, game->settings().name.c_str(),
68 "%s", e.what());
69 }
70
71 delete game;
72}
73
74#elif defined(VK_USE_PLATFORM_WIN32_KHR)
75
76#include "ShellWin32.h"
77
78int main(int argc, char **argv)
79{
80 Game *game = create_game(argc, argv);
81 {
82 ShellWin32 shell(*game);
83 shell.run();
84 }
85 delete game;
86
87 return 0;
88}
89
90#endif // VK_USE_PLATFORM_XCB_KHR