add support for the libRocket debugger

This commit is contained in:
rdb 2012-02-19 12:20:16 +00:00
parent c0f74e9da3
commit 562296e694
5 changed files with 75 additions and 9 deletions

View File

@ -1108,8 +1108,9 @@
// libRocket is a GUI library
#define ROCKET_IPATH /usr/local/include
#define ROCKET_LPATH /usr/local/lib
#define ROCKET_LIBS RocketCore boost_python
#define ROCKET_LIBS RocketCore RocketDebugger boost_python
#defer HAVE_ROCKET $[libtest $[ROCKET_LPATH],$[ROCKET_LIBS]]
#defer HAVE_ROCKET_DEBUGGER $[< $[OPTIMIZE],4]
// Unset this if you built libRocket without Python bindings
#defer HAVE_ROCKET_PYTHON $[and $[HAVE_ROCKET],$[HAVE_PYTHON]]

View File

@ -316,7 +316,10 @@ $[cdefine STDFLOAT_DOUBLE]
$[cdefine HAVE_MAYA]
$[cdefine MAYA_PRE_5_0]
/* Define if we have libRocket available and built with Python support. */
/* Define if we have libRocket available and built with the Rocket Debugger. */
$[cdefine HAVE_ROCKET_DEBUGGER]
/* Define if we have built libRocket available and built with Python support. */
$[cdefine HAVE_ROCKET_PYTHON]
/* Define if we have SoftImage available. */

View File

@ -506,9 +506,12 @@ if (COMPILER=="MSVC"):
if (PkgSkip("FFMPEG")==0): LibName("FFMPEG", GetThirdpartyDir() + "ffmpeg/lib/avformat.lib")
if (PkgSkip("FFMPEG")==0): LibName("FFMPEG", GetThirdpartyDir() + "ffmpeg/lib/avutil.lib")
if (PkgSkip("SWSCALE")==0): LibName("SWSCALE", GetThirdpartyDir() + "ffmpeg/lib/swscale.lib")
if (PkgSkip("ROCKET")==0): LibName("ROCKET", GetThirdpartyDir() + "rocket/lib/RocketCore.lib")
if (PkgSkip("ROCKET")==0): LibName("ROCKET", GetThirdpartyDir() + "rocket/lib/RocketControls.lib")
if (PkgSkip("ROCKET")==0): LibName("ROCKET", GetThirdpartyDir() + "rocket/lib/boost_python-vc90-mt-1_48.lib")
if (PkgSkip("ROCKET")==0):
LibName("ROCKET", GetThirdpartyDir() + "rocket/lib/RocketCore.lib")
LibName("ROCKET", GetThirdpartyDir() + "rocket/lib/RocketControls.lib")
LibName("ROCKET", GetThirdpartyDir() + "rocket/lib/boost_python-vc90-mt-1_48.lib")
if (GetOptimize() <= 3):
LibName("ROCKET", GetThirdpartyDir() + "rocket/lib/RocketDebugger.lib")
if (PkgSkip("OPENAL")==0):
if (os.path.exists(GetThirdpartyDir() + "openal/lib/pandaopenal32.lib")):
LibName("OPENAL", GetThirdpartyDir() + "openal/lib/pandaopenal32.lib")
@ -627,11 +630,15 @@ if (COMPILER=="LINUX"):
SmartPkgEnable("TIFF", "", ("tiff"), "tiff.h")
SmartPkgEnable("VRPN", "", ("vrpn", "quat"), ("vrpn", "quat.h", "vrpn/vrpn_Types.h"))
SmartPkgEnable("BULLET", "bullet", ("BulletSoftBody", "BulletDynamics", "BulletCollision", "LinearMath"), ("bullet", "bullet/btBulletDynamicsCommon.h"))
if sys.platform == "darwin":
rocket_libs = ("RocketCore", "RocketControls")
if (GetOptimize() <= 3):
rocket_libs += ("RocketDebugger",)
if (sys.platform != "darwin"):
# We use a statically linked libboost_python on OSX
SmartPkgEnable("ROCKET", "", ("RocketCore", "RocketControls"), "Rocket/Core.h")
else:
SmartPkgEnable("ROCKET", "", ("RocketCore", "RocketControls", "boost_python"), "Rocket/Core.h")
rocket_libs += ("boost_python",)
SmartPkgEnable("ROCKET", "", rocket_libs, "Rocket/Core.h")
SmartPkgEnable("GTK2", "gtk+-2.0")
SmartPkgEnable("JPEG", "", ("jpeg"), "jpeglib.h")
SmartPkgEnable("OPENSSL", "openssl", ("ssl", "crypto"), ("openssl/ssl.h", "openssl/crypto.h"))
@ -1733,6 +1740,7 @@ DTOOL_CONFIG=[
("HAVE_FCOLLADA", 'UNDEF', 'UNDEF'),
("HAVE_OPENAL_FRAMEWORK", 'UNDEF', 'UNDEF'),
("HAVE_ROCKET_PYTHON", '1', '1'),
("HAVE_ROCKET_DEBUGGER", 'UNDEF', 'UNDEF'),
("PRC_SAVE_DESCRIPTIONS", '1', '1'),
# ("_SECURE_SCL", '0', 'UNDEF'),
# ("_SECURE_SCL_THROWS", '0', 'UNDEF'),
@ -1828,6 +1836,9 @@ def WriteConfigSettings():
if (PkgSkip("PYTHON") != 0):
dtool_config["HAVE_ROCKET_PYTHON"] = 'UNDEF'
if (GetOptimize() <= 3):
dtool_config["HAVE_ROCKET_DEBUGGER"] = '1'
if (GetOptimize() <= 3):
if (dtool_config["HAVE_NET"] != 'UNDEF'):
dtool_config["DO_PSTATS"] = '1'

View File

@ -17,6 +17,10 @@
#include "orthographicLens.h"
#include "pStatTimer.h"
#ifdef HAVE_ROCKET_DEBUGGER
#include <Rocket/Debugger.h>
#endif
TypeHandle RocketRegion::_type_handle;
////////////////////////////////////////////////////////////////////
@ -127,3 +131,46 @@ do_cull(CullHandler *cull_handler, SceneSetup *scene_setup,
trav->end_traverse();
}
////////////////////////////////////////////////////////////////////
// Function: RocketRegion::init_debugger
// Access: Published
// Description: Initializes the libRocket debugger. This will
// return false if the debugger failed to initialize,
// or if support for the debugger has not been built
// in (for example in an optimize=4 build).
////////////////////////////////////////////////////////////////////
bool RocketRegion::
init_debugger() {
#ifdef HAVE_ROCKET_DEBUGGER
return Rocket::Debugger::Initialise(_context);
#else
return false;
#endif
}
////////////////////////////////////////////////////////////////////
// Function: RocketRegion::set_debugger_visible
// Access: Published
// Description: Sets whether the debugger should be visible.
////////////////////////////////////////////////////////////////////
void RocketRegion::
set_debugger_visible(bool visible) {
#ifdef HAVE_ROCKET_DEBUGGER
Rocket::Debugger::SetVisible(visible);
#endif
}
////////////////////////////////////////////////////////////////////
// Function: RocketRegion::is_debugger_visible
// Access: Published
// Description: Returns true if the debugger is visible.
////////////////////////////////////////////////////////////////////
bool RocketRegion::
is_debugger_visible() const {
#ifdef HAVE_ROCKET_DEBUGGER
return Rocket::Debugger::IsVisible();
#else
return false;
#endif
}

View File

@ -53,6 +53,10 @@ PUBLISHED:
INLINE void set_input_handler(RocketInputHandler *handler);
INLINE RocketInputHandler *get_input_handler() const;
bool init_debugger();
void set_debugger_visible(bool visible);
bool is_debugger_visible() const;
private:
RocketRenderInterface _interface;
Rocket::Core::Context* _context;