mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -04:00
*** empty log message ***
This commit is contained in:
parent
9a77c5f235
commit
c49b34ba44
@ -6,9 +6,11 @@
|
||||
#include "panda.h"
|
||||
|
||||
#include <config_device.h>
|
||||
#include <config_display.h>
|
||||
#include <config_graph.h>
|
||||
#include <config_sgraph.h>
|
||||
#include <config_pnmimagetypes.h>
|
||||
#include <config_pstats.h>
|
||||
#include <config_sgraph.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: init_libpanda
|
||||
@ -21,7 +23,9 @@
|
||||
void
|
||||
init_libpanda() {
|
||||
init_libdevice();
|
||||
init_libdisplay();
|
||||
init_libgraph();
|
||||
init_libsgraph();
|
||||
init_libpnmimagetypes();
|
||||
init_libpstatclient();
|
||||
init_libsgraph();
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
textureContext.cxx textureContext.h
|
||||
|
||||
#define INSTALL_HEADERS \
|
||||
config_display.h \
|
||||
displayRegion.I displayRegion.h displayRegionStack.I \
|
||||
displayRegionStack.h frameBufferStack.I frameBufferStack.h \
|
||||
graphicsChannel.I graphicsChannel.h graphicsLayer.I graphicsLayer.h \
|
||||
|
@ -25,35 +25,7 @@ static Config::ConfigTable::Symbol *preferred_window;
|
||||
static Config::ConfigTable::Symbol *preferred_gsg;
|
||||
|
||||
ConfigureFn(config_display) {
|
||||
GraphicsStateGuardian::init_type();
|
||||
GraphicsStateGuardian::GsgParam::init_type();
|
||||
GraphicsStateGuardian::GsgWindow::init_type();
|
||||
SavedFrameBuffer::init_type();
|
||||
GraphicsPipe::init_type();
|
||||
GraphicsPipe::PipeParam::init_type();
|
||||
GraphicsPipe::PipeSpec::init_type();
|
||||
InteractiveGraphicsPipe::init_type();
|
||||
NoninteractiveGraphicsPipe::init_type();
|
||||
GraphicsWindow::init_type();
|
||||
GraphicsWindow::WindowParam::init_type();
|
||||
GraphicsWindow::WindowProps::init_type();
|
||||
GraphicsWindow::WindowPipe::init_type();
|
||||
GraphicsChannel::init_type();
|
||||
HardwareChannel::init_type();
|
||||
TextureContext::init_type();
|
||||
|
||||
disp = new Config::ConfigTable::Symbol;
|
||||
guard = new Config::ConfigTable::Symbol;
|
||||
preferred_pipe = new Config::ConfigTable::Symbol;
|
||||
preferred_window = new Config::ConfigTable::Symbol;
|
||||
preferred_gsg = new Config::ConfigTable::Symbol;
|
||||
|
||||
config_display.GetAll("load-display", *disp);
|
||||
config_display.GetAll("load-gsg", *guard);
|
||||
|
||||
config_display.GetAll("preferred-pipe", *preferred_pipe);
|
||||
config_display.GetAll("preferred-window", *preferred_window);
|
||||
config_display.GetAll("preferred-gsg", *preferred_gsg);
|
||||
init_libdisplay();
|
||||
}
|
||||
|
||||
const string pipe_spec_machine = config_display.GetString("pipe-machine", "");
|
||||
@ -111,3 +83,50 @@ Config::ConfigTable::Symbol::iterator preferred_gsg_begin(void) {
|
||||
Config::ConfigTable::Symbol::iterator preferred_gsg_end(void) {
|
||||
return preferred_gsg->end();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: init_libdisplay
|
||||
// Description: Initializes the library. This must be called at
|
||||
// least once before any of the functions or classes in
|
||||
// this library can be used. Normally it will be
|
||||
// called by the static initializers and need not be
|
||||
// called explicitly, but special cases exist.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
init_libdisplay() {
|
||||
static bool initialized = false;
|
||||
if (initialized) {
|
||||
return;
|
||||
}
|
||||
initialized = true;
|
||||
|
||||
GraphicsStateGuardian::init_type();
|
||||
GraphicsStateGuardian::GsgParam::init_type();
|
||||
GraphicsStateGuardian::GsgWindow::init_type();
|
||||
SavedFrameBuffer::init_type();
|
||||
GraphicsPipe::init_type();
|
||||
GraphicsPipe::PipeParam::init_type();
|
||||
GraphicsPipe::PipeSpec::init_type();
|
||||
InteractiveGraphicsPipe::init_type();
|
||||
NoninteractiveGraphicsPipe::init_type();
|
||||
GraphicsWindow::init_type();
|
||||
GraphicsWindow::WindowParam::init_type();
|
||||
GraphicsWindow::WindowProps::init_type();
|
||||
GraphicsWindow::WindowPipe::init_type();
|
||||
GraphicsChannel::init_type();
|
||||
HardwareChannel::init_type();
|
||||
TextureContext::init_type();
|
||||
|
||||
disp = new Config::ConfigTable::Symbol;
|
||||
guard = new Config::ConfigTable::Symbol;
|
||||
preferred_pipe = new Config::ConfigTable::Symbol;
|
||||
preferred_window = new Config::ConfigTable::Symbol;
|
||||
preferred_gsg = new Config::ConfigTable::Symbol;
|
||||
|
||||
config_display.GetAll("load-display", *disp);
|
||||
config_display.GetAll("load-gsg", *guard);
|
||||
|
||||
config_display.GetAll("preferred-pipe", *preferred_pipe);
|
||||
config_display.GetAll("preferred-window", *preferred_window);
|
||||
config_display.GetAll("preferred-gsg", *preferred_gsg);
|
||||
}
|
||||
|
@ -38,4 +38,6 @@ extern Config::ConfigTable::Symbol::iterator preferred_window_end();
|
||||
extern Config::ConfigTable::Symbol::iterator preferred_gsg_begin();
|
||||
extern Config::ConfigTable::Symbol::iterator preferred_gsg_end();
|
||||
|
||||
extern EXPCL_PANDA void init_libdisplay();
|
||||
|
||||
#endif /* CONFIG_DISPLAY_H */
|
||||
|
@ -11,6 +11,7 @@ Configure(config_pstats);
|
||||
NotifyCategoryDef(pstats, "");
|
||||
|
||||
ConfigureFn(config_pstats) {
|
||||
init_libpstatclient();
|
||||
}
|
||||
|
||||
string get_pstats_name() {
|
||||
@ -29,3 +30,21 @@ const double pstats_target_frame_rate = config_pstats.GetDouble("pstats-target-f
|
||||
// not the client.
|
||||
const bool pstats_scroll_mode = config_pstats.GetBool("pstats-scroll-mode", true);
|
||||
const double pstats_history = config_pstats.GetDouble("pstats-history", 30.0);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: init_libpstatclient
|
||||
// Description: Initializes the library. This must be called at
|
||||
// least once before any of the functions or classes in
|
||||
// this library can be used. Normally it will be
|
||||
// called by the static initializers and need not be
|
||||
// called explicitly, but special cases exist.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
init_libpstatclient() {
|
||||
static bool initialized = false;
|
||||
if (initialized) {
|
||||
return;
|
||||
}
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
|
@ -23,4 +23,6 @@ extern EXPCL_PANDA const double pstats_target_frame_rate;
|
||||
extern EXPCL_PANDA const bool pstats_scroll_mode;
|
||||
extern EXPCL_PANDA const double pstats_history;
|
||||
|
||||
extern EXPCL_PANDA void init_libpstatclient();
|
||||
|
||||
#endif
|
||||
|
@ -15,18 +15,6 @@ RegistryNode(ButtonHandle handle, const string &name) :
|
||||
_handle(handle), _name(name) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonRegistry::get_name
|
||||
// Access: Public
|
||||
// Description: Returns the name of the indicated button.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE string ButtonRegistry::
|
||||
get_name(ButtonHandle button) const {
|
||||
RegistryNode *rnode = look_up(button);
|
||||
nassertr(rnode != (RegistryNode *)NULL, "");
|
||||
return rnode->_name;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonRegistry::ptr
|
||||
// Access: Public, Static
|
||||
@ -40,3 +28,15 @@ ptr() {
|
||||
}
|
||||
return _global_pointer;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonRegistry::get_name
|
||||
// Access: Public
|
||||
// Description: Returns the name of the indicated button.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE string ButtonRegistry::
|
||||
get_name(ButtonHandle button) const {
|
||||
RegistryNode *rnode = look_up(button);
|
||||
nassertr(rnode != (RegistryNode *)NULL, "");
|
||||
return rnode->_name;
|
||||
}
|
||||
|
@ -17,9 +17,17 @@ ButtonRegistry *ButtonRegistry::_global_pointer = NULL;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonRegistry::register_type
|
||||
// Function: ButtonRegistry::register_button
|
||||
// Access: Public
|
||||
// Description:
|
||||
// Description: Registers a new ButtonHandle with the indicated name,
|
||||
// and if specified, the indicated ASCII equivalent.
|
||||
// Returns true if the button was registered, or false
|
||||
// it was already registered; in either case, the new
|
||||
// ButtonHandle is loaded into the first parameter.
|
||||
//
|
||||
// This defines a new kind of button matching the
|
||||
// indicated name. The ButtonHandle can then be passed
|
||||
// around to devices as a button in its own right.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool ButtonRegistry::
|
||||
register_button(ButtonHandle &button_handle, const string &name,
|
||||
@ -82,28 +90,35 @@ register_button(ButtonHandle &button_handle, const string &name,
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonRegistry::find_button
|
||||
// Function: ButtonRegistry::get_button
|
||||
// Access: Public
|
||||
// Description:
|
||||
// Description: Finds a ButtonHandle in the registry matching the
|
||||
// indicated name. If there is no such ButtonHandle,
|
||||
// registers a new one and returns it.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
ButtonHandle ButtonRegistry::
|
||||
find_button(const string &name) const {
|
||||
get_button(const string &name) {
|
||||
NameRegistry::const_iterator ri;
|
||||
ri = _name_registry.find(name);
|
||||
if (ri == _name_registry.end()) {
|
||||
return ButtonHandle::none();
|
||||
} else {
|
||||
|
||||
if (ri != _name_registry.end()) {
|
||||
return (*ri).second->_handle;
|
||||
}
|
||||
|
||||
ButtonHandle button;
|
||||
register_button(button, name);
|
||||
return button;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonRegistry::find_button
|
||||
// Function: ButtonRegistry::find_ascii_button
|
||||
// Access: Public
|
||||
// Description:
|
||||
// Description: Finds a ButtonHandle in the registry matching the
|
||||
// indicated ASCII equivalent character. If there is no
|
||||
// such ButtonHandle, returns ButtonHandle::none().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
ButtonHandle ButtonRegistry::
|
||||
find_button(char ascii_equivalent) const {
|
||||
find_ascii_button(char ascii_equivalent) const {
|
||||
if (_handle_registry[ascii_equivalent] == (RegistryNode *)NULL) {
|
||||
return ButtonHandle::none();
|
||||
}
|
||||
|
@ -31,20 +31,22 @@ protected:
|
||||
string _name;
|
||||
};
|
||||
|
||||
PUBLISHED:
|
||||
public:
|
||||
bool register_button(ButtonHandle &button_handle, const string &name,
|
||||
char ascii_equivalent = '\0');
|
||||
|
||||
ButtonHandle find_button(const string &name) const;
|
||||
ButtonHandle find_button(char ascii_equivalent) const;
|
||||
|
||||
INLINE string get_name(ButtonHandle button) const;
|
||||
|
||||
void write(ostream &out) const;
|
||||
PUBLISHED:
|
||||
ButtonHandle get_button(const string &name);
|
||||
ButtonHandle find_ascii_button(char ascii_equivalent) const;
|
||||
|
||||
// ptr() returns the pointer to the global ButtonRegistry object.
|
||||
INLINE static ButtonRegistry *ptr();
|
||||
|
||||
public:
|
||||
INLINE string get_name(ButtonHandle button) const;
|
||||
|
||||
void write(ostream &out) const;
|
||||
|
||||
private:
|
||||
// The ButtonRegistry class should never be constructed by user code.
|
||||
// There is only one in the universe, and it constructs itself!
|
||||
|
@ -55,7 +55,7 @@ static ButtonHandle _shift_lock;
|
||||
////////////////////////////////////////////////////////////////////
|
||||
ButtonHandle KeyboardButton::
|
||||
ascii_key(char ascii_equivalent) {
|
||||
return ButtonRegistry::ptr()->find_button(ascii_equivalent);
|
||||
return ButtonRegistry::ptr()->find_ascii_button(ascii_equivalent);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
x
Reference in New Issue
Block a user