diff options
Diffstat (limited to 'src/emu/screen.h')
-rw-r--r-- | src/emu/screen.h | 185 |
1 files changed, 111 insertions, 74 deletions
diff --git a/src/emu/screen.h b/src/emu/screen.h index 0ae11f85b9b..87eed6a2738 100644 --- a/src/emu/screen.h +++ b/src/emu/screen.h @@ -207,7 +207,24 @@ public: void set_orientation(int orientation) { assert(!configured()); m_orientation = orientation; } void set_physical_aspect(unsigned x, unsigned y) { assert(!configured()); m_phys_aspect = std::make_pair(x, y); } void set_native_aspect() { assert(!configured()); m_phys_aspect = std::make_pair(~0U, ~0U); } - void set_raw(u32 pixclock, u16 htotal, u16 hbend, u16 hbstart, u16 vtotal, u16 vbend, u16 vbstart) + + /// \brief Configure screen parameters + /// + /// \param [in] pixclock Pixel clock frequency in Hertz. + /// \param [in] htotal Total pixel clocks per line, including + /// horizontal blanking period. + /// \param [in] hbend Index of first visible pixel after horizontal + /// blanking period ends. + /// \param [in] hbstart Index of first pixel in horzontal blanking + /// period after visible pixels. + /// \param [in] vtotal Total lines per frame, including vertical + /// blanking period. + /// \param [in] vbend Index of first visible line after vertical + /// blanking period ends. + /// \param [in] vbstart Index of first line in vertical blanking + /// period after visible lines. + /// \return Reference to device for method chaining. + screen_device &set_raw(u32 pixclock, u16 htotal, u16 hbend, u16 hbstart, u16 vtotal, u16 vbend, u16 vbstart) { assert(pixclock != 0); m_clock = pixclock; @@ -216,15 +233,101 @@ public: m_width = htotal; m_height = vtotal; m_visarea.set(hbend, hbstart - 1, vbend, vbstart - 1); + return *this; + } + screen_device &set_raw(const XTAL &xtal, u16 htotal, u16 hbend, u16 hbstart, u16 vtotal, u16 vbend, u16 vbstart) + { + xtal.validate(std::string("Configuring screen ") + tag()); + return set_raw(xtal.value(), htotal, hbend, hbstart, vtotal, vbend, vbstart); } - void set_raw(const XTAL &xtal, u16 htotal, u16 hbend, u16 hbstart, u16 vtotal, u16 vbend, u16 vbstart) { set_raw(xtal.value(), htotal, hbend, hbstart, vtotal, vbend, vbstart); } void set_refresh(attoseconds_t rate) { m_refresh = rate; } - template <typename T> void set_refresh_hz(T &&hz) { set_refresh(HZ_TO_ATTOSECONDS(std::forward<T>(hz))); } - void set_vblank_time(attoseconds_t time) { m_vblank = time; m_oldstyle_vblank_supplied = true; } - void set_size(u16 width, u16 height) { m_width = width; m_height = height; } - void set_visarea(s16 minx, s16 maxx, s16 miny, s16 maxy) { m_visarea.set(minx, maxx, miny, maxy); } - void set_visarea_full() { m_visarea.set(0, m_width - 1, 0, m_height - 1); } // call after set_size - void set_default_position(double xscale, double xoffs, double yscale, double yoffs) { + + /// \brief Set refresh rate in Hertz + /// + /// Sets refresh rate in Hertz (frames per second). Used in + /// conjunction with #set_vblank_time, #set_size and #set_visarea. + /// For raster displays, please use #set_raw to configure screen + /// parameters in terms of pixel clock. + /// \param [in] hz Desired refresh rate. + /// \return Reference to device for method chaining. + template <typename T> screen_device &set_refresh_hz(T &&hz) + { + set_refresh(HZ_TO_ATTOSECONDS(std::forward<T>(hz))); + return *this; + } + + /// \brief Set vertical blanking interval time + /// + /// Sets vertical blanking interval period. Used in conjunction + /// with #set_refresh_hz, #set_size and #set_visarea. For raster + /// displays, please use #set_raw to configure screen parameters in + /// terms of pixel clock. + /// \param [in] time Length of vertical blanking interval. + /// \return Reference to device for method chaining. + screen_device &set_vblank_time(attoseconds_t time) + { + m_vblank = time; + m_oldstyle_vblank_supplied = true; + return *this; + } + + /// \brief Set total screen size + /// + /// Set the total screen size in pixels, including blanking areas if + /// applicable. This sets the size of the screen bitmap. Used in + /// conjunction with #set_refresh_hz, #set_vblank_time and + /// #set_visarea. For raster displays, please use #set_raw to + /// configure screen parameters in terms of pixel clock. + /// \param [in] width Total width in pixels, including horizontal + /// blanking period if applicable. + /// \param [in] height Total height in lines, including vertical + /// blanking period if applicable. + /// \return Reference to device for method chaining. + screen_device &set_size(u16 width, u16 height) + { + m_width = width; + m_height = height; + return *this; + } + + /// \brief Set visible screen area + /// + /// Set visible screen area. This should fit within the total + /// screen area. Used in conjunction with #set_refresh_hz, + /// #set_vblank_time and #set_size. For raster displays, please + /// use #set_raw to configure screen parameters in terms of pixel + /// clock. + /// \param [in] minx First visible pixel index after horizontal + /// blanking period ends. + /// \param [in] maxx Last visible pixel index before horizontal + /// blanking period starts. + /// \param [in] miny First visible line index after vertical + /// blanking period ends. + /// \param [in] maxy Last visible line index before vertical + /// blanking period starts. + /// \return Reference to device for method chaining. + screen_device &set_visarea(s16 minx, s16 maxx, s16 miny, s16 maxy) + { + m_visarea.set(minx, maxx, miny, maxy); + return *this; + } + + /// \brief Set visible area to full area + /// + /// Set visible screen area to the full screen area (i.e. noi + /// horizontal or vertical blanking period). This is generally not + /// possible for raster displays, but is useful for other display + /// simulations. Must be called after calling #set_size. + /// \return Reference to device for method chaining. + /// \sa set_visarea + screen_device &set_visarea_full() + { + m_visarea.set(0, m_width - 1, 0, m_height - 1); + return *this; + } + + void set_default_position(double xscale, double xoffs, double yscale, double yoffs) + { m_xscale = xscale; m_xoffset = xoffs; m_yscale = yscale; @@ -445,72 +548,6 @@ typedef device_type_iterator<screen_device> screen_device_iterator; @def set_type Modify the screen device type @see screen_type_enum - - @def set_raw - Configures screen parameters for the given screen. - @remark It's better than using @see set_refresh_hz and @see set_vblank_time but still not enough. - - @param _pixclock - Pixel Clock frequency value - - @param _htotal - Total number of horizontal pixels, including hblank period. - - @param _hbend - Horizontal pixel position for HBlank end event, also first pixel where screen rectangle is visible. - - @param _hbstart - Horizontal pixel position for HBlank start event, also last pixel where screen rectangle is visible. - - @param _vtotal - Total number of vertical pixels, including vblank period. - - @param _vbend - Vertical pixel position for VBlank end event, also first pixel where screen rectangle is visible. - - @param _vbstart - Vertical pixel position for VBlank start event, also last pixel where screen rectangle is visible. - - @def set_refresh_hz - Sets the number of Frames Per Second for this screen - @remarks Please use @see set_raw instead. Gives imprecise timings. - - @param _rate - FPS number - - @def set_vblank_time - Sets the vblank time of the given screen - @remarks Please use @see MCFG_SCREEN_RAW_PARAMS instead. Gives imprecise timings. - - @param _time - Time parameter, in attotime value - - @def set_size - Sets total screen size, including H/V-Blanks - @remarks Please use @see set_raw instead. Gives imprecise timings. - - @param _width - Screen horizontal size - - @param _height - Screen vertical size - - @def set_visarea - Sets screen visible area - @remarks Please use @see set_raw instead. Gives imprecise timings. - - @param _minx - Screen left border - - @param _maxx - Screen right border, must be in N-1 format - - @param _miny - Screen top border - - @param _maxx - Screen bottom border, must be in N-1 format - @} */ |