Permalink
Browse files

Applied patch #2963966: Add ability to start up stage player plugin w…

…ithout opening the GUI
  • Loading branch information...
1 parent 30079dc commit 3849dc57d0dc42c36a2a577f2c092bf2022a413a Rich Mattes committed Sep 15, 2010
Showing with 10 additions and 4 deletions.
  1. +6 −2 libstageplugin/p_driver.cc
  2. +2 −1 libstageplugin/p_driver.h
  3. +2 −1 libstageplugin/p_simulation.cc
View
8 libstageplugin/p_driver.cc
@@ -167,7 +167,8 @@ extern bool player_quiet_startup;
extern bool player_quit;
// init static vars
-WorldGui* StgDriver::world = NULL;
+World* StgDriver::world = NULL;
+bool StgDriver::usegui = true;
//int update_request = 0;
@@ -596,7 +597,10 @@ void StgDriver::Update(void)
{
case PLAYER_SIMULATION_CODE:
// one round of FLTK's update loop.
- Fl::wait();
+ if (StgDriver::usegui)
+ Fl::wait();
+ else
+ StgDriver::world->Update();
break;
default:
View
3 libstageplugin/p_driver.h
@@ -38,7 +38,8 @@ class StgDriver : public Driver
virtual void Update();
/// all player devices share the same Stage world (for now)
- static Stg::WorldGui* world;
+ static Stg::World* world;
+ static bool usegui;
/// find the device record with this Player id
Interface* LookupDevice( player_devaddr_t addr );
View
3 libstageplugin/p_simulation.cc
@@ -79,6 +79,7 @@ InterfaceSimulation::InterfaceSimulation( player_devaddr_t addr,
Stg::Init( &player_argc, &player_argv );
const char* worldfile_name = cf->ReadString(section, "worldfile", NULL );
+ StgDriver::usegui = cf->ReadBool(section, "usegui", 1 );
if( worldfile_name == NULL )
{
@@ -114,7 +115,7 @@ InterfaceSimulation::InterfaceSimulation( player_devaddr_t addr,
// worldfile
// if the initial size is to large this crashes on some systems
- StgDriver::world = new WorldGui( 400, 300, "Player/Stage" );
+ StgDriver::world = ( StgDriver::usegui ? new WorldGui( 400, 300, worldfile_name ) : new World(worldfile_name));
assert(StgDriver::world);
puts("");

0 comments on commit 3849dc5

Please sign in to comment.