source: trunk/src/application/application.cpp @ 1440

Last change on this file since 1440 was 1440, checked in by sam, 7 years ago

nacl: NaCl binaries no longer need a modified main() to work, the NaCl
instance object takes care of everything for us.

  • Property svn:keywords set to Id
File size: 1.8 KB
Line 
1//
2// Lol Engine
3//
4// Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net>
5//   This program is free software; you can redistribute it and/or
6//   modify it under the terms of the Do What The Fuck You Want To
7//   Public License, Version 2, as published by Sam Hocevar. See
8//   http://sam.zoy.org/projects/COPYING.WTFPL for more details.
9//
10
11#if defined HAVE_CONFIG_H
12#   include "config.h"
13#endif
14
15#include "core.h"
16#include "lolgl.h"
17
18#if defined __CELLOS_LV2__
19#   include "platform/ps3/ps3app.h"
20#elif defined _XBOX
21#   include "platform/xbox/xboxapp.h"
22#elif defined __native_client__
23#   include "platform/nacl/nacl-app.h"
24#elif defined __ANDROID__
25#   include "platform/android/androidapp.h"
26#elif defined HAVE_GLES_2X
27#   include "eglapp.h"
28#else
29#   include "platform/sdl/sdlapp.h"
30#   include "platform/sdl/sdlinput.h"
31#endif
32
33using namespace std;
34
35namespace lol
36{
37
38class ApplicationData
39{
40    friend class Application;
41
42    ApplicationData(char const *name, ivec2 resolution, float framerate)
43        : app(name, resolution, framerate)
44    { }
45
46#if defined __CELLOS_LV2__
47    Ps3App app;
48#elif defined _XBOX
49    XboxApp app;
50#elif defined __native_client__
51    NaClApp app;
52#elif defined __ANDROID__
53    AndroidApp app;
54#elif defined HAVE_GLES_2X
55    /* FIXME: this macro is only deactivated if we include "lolgl.h" */
56    EglApp app;
57#elif defined HAVE_SDL_H
58    SdlApp app;
59#else
60#   error No application class available on this platform
61#endif
62};
63
64/*
65 * Public Application class
66 */
67
68Application::Application(char const *name, ivec2 resolution, float framerate)
69{
70    data = new ApplicationData(name, resolution, framerate);
71}
72
73void Application::ShowPointer(bool show)
74{
75    data->app.ShowPointer(show);
76}
77
78void Application::Run()
79{
80    data->app.Run();
81}
82
83Application::~Application()
84{
85    delete data;
86}
87
88} /* namespace lol */
89
Note: See TracBrowser for help on using the repository browser.