diff options
Diffstat (limited to 'src/devices/bus/a2gameio/computereyes.cpp')
-rw-r--r-- | src/devices/bus/a2gameio/computereyes.cpp | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/src/devices/bus/a2gameio/computereyes.cpp b/src/devices/bus/a2gameio/computereyes.cpp index 3614a5f0d2d..1c587f54254 100644 --- a/src/devices/bus/a2gameio/computereyes.cpp +++ b/src/devices/bus/a2gameio/computereyes.cpp @@ -34,30 +34,17 @@ void apple2_compeyes_device::device_add_mconfig(machine_config &config) void apple2_compeyes_device::device_start() { + save_item(NAME(m_x)); + save_item(NAME(m_y)); + save_item(NAME(m_an1)); + save_item(NAME(m_an2)); + save_item(NAME(m_an3)); + save_item(NAME(m_level)); } void apple2_compeyes_device::device_reset() { m_x = m_y = m_an1 = m_an2 = m_an3 = m_level = 0; - m_bitmap = &m_picture->get_bitmap(); - - // convert arbitrary sized ARGB32 image to a 280x192 image with 256 levels of grayscale - double stepx = (double)m_bitmap->width() / 280.0; - double stepy = (double)m_bitmap->height() / 192.0; - - std::fill_n(m_a2_bitmap, 280*192, 0); - - for (int y = 0; y < 192; y++) - { - for (int x = 0; x < 280; x++) - { - u32 pixel = m_bitmap->pix((int)((double)y * stepy), (int)((double)x * stepx)); - double mono = ((0.2126 * (double)(((pixel>>16) & 0xff) / 255.0)) + - (0.7152 * (double)(((pixel>>8) & 0xff) / 255.0)) + - (0.0722 * (double)((pixel& 0xff) / 255.0))); - m_a2_bitmap[(y*280)+x] = (u8)(mono * 255.0); - } - } } READ_LINE_MEMBER(apple2_compeyes_device::sw0_r) @@ -92,6 +79,29 @@ READ_LINE_MEMBER(apple2_compeyes_device::sw1_r) WRITE_LINE_MEMBER(apple2_compeyes_device::an0_w) { m_x = m_y = 0; + + std::fill_n(m_a2_bitmap, 280*192, 0); + + m_bitmap = &m_picture->get_bitmap(); + if (m_bitmap) + { + // convert arbitrary sized ARGB32 image to a 280x192 image with 256 levels of grayscale + double stepx = (double)m_bitmap->width() / 280.0; + double stepy = (double)m_bitmap->height() / 192.0; + + + for (int y = 0; y < 192; y++) + { + for (int x = 0; x < 280; x++) + { + u32 pixel = m_bitmap->pix((int)((double)y * stepy), (int)((double)x * stepx)); + double mono = ((0.2126 * (double)(((pixel>>16) & 0xff) / 255.0)) + + (0.7152 * (double)(((pixel>>8) & 0xff) / 255.0)) + + (0.0722 * (double)((pixel& 0xff) / 255.0))); + m_a2_bitmap[(y*280)+x] = (u8)(mono * 255.0); + } + } + } } WRITE_LINE_MEMBER(apple2_compeyes_device::an1_w) |