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

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

core: implement Application::ShowPointer() so that applications can choose
whether to use the system mouse pointer or not.

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