Skip to content

Running chromium embedded framework(cef) browser in paracraft

Notifications You must be signed in to change notification settings

tatfook/NplBrowser

Repository files navigation

NplBrowser

Running chromium embedded framework(cef) browser in paracraft

编译64位版本

将cef_win64/Release/libcef.zip解压到当前目录成cef_win64/Release/libcef.dll (文件太大, git不支持)

Building with vs2017

  1. clone NplBrowser and its submodule
git clone --recursive https://github.com/tatfook/NplBrowser.git
  1. run cmd
.\build.bat
  1. check binaries at: deps/NPLRuntime/ParaWorld/bin32/cef3
  • build nplruntime [optional]
    • build boost 1.68.0, set environment: BOOST_ROOT
# debug
.\b2.exe address-model=32 toolset=msvc-14.1 runtime-link=static threading=multi variant=debug --with-thread --with-date_time --with-filesystem --with-system --with-chrono --with-signals --with-serialization --with-iostreams --with-regex stage
# release
.\b2.exe address-model=32 toolset=msvc-14.1 runtime-link=static threading=multi variant=release --with-thread --with-date_time --with-filesystem --with-system --with-chrono --with-signals --with-serialization --with-iostreams --with-regex stage
- build nplruntime

Deps

Running cefclient.exe directly with command lines

cefclient.exe  -window_title="NplBrowser" -window_name="nplbrowser_wnd" -bounds="0,0,800,600" -url="https://keepwork.com"

Running in npl

---------------------------------------------------------------------------
NPL.load("(gl)script/apps/Aries/Creator/Game/NplBrowser/NplBrowserPlugin.lua");
local NplBrowserPlugin = commonlib.gettable("NplBrowser.NplBrowserPlugin");
local id = "nplbrowser_wnd";
NplBrowserPlugin.Start({id = id, url = "http://www.keepwork.com", withControl = true, x = 200, y = 200, width = 800, height = 600, });
NplBrowserPlugin.OnCreatedCallback(id,function()
    NplBrowserPlugin.Open({id = id, url = "http://www.keepwork.com", resize = true, x = 100, y = 100, width = 300, height = 300, });
    NplBrowserPlugin.Show({id = id, visible = false});
    NplBrowserPlugin.Show({id = id, visible = true});
    NplBrowserPlugin.Zoom({id = id, zoom = 1}); --200%
    NplBrowserPlugin.EnableWindow({id = id, enabled = false});
    NplBrowserPlugin.ChangePosSize({id = id, x = 100, y = 100, width = 800, height = 400, });
    NplBrowserPlugin.Quit({id = id,});
end)
---------------------------------------------------------------------------
  • NplBrowserPage is more easier for creating cef browser window in npl
NPL.load("(gl)script/apps/Aries/Creator/Game/NplBrowser/NplBrowserPage.lua");
local NplBrowserPage = commonlib.gettable("NplBrowser.NplBrowserPage");
NplBrowserPage.Open();

Links

image