Added GPLv3 headers all over the place.
[fail.git] / src / sdl / sdl.fidl
blob53d7af44230b95ba1adb3bb44f03021f3ced7919
1 /*
2     Fail game engine
3     Copyright 2007 Antoine Chavasse <a.chavasse@gmail.com>
4  
5     This file is part of Fail.
7     Fail is free software; you can redistribute it and/or modify
8     it under the terms of the GNU General Public License version 3
9     as published by the Free Software Foundation.
11     Fail is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
16     You should have received a copy of the GNU General Public License
17     along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 #include "../math/math.fidl"
20 #include "../gui/game/guigame.fidl"
22 namespace fail { namespace sdl
24         class App
25         {
26                 // For now it will just init everything with default values when the singleton is created because I'm lazy.
27                 // I'll do the rest later.
28                 static Pointer< App > GetInstance();
29                 
30                 // The event loop. It will use signals to send events and render the scene.
31                 void run();
32                 
33                 // This signal is triggered after processing the SDL events to render the next frame.
34                 // The parameter is the elapsed time in second (with a millisecond precision) since the last
35                 // frame.
36                 Signal< float > FrameUpdate;
38                 // This signal is triggered when the mouse is moved.
39                 // Parameters, in order:
40                 //  Vector2: mouse cursor coordinates
41                 //      Vector2: relative coordinate since last event
42                 Signal< math::Vector2f, math::Vector2f > MouseMotionEvent;
44                 // This signal is triggered when a mouse button event is received.
45                 // Parameters, in order:
46                 //  Vector2: mouse cursor coordinates
47                 //      enum gui::MouseButton: button code
48                 //      bool: true if pressed, false if released
49                 Signal< math::Vector2f, enum gui::game::EventHandler::e_MouseButton, bool > MouseButtonEvent;
51                 // This flags that the buffers must be swapped after FrameUpdate. It's reset after each frame.
52                 // It's to avoid swapping/blitting unnecessarily if the application have an idle status
53                 // where it doesn't render anything.
54                 void needSwap();
55         };