Panda3D
config_rocket.cxx
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file config_rocket.cxx
10  * @author rdb
11  * @date 2011-11-04
12  */
13 
14 #include "config_rocket.h"
15 #include "rocketFileInterface.h"
16 #include "rocketInputHandler.h"
17 #include "rocketRegion.h"
18 #include "rocketSystemInterface.h"
19 
20 #include "pandaSystem.h"
21 #include "dconfig.h"
22 #include "default_font.h"
23 
24 // This is defined by both Panda and Rocket.
25 #define Factory RocketFactory
26 #include <Rocket/Core.h>
27 #undef Factory
28 
29 #if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_ROCKET)
30  #error Buildsystem error: BUILDING_ROCKET not defined
31 #endif
32 
33 Configure(config_rocket);
34 NotifyCategoryDef(rocket, "");
35 
36 ConfigureFn(config_rocket) {
38 }
39 
40 /**
41  * Initializes the library. This must be called at least once before any of
42  * the functions or classes in this library can be used. Normally it will be
43  * called by the static initializers and need not be called explicitly, but
44  * special cases exist.
45  */
46 void
48  static bool initialized = false;
49  if (initialized) {
50  return;
51  }
52  initialized = true;
53 
54  RocketInputHandler::init_type();
55  RocketRegion::init_type();
56 
57  if (rocket_cat->is_debug()) {
58  rocket_cat->debug() << "Initializing libRocket library.\n";
59  }
60 
62  Rocket::Core::SetFileInterface(fi);
63 
65  Rocket::Core::SetSystemInterface(si);
66 
67  Rocket::Core::Initialise();
68 
69  // Register that we have the libRocket system.
71  ps->add_system("libRocket");
72 
73 #ifdef COMPILE_IN_DEFAULT_FONT
74 #ifdef HAVE_FREETYPE
75  // Load Panda's default compiled-in freetype font (Perspective Sans).
76  Rocket::Core::FontDatabase::LoadFontFace(default_font_data, default_font_size);
77 #endif
78 #endif
79 }
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static PandaSystem * get_global_ptr()
Returns the global PandaSystem object.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class is used as a namespace to group several global properties of Panda.
Definition: pandaSystem.h:26
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void init_librocket()
Initializes the library.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is an implementation of SystemInterface that redirects the log output to Panda's notify system.
void add_system(const std::string &system)
Intended for use by each subsystem to register itself at startup.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Implementation of FileInterface to allow libRocket to read files from the virtual file system.