Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/testbed/pview.cxx

Go to the documentation of this file.
00001 // Filename: pview.cxx
00002 // Created by:  drose (25Feb02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #include "pandaFramework.h"
00020 
00021 PandaFramework framework;
00022 
00023 void
00024 event_W(CPT_Event, void *) {
00025   // shift-W: open a new window on the same scene.
00026   WindowFramework *window = framework.open_window();
00027   if (window != (WindowFramework *)NULL) {
00028     window->enable_keyboard();
00029     window->setup_trackball();
00030     framework.get_models().instance_to(window->get_render());
00031   }
00032 }
00033 
00034 int
00035 main(int argc, char *argv[]) {
00036   framework.open_framework(argc, argv);
00037   framework.set_window_title("Panda Viewer");
00038 
00039   WindowFramework *window = framework.open_window();
00040   if (window != (WindowFramework *)NULL) {
00041     // We've successfully opened a window.
00042 
00043     window->enable_keyboard();
00044     window->setup_trackball();
00045     framework.get_models().instance_to(window->get_render());
00046     if (argc < 2) {
00047       // If we have no arguments, get that trusty old triangle out.
00048       window->load_default_model(framework.get_models());
00049     } else {
00050       window->load_models(framework.get_models(), argc, argv);
00051     }
00052     window->loop_animations();
00053 
00054     framework.enable_default_keys();
00055     framework.get_event_handler().add_hook("shift-w", event_W, NULL);
00056     framework.main_loop();
00057     framework.report_frame_rate(nout);
00058   }
00059 
00060   return (0);
00061 }

Generated on Fri May 2 00:44:10 2003 for Panda by doxygen1.3