Added FileSystem class
[openstranded.git] / src / eal / engine.hh
blobab9eee293c92d6dbfddd76b0627d82aeba69125f
1 /*
2 * Base class for graphics/sound
4 * Copyright (C) 2009 David Kolossa, Mathias Gottschlag
6 * This file is part of OpenStranded
8 * OpenStranded is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
13 * OpenStranded is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with OpenStranded. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef STRANDED_ENGINE_HH
23 #define STRANDED_ENGINE_HH
25 #include "eal/eal.hh"
26 #include "settings.hh"
28 namespace eal
30 class SceneNode;
31 class Camera;
32 class Environment;
34 /**
35 * Base interface for the sound/graphics engine.
37 class Engine
39 public:
40 /**
41 * Retrieves a pointer to the engine.
43 static Engine*
44 get();
46 /**
47 * Destroys the world
49 virtual ~Engine();
51 /**
52 * Creates a window, initializes sound.
54 virtual bool
55 init(GlobalSettings *settings = 0) = 0;
57 /**
58 * Returns a reference to the GUI
60 GUI*
61 getGUI();
63 /**
64 * Returns a reference to the camera
66 Camera*
67 getCamera();
69 /**
70 * Returns a reference to the environment
72 Environment*
73 getEnvironment();
75 /**
76 * Creates a scene node
78 virtual SceneNode*
79 addSceneNode() = 0;
81 /**
82 * Creates an environment
84 virtual Environment*
85 addEnvironment() = 0;
87 /**
88 * Returns the current game settings.
90 GlobalSettings *
91 getSettings()
93 return settings;
96 /**
97 * Return the supported file formats for textures.
98 * Note that this method also specifies the priority of
99 * the extensions. The objects with a lower vector index
100 * have a higher priority.
102 virtual const std::vector<std::string>&
103 getTextureExtensions() = 0;
106 * Renders one frame and refills sound buffers if needed
108 virtual bool update() = 0;
110 protected:
111 Engine ();
113 GUI *gui;
114 Camera *camera;
115 Environment *environment;
117 GlobalSettings *settings;
119 static Engine *instance;
123 #endif