Object given to any 'client' application Give access to network, configuration, ... More...
#include <App.hh>
Public Member Functions | |
| App (lua_State *l) | |
| void | startServer () |
| Start a server, running on the same processus. | |
| void | connect () |
| Connect to the server. | |
| void | disconnect () |
| Disconnect from server. | |
| int | connectionStatus () |
| Get client's connection status to the server. | |
| Api * | getApi () |
| Get the api. | |
| void | process (bool block=false, bool do_poll=true) |
| Process server/network/. | |
| template<typename T > | |
| T | getConf (const std::string &key) const |
| Get a configuration value. | |
| template<typename T > | |
| void | setConf (const std::string &key, const T &value) |
| Set a configuration value. | |
| void | setConfInt (const std::string &key, const std::string &value) |
| Set a configuration value. | |
| void | writeConf () |
| Write user defined values, set using 'setConf', on a file on the disk. | |
| template<> | |
| void | setConf (const std::string &key, const std::string &value) |
| template<> | |
| void | setConf (const std::string &key, const int &value) |
| template<> | |
| void | setConf (const std::string &key, const bool &value) |
Static Public Attributes | |
| static const char | className [] = "App" |
| static Luna< App >::RegType | methods [] |
Object given to any 'client' application Give access to network, configuration, ...
| void App::connect | ( | ) |
Connect to the server.
Host/Port used are the ones specified in configuration. This function always succeed, you should then poll status with 'connectionStatus'.
Referenced by sfmlgui::SFMLApp::run(), and CmdLineWrapper::run().
| int App::connectionStatus | ( | ) |
Get client's connection status to the server.
Referenced by sdlvisu::VisuApp::run(), sfmlgui::SFMLApp::run(), and CmdLineWrapper::run().
| void App::disconnect | ( | ) |
Disconnect from server.
| Api * App::getApi | ( | ) |
Get the api.
Referenced by sdlvisu::VisuApp::run(), sfmlgui::SFMLApp::run(), and CmdLineWrapper::run().
| bool App::getConf | ( | const std::string & | key | ) | const [inline] |
Get a configuration value.
| key | Configuration key (eg: client.connect_host) |
Referenced by sdlvisu::VisuApp::init(), and CmdLineWrapper::run().
| void App::process | ( | bool | block = false, |
|
| bool | do_poll = true | |||
| ) |
Process server/network/.
.. data
| block | If true, this function will block around 50ms. Use it if you don't have yourself a blocking function. | |
| do_poll | If true, this function won't poll packets for the client. Use it if you need to delay the GUI (for example, during an animation). |
Referenced by sdlvisu::VisuApp::run(), sfmlgui::SFMLApp::run(), and CmdLineWrapper::run().
| void App::setConf | ( | const std::string & | key, | |
| const T & | value | |||
| ) | [inline] |
Set a configuration value.
| key | Configuration key. | |
| value | Value to set (see getConf). |
Referenced by sfmlgui::SFMLApp::run().
| void App::setConfInt | ( | const std::string & | key, | |
| const std::string & | value | |||
| ) |
Set a configuration value.
| void App::startServer | ( | ) |
Start a server, running on the same processus.
Listen port is 'server.listen_port' configuration item. You can then connect it using 'connect', on localhost:listen_port.
| void App::writeConf | ( | ) |
Write user defined values, set using 'setConf', on a file on the disk.
1.6.3