Revision: 6792
          http://playerstage.svn.sourceforge.net/playerstage/?rev=6792&view=rev
Author:   jeremy_asher
Date:     2008-07-07 15:38:56 -0700 (Mon, 07 Jul 2008)

Log Message:
-----------
Added saving of perspective cam mode, fixed camera pointer not changing -> 
picker now works in perspective mode

Modified Paths:
--------------
    code/stage/trunk/libstage/canvas.cc
    code/stage/trunk/libstage/option.cc
    code/stage/trunk/libstage/option.hh
    code/stage/trunk/libstage/stage.hh
    code/stage/trunk/libstage/world.cc
    code/stage/trunk/worlds/fasr.world

Modified: code/stage/trunk/libstage/canvas.cc
===================================================================
--- code/stage/trunk/libstage/canvas.cc 2008-07-07 22:13:09 UTC (rev 6791)
+++ code/stage/trunk/libstage/canvas.cc 2008-07-07 22:38:56 UTC (rev 6792)
@@ -53,7 +53,7 @@
   showTrailRise( "Trails/Rising blocks", "show_trailrise", "^r", false ),
   showTrails( "Trails/Fast", "show_trailfast", "^f", false ),
   showTree( "Debug/Tree", "show_tree", "^t", false ),
-  perspectiveCam( "Perspective camera", "show_perspective", "r", false ),
+  perspectiveCam( "Perspective camera", "pcam_on", "r", false ),
   visualizeAll( "Visualize All", "vis_all", "^v", true ) 
 {
   end();
@@ -816,9 +816,18 @@
   printf( "Saved %s\n", filename );
 }
 
-void perspectiveCb( Fl_Widget* w, void* p ) 
+void StgCanvas::perspectiveCb( Fl_Widget* w, void* p ) 
 {
-       StgCanvas* canvas = static_cast<StgCanvas*>( p );
+       StgCanvas* canvas = static_cast<StgCanvas*>( w );
+       Option* opt = static_cast<Option*>( p ); // perspectiveCam
+       if ( opt ) {
+               // Perspective mode is on, change camera
+               canvas->current_camera = &canvas->perspective_camera;
+       }
+       else {
+               canvas->current_camera = &canvas->camera;
+       }
+       
        canvas->invalidate();
 }
 
@@ -865,6 +874,7 @@
   showTrails.Load( wf, sec );
   showTree.Load( wf, sec );
   showScreenshots.Load( wf, sec );
+  perspectiveCam.Load( wf, sec );
 
   invalidate(); // we probably changed something
 }
@@ -889,6 +899,7 @@
   showTrails.Save( wf, sec );
   showTree.Save( wf, sec );
   showScreenshots.Save( wf, sec );
+  perspectiveCam.Save( wf, sec );
 }
 
 

Modified: code/stage/trunk/libstage/option.cc
===================================================================
--- code/stage/trunk/libstage/option.cc 2008-07-07 22:13:09 UTC (rev 6791)
+++ code/stage/trunk/libstage/option.cc 2008-07-07 22:38:56 UTC (rev 6792)
@@ -34,12 +34,12 @@
        Option* opt = static_cast<Option*>( p );
        opt->invert();
        if ( opt->menuCb )
-               opt->menuCb( NULL, opt->menuCbParam );
+               opt->menuCb( opt->menuCbWidget, opt );
 }
 
-void Option::menuCallback( Fl_Callback* cb, void* p ) {
+void Option::menuCallback( Fl_Callback* cb, Fl_Widget* w ) {
        menuCb = cb;
-       menuCbParam = p;
+       menuCbWidget = w;
 }
 
 void Option::createMenuItem( Fl_Menu_Bar* m, std::string path )

Modified: code/stage/trunk/libstage/option.hh
===================================================================
--- code/stage/trunk/libstage/option.hh 2008-07-07 22:13:09 UTC (rev 6791)
+++ code/stage/trunk/libstage/option.hh 2008-07-07 22:38:56 UTC (rev 6792)
@@ -30,7 +30,7 @@
                Fl_Menu_* menu;
                int menuIndex;
                Fl_Callback* menuCb;
-               void* menuCbParam;
+               Fl_Widget* menuCbWidget;
          
        public:
                Option( std::string n, std::string tok, std::string key, bool v 
);        
@@ -51,7 +51,7 @@
 
 
                void createMenuItem( Fl_Menu_Bar* menu, std::string path );
-               void menuCallback( Fl_Callback* cb, void* p );
+               void menuCallback( Fl_Callback* cb, Fl_Widget* w );
                static void toggleCb( Fl_Widget* w, void* p );
                void Load( Worldfile* wf, int section );
                void Save( Worldfile* wf, int section );          

Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh  2008-07-07 22:13:09 UTC (rev 6791)
+++ code/stage/trunk/libstage/stage.hh  2008-07-07 22:38:56 UTC (rev 6792)
@@ -1985,6 +1985,7 @@
        void InvertView( uint32_t invertflags );
 
        static void TimerCallback( StgCanvas* canvas );
+       static void perspectiveCb( Fl_Widget* w, void* p );
   
   void Load( Worldfile* wf, int section );
   void Save( Worldfile* wf, int section );

Modified: code/stage/trunk/libstage/world.cc
===================================================================
--- code/stage/trunk/libstage/world.cc  2008-07-07 22:13:09 UTC (rev 6791)
+++ code/stage/trunk/libstage/world.cc  2008-07-07 22:38:56 UTC (rev 6792)
@@ -256,7 +256,7 @@
                // vanilla model if the type is NULL.
                stg_creator_t creator = NULL;
                
-               printf( "creating model of type %s\n", typestr );
+               //printf( "creating model of type %s\n", typestr );
 
                if( typestr ) // look up the string in the typetable
                  for( int i=0; i<MODEL_TYPE_COUNT; i++ )

Modified: code/stage/trunk/worlds/fasr.world
===================================================================
--- code/stage/trunk/worlds/fasr.world  2008-07-07 22:13:09 UTC (rev 6791)
+++ code/stage/trunk/worlds/fasr.world  2008-07-07 22:38:56 UTC (rev 6792)
@@ -27,8 +27,9 @@
   rotate [ 0 0 ]
   scale 32.344 
 
-  pcam_loc [ 0 -4 2 ]
+  pcam_loc [ 0 -4.000 2.000 ]
   pcam_angle [ 70.000 0 ]
+  pcam_on 0
   
   show_data 0
   show_flags 1


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to