diff options
author | Nathan Woods <npwoods@mess.org> | 2016-07-11 17:43:04 -0400 |
---|---|---|
committer | Nathan Woods <npwoods@mess.org> | 2016-07-11 17:43:04 -0400 |
commit | e0a721a062427fce4d7615712f9b4181298a3b8f (patch) | |
tree | 6dbecb11ee60727fc65b03213363f3810927b261 /src/frontend/mame/ui/menu.cpp | |
parent | ecf1c152c107a834a8b031c683ac3ba7dae7e910 (diff) |
Moved background bitmap/texture back into menu.cpp
Diffstat (limited to 'src/frontend/mame/ui/menu.cpp')
-rw-r--r-- | src/frontend/mame/ui/menu.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/frontend/mame/ui/menu.cpp b/src/frontend/mame/ui/menu.cpp index f3a95d81dca..78e0dd17285 100644 --- a/src/frontend/mame/ui/menu.cpp +++ b/src/frontend/mame/ui/menu.cpp @@ -82,12 +82,32 @@ bool menu::exclusive_input_pressed(int &iptkey, int key, int repeat) ***************************************************************************/ menu::global_state::global_state(running_machine &machine, ui_options const &options) - : widgets_manager(machine, options) + : widgets_manager(machine) , m_machine(machine) , m_cleanup_callbacks() + , m_bgrnd_bitmap() , m_stack() , m_free() { + render_manager &render(machine.render()); + auto const texture_free([&render](render_texture *texture) { render.texture_free(texture); }); + + // create a texture for main menu background + m_bgrnd_texture = texture_ptr(render.texture_alloc(render_texture::hq_scale), texture_free); + if (options.use_background_image() && (&machine.system() == &GAME_NAME(___empty))) + { + m_bgrnd_bitmap = std::make_unique<bitmap_argb32>(0, 0); + emu_file backgroundfile(".", OPEN_FLAG_READ); + render_load_jpeg(*m_bgrnd_bitmap, backgroundfile, nullptr, "background.jpg"); + + if (!m_bgrnd_bitmap->valid()) + render_load_png(*m_bgrnd_bitmap, backgroundfile, nullptr, "background.png"); + + if (m_bgrnd_bitmap->valid()) + m_bgrnd_texture->set_bitmap(*m_bgrnd_bitmap, m_bgrnd_bitmap->cliprect(), TEXFORMAT_ARGB32); + else + m_bgrnd_bitmap->reset(); + } } |