add a 'wrapper' file for wx

This commit is contained in:
jp9000
2013-11-22 20:57:24 -07:00
parent 27be0a515b
commit 7e89ebce46
8 changed files with 70 additions and 6 deletions

View File

@@ -30,6 +30,7 @@ link_libraries(${wxWidgets_LIBRARIES})
add_executable(obs
window-obs-basic.cpp
window-subclass.cpp
wx-wrappers.cpp
obs-app.cpp
OBSWindows.cpp)

View File

@@ -13,4 +13,5 @@ obs_PROGRAMS = obs
obs_SOURCES = window-obs-basic.cpp \
window-subclass.cpp \
obs-app.cpp \
wx-wrappers.cpp \
OBSWindows.cpp

View File

@@ -19,6 +19,7 @@
#include "obs-app.hpp"
#include "window-obs-basic.hpp"
#include "obs-wrappers.hpp"
#include "wx-wrappers.hpp"
IMPLEMENT_APP(OBSApp)
@@ -47,12 +48,7 @@ bool OBSApp::OnInit()
ovi.output_format = VIDEO_FORMAT_RGBA;
ovi.output_width = rc.width;
ovi.output_height = rc.height;
#ifdef __WXCOCOA__
ovi.window.view = preview->GetHandle();
#elif _WIN32
ovi.window.hwnd = preview->GetHandle();
#endif
ovi.window = WxToGSWindow(preview);
if (!obs_reset_video(&ovi))
return false;

View File

@@ -17,6 +17,8 @@
#pragma once
#include <obs.h>
class OBSSource {
obs_source_t source;

33
obs/wx-wrappers.cpp Normal file
View File

@@ -0,0 +1,33 @@
/******************************************************************************
Copyright (C) 2013 by Hugh Bailey <obs.jim@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#include <wx/window.h>
#include <obs.h>
#include "wx-wrappers.hpp"
gs_window WxToGSWindow(const wxWindow *wxwin)
{
gs_window window;
#ifdef __WXCOCOA__
window.view = wxwin->GetHandle();
#elif _WIN32
window.hwnd = wxwin->GetHandle();
#else
/* TODO: linux stuff */
#endif
return window;
}

23
obs/wx-wrappers.hpp Normal file
View File

@@ -0,0 +1,23 @@
/******************************************************************************
Copyright (C) 2013 by Hugh Bailey <obs.jim@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#pragma once
struct gs_window;
class wxWindow;
gs_window WxToGSWindow(const wxWindow *window);