mirror of
https://github.com/holub/mame
synced 2025-04-23 08:49:55 +03:00
screen: add an adjustable global brightness
This commit is contained in:
parent
f7835bb35f
commit
cdeb045fbd
@ -63,6 +63,8 @@ screen_device::screen_device(const machine_config &mconfig, const char *tag, dev
|
||||
m_curtexture(0),
|
||||
m_changed(true),
|
||||
m_last_partial_scan(0),
|
||||
m_color(rgb_t(0xff, 0xff, 0xff, 0xff)),
|
||||
m_brightness(0xff),
|
||||
m_frame_period(DEFAULT_FRAME_PERIOD.as_attoseconds()),
|
||||
m_scantime(1),
|
||||
m_pixeltime(1),
|
||||
@ -356,6 +358,7 @@ void screen_device::device_start()
|
||||
save_item(NAME(m_visarea.max_y));
|
||||
save_item(NAME(m_last_partial_scan));
|
||||
save_item(NAME(m_frame_period));
|
||||
save_item(NAME(m_brightness));
|
||||
save_item(NAME(m_scantime));
|
||||
save_item(NAME(m_pixeltime));
|
||||
save_item(NAME(m_vblank_period));
|
||||
@ -365,6 +368,17 @@ void screen_device::device_start()
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void screen_device::device_reset()
|
||||
{
|
||||
// reset brightness to default
|
||||
m_brightness = 0xff;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_stop - clean up before the machine goes
|
||||
// away
|
||||
@ -884,9 +898,12 @@ bool screen_device::update_quads()
|
||||
m_curbitmap = 1 - m_curbitmap;
|
||||
}
|
||||
|
||||
// brightness adjusted render color
|
||||
rgb_t color = m_color - rgb_t(0, 0xff - m_brightness, 0xff - m_brightness, 0xff - m_brightness);
|
||||
|
||||
// create an empty container with a single quad
|
||||
m_container->empty();
|
||||
m_container->add_quad(0.0f, 0.0f, 1.0f, 1.0f, rgb_t(0xff,0xff,0xff,0xff), m_texture[m_curtexture], PRIMFLAG_BLENDMODE(BLENDMODE_NONE) | PRIMFLAG_SCREENTEX(1));
|
||||
m_container->add_quad(0.0f, 0.0f, 1.0f, 1.0f, color, m_texture[m_curtexture], PRIMFLAG_BLENDMODE(BLENDMODE_NONE) | PRIMFLAG_SCREENTEX(1));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,10 +186,12 @@ public:
|
||||
render_container &container() const { assert(m_container != NULL); return *m_container; }
|
||||
bitmap_ind8 &priority() { return m_priority; }
|
||||
palette_device *palette() { return m_palette; }
|
||||
|
||||
// dynamic configuration
|
||||
void configure(int width, int height, const rectangle &visarea, attoseconds_t frame_period);
|
||||
void reset_origin(int beamy = 0, int beamx = 0);
|
||||
void set_visible_area(int min_x, int max_x, int min_y, int max_y);
|
||||
void set_brightness(UINT8 brightness) { m_brightness = brightness; }
|
||||
|
||||
// beam positioning and state
|
||||
int vpos() const;
|
||||
@ -239,6 +241,7 @@ private:
|
||||
// device-level overrides
|
||||
virtual void device_validity_check(validity_checker &valid) const;
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
virtual void device_stop();
|
||||
virtual void device_post_load();
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||
@ -284,6 +287,8 @@ private:
|
||||
INT32 m_last_partial_scan; // scanline of last partial update
|
||||
bitmap_argb32 m_screen_overlay_bitmap; // screen overlay bitmap
|
||||
UINT32 m_unique_id; // unique id for this screen_device
|
||||
rgb_t m_color; // render color
|
||||
UINT8 m_brightness; // global brightness
|
||||
|
||||
// screen timing
|
||||
attoseconds_t m_frame_period; // attoseconds per frame
|
||||
|
Loading…
Reference in New Issue
Block a user