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

Last change on this file since 1082 was 1082, checked in by sam, 8 years ago

core: port all code to NativeClient. Nothing runs for now, but it builds.

  • Property svn:keywords set to Id
File size: 1.6 KB
Line 
1//
2// Lol Engine
3//
4// Copyright: (c) 2010-2011 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 __native_client__
21#   include "platform/nacl/naclapp.h"
22#elif defined HAVE_GLES_2X
23#   include "eglapp.h"
24#else
25#   include "platform/sdl/sdlapp.h"
26#   include "platform/sdl/sdlinput.h"
27#endif
28
29using namespace std;
30
31namespace lol
32{
33
34class ApplicationData
35{
36    friend class Application;
37
38    ApplicationData(char const *name, ivec2 resolution, float framerate)
39        : app(name, resolution, framerate)
40    { }
41
42#if defined __CELLOS_LV2__
43    Ps3App app;
44#elif defined __native_client__
45    NaClApp app;
46#elif defined HAVE_GLES_2X
47    /* FIXME: this macro is only deactivated if we include "lolgl.h" */
48    EglApp app;
49#elif defined HAVE_SDL_H
50    SdlApp app;
51#else
52#   error No application class available on this platform
53#endif
54};
55
56/*
57 * Public Application class
58 */
59
60Application::Application(char const *name, ivec2 resolution, float framerate)
61{
62    data = new ApplicationData(name, resolution, framerate);
63}
64
65void Application::ShowPointer(bool show)
66{
67    data->app.ShowPointer(show);
68}
69
70void Application::Run()
71{
72    data->app.Run();
73}
74
75Application::~Application()
76{
77    delete data;
78}
79
80} /* namespace lol */
81
Note: See TracBrowser for help on using the repository browser.