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

gui.C

Go to the documentation of this file.
00001 //----------------------------------------------------------------------
00002 //               The Motion Strategy Library (MSL)
00003 //----------------------------------------------------------------------
00004 //
00005 // Copyright (c) 1998-2000 Iowa State University and Steve LaValle.  
00006 // All Rights Reserved.
00007 // 
00008 // Permission to use, copy, and distribute this software and its 
00009 // documentation is hereby granted free of charge, provided that 
00010 // (1) it is not a component of a commercial product, and 
00011 // (2) this notice appears in all copies of the software and
00012 //     related documentation. 
00013 // 
00014 // Iowa State University and the author make no representations
00015 // about the suitability or fitness of this software for any purpose.  
00016 // It is provided "as is" without express or implied warranty.
00017 //----------------------------------------------------------------------
00018 
00019 #include <math.h>
00020 #include <stdio.h>
00021 #include <fstream.h>
00022 
00023 #include "gui.h"
00024 #include "defs.h"
00025 
00026 
00027 // *********************************************************************
00028 // *********************************************************************
00029 // CLASS:     Gui base class
00030 // 
00031 // *********************************************************************
00032 // *********************************************************************
00033 
00034 Gui::Gui(Render *render) {
00035   R = render;
00036 
00037   FilePath = R->FilePath;
00038 }
00039 
00040 
00041 void Gui::Init() 
00042 {
00043   // Perform Render initialization
00044   R->Init();
00045 }
00046 
00047 
00048 
00049 void Gui::Start() 
00050 {
00051   // Perform initialization
00052   Init();
00053 
00054   // Enter the event processing loop
00055   MainLoop();
00056 }
00057 
00058 
00059 
00060 
00061 void Gui::MainLoop() 
00062 {
00063   int i;
00064   if (R->ControlFreak) { // Does the renderer NEED to be in control?
00065     R->MainLoop(this); // Give a pointer to this Gui
00066     // It is the responsibility of Render to handle Gui events
00067   }
00068   else {
00069     Finished = false;
00070     while (!Finished) {
00071       R->HandleEvents(); // Handle events in the renderer
00072       for (i = 0; i < 10; i++) // Need to make this better!!!!! 
00073         HandleEvents();
00074     }
00075   }
00076 
00077   R->Terminate();  // If we ever get here (some control freaks don't allow it)
00078 }
00079 
Motion Strategy Library


Web page maintained by Steve LaValle
Partial support provided by NSF CAREER Award IRI-970228 (LaValle), Honda Research, and Iowa State University.
Contributors: Anna Atramentov, Peng Cheng, James Kuffner, Steve LaValle, and Libo Yang.