mirror of
https://github.com/holub/mame
synced 2025-06-25 22:04:15 +03:00
simplify code (nw)
This commit is contained in:
parent
61bada0d91
commit
244e00775a
@ -180,42 +180,34 @@ static void* sdlNativeWindowHandle(SDL_Window* _window)
|
|||||||
return wmi.info.win.window;
|
return wmi.info.win.window;
|
||||||
# endif // BX_PLATFORM_
|
# endif // BX_PLATFORM_
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int renderer_bgfx::create()
|
int renderer_bgfx::create()
|
||||||
{
|
{
|
||||||
// create renderer
|
// create renderer
|
||||||
|
|
||||||
#ifdef OSD_WINDOWS
|
|
||||||
RECT client;
|
|
||||||
GetClientRect(window().m_hwnd, &client);
|
|
||||||
if (window().m_index == 0)
|
|
||||||
{
|
|
||||||
bgfx::winSetHwnd(window().m_hwnd);
|
|
||||||
bgfx::init();
|
|
||||||
bgfx::reset(rect_width(&client), rect_height(&client), video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE);
|
|
||||||
// Enable debug text.
|
|
||||||
bgfx::setDebug(BGFX_DEBUG_TEXT); //BGFX_DEBUG_STATS
|
|
||||||
m_dimensions = osd_dim(rect_width(&client), rect_height(&client));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fbh = bgfx::createFrameBuffer(window().m_hwnd, rect_width(&client), rect_height(&client));
|
|
||||||
bgfx::touch(window().m_index);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
osd_dim wdim = window().get_size();
|
osd_dim wdim = window().get_size();
|
||||||
if (window().m_index == 0)
|
if (window().m_index == 0)
|
||||||
{
|
{
|
||||||
|
#ifdef OSD_WINDOWS
|
||||||
|
bgfx::winSetHwnd(window().m_hwnd);
|
||||||
|
#else
|
||||||
bgfx::sdlSetWindow(window().sdl_window());
|
bgfx::sdlSetWindow(window().sdl_window());
|
||||||
|
#endif
|
||||||
bgfx::init();
|
bgfx::init();
|
||||||
bgfx::reset(wdim.width(), wdim.height(), video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE);
|
bgfx::reset(wdim.width(), wdim.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(wdim.width(), wdim.height());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
#ifdef OSD_WINDOWS
|
||||||
|
fbh = bgfx::createFrameBuffer(window().m_hwnd, wdim.width(), wdim.height());
|
||||||
|
#else
|
||||||
fbh = bgfx::createFrameBuffer(sdlNativeWindowHandle(window().sdl_window()), wdim.width(), wdim.height());
|
fbh = bgfx::createFrameBuffer(sdlNativeWindowHandle(window().sdl_window()), wdim.width(), wdim.height());
|
||||||
|
#endif
|
||||||
bgfx::touch(window().m_index);
|
bgfx::touch(window().m_index);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
// Create program from shaders.
|
// Create program from shaders.
|
||||||
m_progQuad = loadProgram("vs_quad", "fs_quad");
|
m_progQuad = loadProgram("vs_quad", "fs_quad");
|
||||||
m_progQuadTexture = loadProgram("vs_quad_texture", "fs_quad_texture");
|
m_progQuadTexture = loadProgram("vs_quad_texture", "fs_quad_texture");
|
||||||
@ -780,18 +772,9 @@ int renderer_bgfx::draw(int update)
|
|||||||
initVertexDecls();
|
initVertexDecls();
|
||||||
int index = window().m_index;
|
int index = window().m_index;
|
||||||
// Set view 0 default viewport.
|
// Set view 0 default viewport.
|
||||||
int width, height;
|
|
||||||
#ifdef OSD_WINDOWS
|
|
||||||
RECT client;
|
|
||||||
GetClientRect(window().m_hwnd, &client);
|
|
||||||
width = rect_width(&client);
|
|
||||||
height = rect_height(&client);
|
|
||||||
|
|
||||||
#else
|
|
||||||
osd_dim wdim = window().get_size();
|
osd_dim wdim = window().get_size();
|
||||||
width = wdim.width();
|
int width = wdim.width();
|
||||||
height = wdim.height();
|
int height = wdim.height();
|
||||||
#endif
|
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
{
|
{
|
||||||
if ((m_dimensions != osd_dim(width, height))) {
|
if ((m_dimensions != osd_dim(width, height))) {
|
||||||
|
Loading…
Reference in New Issue
Block a user