// $Id: Display.hh 6142 2007-03-05 10:25:14Z m9710797 $ #ifndef DISPLAY_HH #define DISPLAY_HH #include "RendererFactory.hh" #include "EventListener.hh" #include "LayerListener.hh" #include "Observer.hh" #include "CircularBuffer.hh" #include "noncopyable.hh" #include #include #include namespace openmsx { class Layer; class Reactor; class VideoSystem; class RenderSettings; class VideoSystemChangeListener; class Setting; class RepaintAlarm; class ScreenShotCmd; class FpsInfoTopic; /** Represents the output window/screen of openMSX. * A display contains several layers. */ class Display : private EventListener, private Observer, private LayerListener, private noncopyable { public: explicit Display(Reactor& reactor); virtual ~Display(); void createVideoSystem(); VideoSystem& getVideoSystem(); RenderSettings& getRenderSettings(); /** Redraw the display. */ void repaint(); void repaintDelayed(unsigned long long delta); void addLayer(Layer& layer); void removeLayer(Layer& layer); void attach(VideoSystemChangeListener& listener); void detach(VideoSystemChangeListener& listener); Layer* findLayer(const std::string& name) const; private: void resetVideoSystem(); void setWindowTitle(); // EventListener interface virtual bool signalEvent(shared_ptr event); // Observer interface virtual void update(const Setting& setting); void checkRendererSwitch(); void doRendererSwitch(); void doRendererSwitch2(); typedef std::vector Layers; /** Find frontmost opaque layer. */ Layers::iterator baseLayer(); // LayerListener interface virtual void updateZ(Layer& layer); Layers layers; std::auto_ptr videoSystem; // the current renderer RendererFactory::RendererID currentRenderer; typedef std::vector Listeners; Listeners listeners; // fps related data static const unsigned NUM_FRAME_DURATIONS = 50; CircularBuffer frameDurations; unsigned long long frameDurationSum; unsigned long long prevTimeStamp; friend class FpsInfoTopic; const std::auto_ptr alarm; // delayed repaint const std::auto_ptr screenShotCmd; const std::auto_ptr fpsInfo; Reactor& reactor; std::auto_ptr renderSettings; bool switchInProgress; }; } // namespace openmsx #endif