• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /***************************************************************************
2  *
3  * Copyright 2010,2011 BMW Car IT GmbH
4  * Copyright (C) 2011 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
5  *
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *        http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  ****************************************************************************/
20 #include "Argument.h"
21 #include "MockNavi.h"
22 #include "LayerScene.h"
23 
24 #include <iostream>
25 using std::cout;
26 
27 #define DEFAULT_FPS      30.0
28 #define DEFAULT_ANIM     1.0
29 #define DEFAULT_SURFACE  SURFACE_EXAMPLE_EGLX11_APPLICATION
30 #define DEFAULT_WIDTH    800
31 #define DEFAULT_HEIGHT   480
32 #define DEFAULT_OPACITY  1.0
33 #define DEFAULT_NOSKY    false
34 #define DEFAULT_HELP     false
35 #define DEFAULT_SYNC     1
36 
main(int argc,const char * argv[])37 int main (int argc, const char * argv[])
38 {
39     FloatArgument fps("fps", DEFAULT_FPS, argc, argv);
40     FloatArgument animSpeed("anim", DEFAULT_ANIM, argc, argv);
41     UnsignedIntArgument surfaceId("surface", DEFAULT_SURFACE, argc, argv);
42     IntArgument width("width", DEFAULT_WIDTH, argc, argv);
43     IntArgument height("height", DEFAULT_HEIGHT, argc, argv);
44     BoolArgument nosky("nosky", DEFAULT_NOSKY, argc, argv);
45     BoolArgument help("help", DEFAULT_HELP, argc, argv);
46     UnsignedIntArgument sync("sync", DEFAULT_SYNC, argc, argv);
47 
48     if (help.get())
49     {
50         cout << "\nUsage: " << argv[0] << " [options]\n"
51              << "possible options are:\n"
52              << "  -help         show this help text (default " << DEFAULT_HELP << ")\n"
53              << "  -fps x        limit frames per second to x (default " << DEFAULT_FPS << ")\n"
54              << "  -anim x       set animation speed (default " << DEFAULT_ANIM << ")\n"
55              << "  -nosky        do not render sky, background transparent (default " << DEFAULT_NOSKY << ")\n"
56              << "  -surface x    render to surface id x (default " << DEFAULT_SURFACE << ")\n"
57              << "  -width x      set surface width to x (default " << DEFAULT_WIDTH << ")\n"
58              << "  -height x     set surface height to x (default " << DEFAULT_HEIGHT << ")\n"
59              << "  -sync x       sync with frame callback or not (default " << DEFAULT_SYNC << ")\n\n";
60     }
61     else
62     {
63         SurfaceConfiguration config;
64         config.surfaceId = surfaceId.get();
65         config.surfaceWidth = width.get();
66         config.surfaceHeight = height.get();
67         config.nosky = nosky.get();
68         config.sync = sync.get();
69 
70         MockNavi navi(fps.get(), animSpeed.get(), &config);
71         navi.mainloop();
72     }
73 
74     return 0;
75 }
76