YAPOG  0.0.1
Yet Another Pokemon Online Game
GameData.cpp
Go to the documentation of this file.
5 
7 #include "Configuration/ConfigurationReader.hpp"
8 
9 namespace ycl
10 {
12  "Configuration";
14 
17 
23 
25  : remoteIPAddress_ (DEFAULT_REMOTE_IP_ADDRESS)
26  , windowSize_ (DEFAULT_WINDOW_SIZE)
27  , resolution_ (DEFAULT_RESOLUTION)
28  , contentPath_ (DEFAULT_CONTENT_PATH)
29  , texturePath_ (DEFAULT_TEXTURE_PATH)
30  , fontPath_ (DEFAULT_FONT_PATH)
31  , musicPath_ (DEFAULT_MUSIC_PATH)
32  , soundPath_ (DEFAULT_SOUND_PATH)
33  {
34  }
35 
37  {
38  }
39 
41  {
42  static GameData instance;
43 
44  return instance;
45  }
46 
47  void GameData::Init (const yap::String& configurationFileName)
48  {
49  yap::IFStream configurationFile;
50  configurationFile.open (configurationFileName);
51 
52  if (!configurationFile.is_open ())
54  "Failed to load configuration file: `" +
55  configurationFileName +
56  "'.");
57 
58  ConfigurationReader configurationReader (
59  Instance (),
61 
62  yap::XmlReader xmlReader (
63  configurationFile,
65 
66  xmlReader.Accept (configurationReader);
67  }
68 
70  {
71  return Instance ().remoteIPAddress_;
72  }
73 
75  {
76  return Instance ().windowSize_;
77  }
78 
80  {
81  return Instance ().resolution_;
82  }
83 
85  {
86  return Instance ().contentPath_;
87  }
88 
90  {
91  return Instance ().texturePath_;
92  }
93 
95  {
96  return Instance ().fontPath_;
97  }
98 
100  {
101  return Instance ().musicPath_;
102  }
103 
105  {
106  return Instance ().soundPath_;
107  }
108 } // namespace ycl