blob: 7118c8e024a875a8b57c50d72a11829a434d39d6 [file] [log] [blame]
Tony Barbour2f18b292016-02-25 15:44:10 -07001/*
2 * Copyright (C) 2016 Google, Inc.
3 *
Jon Ashburn43b53e82016-04-19 11:30:31 -06004 * 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 Barbour2f18b292016-02-25 15:44:10 -07007 *
Jon Ashburn43b53e82016-04-19 11:30:31 -06008 * http://www.apache.org/licenses/LICENSE-2.0
Tony Barbour2f18b292016-02-25 15:44:10 -07009 *
Jon Ashburn43b53e82016-04-19 11:30:31 -060010 * 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 Barbour2f18b292016-02-25 15:44:10 -070015 */
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_ANDROID_KHR)
49
50#include <android/log.h>
51#include "ShellAndroid.h"
52
53void 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
72int 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