Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
base_util.h
Go to the documentation of this file.
1 
2 #ifndef _BASE_UTIL_H_
3 #define _BASE_UTIL_H_
4 
5 #include "config.h"
6 #include <string>
7 #include <boost/version.hpp>
8 #if BOOST_VERSION != 102800
9 #include "cs_boostpythonobj.h"
10 #include <boost/python/dict.hpp>
11 typedef boost::python::dict BoostPythonDictionary;
12 #else
13 #include <boost/python/objects.hpp>
14 typedef boost::python::dictionary BoostPythonDictionary;
15 #endif
16 
17 #if defined (HAVE_PYTHON)
18 namespace boost
19 {
20 namespace python
21 {
22 class dict;
23 }
24 }
25 #else
26  #include <map>
27 #endif
28 
29 #include "audio/Types.h"
30 #include "audio/Stream.h"
31 
32 
33 namespace BaseUtil
34 {
35 #if defined (HAVE_PYTHON)
36 #if BOOST_VERSION != 102800
37 typedef boost::python::dict Dictionary;
38 #else
39 typedef boost::python::dictionary Dictionary;
40 #endif
41 #else
42 typedef std::map< std::string, std::string >Dictionary;
43 #endif
44 
45 int Room( std::string text );
46 void Texture( int room, std::string index, std::string file, float x, float y );
47 bool Video( int room, std::string index, std::string vfile, std::string afile, float x, float y );
48 bool VideoStream( int room, std::string index, std::string streamfile, float x, float y, float w, float h );
49 void SetTexture( int room, std::string index, std::string file );
50 void SetTextureSize( int room, std::string index, float w, float h );
51 void SetTexturePos( int room, std::string index, float x, float y );
52 void PlayVideo( int room, std::string index );
53 void StopVideo( int room, std::string index );
54 void SetVideoCallback( int room, std::string index, std::string callback);
55 void SetDJEnabled( bool enabled );
56 void Ship( int room, std::string index, QVector pos, Vector R, Vector Q );
57 void LinkPython( int room,
58  std::string index,
59  std::string pythonfile,
60  float x,
61  float y,
62  float wid,
63  float hei,
64  std::string text,
65  int to );
66 void LaunchPython( int room,
67  std::string index,
68  std::string pythonfile,
69  float x,
70  float y,
71  float wid,
72  float hei,
73  std::string text );
74 void EjectPython( int room, std::string index, std::string pythonfile, float x, float y, float wid, float hei, std::string text );
75 void CompPython( int room,
76  std::string index,
77  std::string pythonfile,
78  float x,
79  float y,
80  float wid,
81  float hei,
82  std::string text,
83  std::string modes );
84 void GlobalKeyPython( std::string pythonfile );
85 
86 void Link( int room, std::string index, float x, float y, float wid, float hei, std::string text, int to );
87 void Launch( int room, std::string index, float x, float y, float wid, float hei, std::string text );
88 void Comp( int room, std::string index, float x, float y, float wid, float hei, std::string text, std::string modes );
89 void Python( int room,
90  std::string index,
91  float x,
92  float y,
93  float wid,
94  float hei,
95  std::string text,
96  std::string pythonfile,
97  bool front = false );
98 void MessageToRoom( int room, std::string text );
99 void EnqueueMessageToRoom( int room, std::string text );
100 void Message( std::string text );
101 void EnqueueMessage( std::string text );
102 void RunScript( int room, std::string ind, std::string pythonfile, float time );
103 void TextBox( int room,
104  std::string ind,
105  std::string text,
106  float x,
107  float y,
108  Vector widheimult,
109  Vector backcol,
110  float backalp,
111  Vector forecol );
112 void SetTextBoxText( int room, std::string ind, std::string text );
113 void SetLinkArea( int room, std::string index, float x, float y, float wid, float hei );
114 void SetLinkText( int room, std::string index, std::string text );
115 void SetLinkPython( int room, std::string index, std::string python );
116 void SetLinkRoom( int room, std::string index, int to );
117 void SetLinkEventMask( int room, std::string index, std::string maskdef ); //c=click, u=up, d=down, e=enter, l=leave, m=move
118 void EraseLink( int room, std::string index );
119 void EraseObj( int room, std::string index );
120 int GetCurRoom();
121 void SetCurRoom( int room );
122 bool HasObject( int room, std::string index );
123 int GetNumRoom();
124 bool BuyShip( std::string name, bool my_fleet, bool force_base_inventory );
125 bool SellShip( std::string name );
126 
127 //Sound streaming
128 SharedPtr<Audio::Source> CreateVideoSoundStream( const std::string &afile, const std::string &scene );
129 void DestroyVideoSoundStream( SharedPtr<Audio::Source> source, const std::string &scene );
130 
131 //GUI events
132 void SetEventData( Dictionary data );
133 void SetMouseEventData( std::string type, float x, float y, int buttonMask ); //[type], [mousex], [mousey], [mousebuttons]
134 void SetKeyEventData( std::string type, unsigned int keycode, unsigned int modmask = ~0 );
135 void SetKeyStatusEventData( unsigned int modmask = ~0 );
136 const Dictionary& GetEventData();
137 
138 //GUI events (engine internals)
140 
141 //Auxiliary
142 float GetTextHeight( std::string text, Vector widheimult );
143 float GetTextWidth( std::string text, Vector widheimult );
144 void LoadBaseInterface( std::string name );
145 void LoadBaseInterfaceAtDock( std::string name, Unit *dockat, Unit *dockee );
146 void refreshBaseComputerUI( const class Cargo *dirtyCarg );
147 void ExitGame();
148 }
149 
150 #endif