mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
More reader support, nw
This commit is contained in:
parent
c68d4538a7
commit
664a0aee90
@ -4,12 +4,13 @@
|
||||
#include "emu.h"
|
||||
|
||||
#include "chain.h"
|
||||
#include "chainreader.h"
|
||||
#include "sliderreader.h"
|
||||
#include "paramreader.h"
|
||||
#include "chainentryreader.h"
|
||||
#include "targetmanager.h"
|
||||
#include "chainreader.h"
|
||||
|
||||
bgfx_chain* chain_reader::read_from_value(const Value& value, texture_manager& textures, target_manager& targets, effect_manager& effects)
|
||||
bgfx_chain* chain_reader::read_from_value(const Value& value, texture_manager& textures, target_manager& targets, effect_manager& effects, uint32_t screen_width, uint32_t screen_height)
|
||||
{
|
||||
validate_parameters(value);
|
||||
|
||||
@ -46,6 +47,33 @@ bgfx_chain* chain_reader::read_from_value(const Value& value, texture_manager& t
|
||||
}
|
||||
}
|
||||
|
||||
if (value.HasMember("targets"))
|
||||
{
|
||||
const Value& target_array = value["targets"];
|
||||
for (UINT32 i = 0; i < target_array.Size(); i++)
|
||||
{
|
||||
assert(target_array[i].HasMember("name"));
|
||||
assert(target_array[i]["name"].IsString());
|
||||
uint32_t width = 0;
|
||||
uint32_t height = 0;
|
||||
if (target_array[i].HasMember("screen") && target_array[i]["screen"].IsBool())
|
||||
{
|
||||
width = screen_width;
|
||||
height = screen_height;
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(target_array[i].HasMember("width"));
|
||||
assert(target_array[i]["width"].IsDouble());
|
||||
assert(target_array[i].HasMember("height"));
|
||||
assert(target_array[i]["height"].IsDouble());
|
||||
width = uint32_t(target_array[i]["width"].GetDouble());
|
||||
height = uint32_t(target_array[i]["height"].GetDouble());
|
||||
}
|
||||
targets.create_target(target_array[i]["name"].GetString(), bgfx::TextureFormat::RGBA8, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
return new bgfx_chain(name, author, sliders, parameters, entries);
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ class effect_manager;
|
||||
class chain_reader : public state_reader
|
||||
{
|
||||
public:
|
||||
static bgfx_chain* read_from_value(const Value& value, texture_manager& textures, target_manager& targets, effect_manager& effects);
|
||||
static bgfx_chain* read_from_value(const Value& value, texture_manager& textures, target_manager& targets, effect_manager& effects, uint32_t screen_width, uint32_t screen_height);
|
||||
|
||||
private:
|
||||
static void validate_parameters(const Value& value);
|
||||
|
@ -94,6 +94,8 @@ int renderer_bgfx::create()
|
||||
// create renderer
|
||||
|
||||
osd_dim wdim = window().get_size();
|
||||
m_width = wdim.width();
|
||||
m_height = wdim.height();
|
||||
if (window().m_index == 0)
|
||||
{
|
||||
#ifdef OSD_WINDOWS
|
||||
@ -102,17 +104,17 @@ int renderer_bgfx::create()
|
||||
bgfx::sdlSetWindow(window().sdl_window());
|
||||
#endif
|
||||
bgfx::init();
|
||||
bgfx::reset(wdim.width(), wdim.height(), video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE);
|
||||
bgfx::reset(m_width, m_height, video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE);
|
||||
// Enable debug text.
|
||||
bgfx::setDebug(BGFX_DEBUG_TEXT); //BGFX_DEBUG_STATS
|
||||
m_dimensions = osd_dim(wdim.width(), wdim.height());
|
||||
m_dimensions = osd_dim(m_width, m_height);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef OSD_WINDOWS
|
||||
m_framebuffer = bgfx::createFrameBuffer(window().m_hwnd, wdim.width(), wdim.height());
|
||||
m_framebuffer = bgfx::createFrameBuffer(window().m_hwnd, m_width, m_height);
|
||||
#else
|
||||
m_framebuffer = bgfx::createFrameBuffer(sdlNativeWindowHandle(window().sdl_window()), wdim.width(), wdim.height());
|
||||
m_framebuffer = bgfx::createFrameBuffer(sdlNativeWindowHandle(window().sdl_window()), m_width, m_height);
|
||||
#endif
|
||||
bgfx::touch(window().m_index);
|
||||
}
|
||||
|
@ -109,6 +109,8 @@ private:
|
||||
std::vector<rectangle_packer::packable_rectangle> m_texinfo;
|
||||
rectangle_packer m_packer;
|
||||
|
||||
uint32_t m_width;
|
||||
uint32_t m_height;
|
||||
uint32_t m_white[16*16];
|
||||
enum : uint16_t { CACHE_SIZE = 1024 };
|
||||
enum : uint32_t { PACKABLE_SIZE = 128 };
|
||||
|
Loading…
Reference in New Issue
Block a user