Wt examples  4.10.4
hangman.C
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2011 Emweb bv, Herent, Belgium
3  *
4  * See the LICENSE file for terms of use.
5  */
6 
7 #include <Wt/WApplication.h>
8 #include <Wt/WServer.h>
9 
10 #include "HangmanGame.h"
11 #include "Session.h"
12 
13 using namespace Wt;
14 
15 std::unique_ptr<WApplication> createApplication(const WEnvironment& env)
16 {
17  auto app = std::make_unique<WApplication>(env);
18 
19  app->setTitle("Hangman");
20 
21  app->messageResourceBundle().use(app->appRoot() + "strings");
22  app->messageResourceBundle().use(app->appRoot() + "templates");
23 
24  app->useStyleSheet("css/hangman.css");
25 
26  app->root()->addNew<HangmanGame>();
27 
28  return app;
29 }
30 
31 
32 int main(int argc, char **argv)
33 {
34  try {
35  WServer server(argc, argv, WTHTTP_CONFIGURATION);
36 
38 
40 
41  server.run();
42  } catch (WServer::Exception& e) {
43  std::cerr << e.what() << std::endl;
44  } catch (std::exception &e) {
45  std::cerr << "exception: " << e.what() << std::endl;
46  }
47 }
static void configureAuth()
Definition: Session.C:65
WTCONNECTOR_API void run()
WT_API void addEntryPoint(EntryPointType type, ApplicationCreator callback, const std::string &path=std::string(), const std::string &favicon=std::string())
int main(int argc, char **argv)
Definition: hangman.C:32
std::unique_ptr< WApplication > createApplication(const WEnvironment &env)
Definition: hangman.C:15