Browse Source

WebView rendering on Windows

JoshEngebretson 10 years ago
parent
commit
bc4fec6de9

+ 27 - 0
Source/AtomicEditor/Application/Main.cpp

@@ -5,6 +5,13 @@
 // license information: https://github.com/AtomicGameEngine/AtomicGameEngine
 //
 
+#ifdef ATOMIC_PLATFORM_WINDOWS
+#ifdef ATOMIC_WEBVIEW
+#include <include/cef_app.h>
+#include <include/cef_client.h>
+#endif
+#endif
+
 #if defined(WIN32) && !defined(ATOMIC_WIN32_CONSOLE)
 #include <Atomic/Core/MiniDump.h>
 #include <windows.h>
@@ -106,6 +113,26 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, PSTR cmdLine, in
 #else
 int main(int argc, char** argv)
 {
+
+#ifdef ATOMIC_PLATFORM_WINDOWS
+#ifdef ATOMIC_WEBVIEW
+
+      // Provide CEF with command-line arguments.
+      CefMainArgs main_args;
+
+      // CEF applications have multiple sub-processes (render, plugin, GPU, etc)
+      // that share the same executable. This function checks the command-line and,
+      // if this is a sub-process, executes the appropriate logic.
+      int exit_code = CefExecuteProcess(main_args, nullptr, nullptr);
+
+      if (exit_code >= 0) {
+        // The sub-process has completed so return here.
+        return exit_code;
+      }
+
+#endif
+#endif
+
     Atomic::ParseArguments(argc, argv);
 
     const Vector<String>& arguments = GetArguments();

+ 1 - 0
Source/AtomicWebView/WebBrowserHost.cpp

@@ -48,6 +48,7 @@ private:
 
 WebBrowserHost::WebBrowserHost(Context* context) : Object (context)
 {
+
     const Vector<String>& arguments = GetArguments();
 
 #ifdef ATOMIC_PLATFORM_OSX

+ 1 - 1
Source/AtomicWebView/WebTexture2D.cpp

@@ -187,7 +187,7 @@ public:
     void OnPaint(CefRefPtr<CefBrowser> browser, PaintElementType type, const RectList &dirtyRects,
                  const void *buffer, int width, int height) OVERRIDE
     {
-
+        webTexture2D_->GetTexture2D()->SetData(0, 0, 0, width, height, buffer);
     }
 
 #endif