static void Main(string[] args) { SteamVR_WebKit.SteamVR_WebKit.UseExperimentalOGL = true; SteamVR_WebKit.SteamVR_WebKit.DefaultFragmentShaderPath = Environment.CurrentDirectory + "\\Resources\\fragShader.frag"; CefSharp.CefSharpSettings.FocusedNodeChangedEnabled = true; SteamVR_WebKit.SteamVR_WebKit.Init(new CefSettings() { WindowlessRenderingEnabled = true, }); SteamVR_WebKit.SteamVR_WebKit.FPS = 30; SteamVR_WebKit.SteamVR_WebKit.LogEvent += SteamVR_WebKit_LogEvent; //Notifications.RegisterIcon("default", new Bitmap(Environment.CurrentDirectory + "\\Resources\\alert.png")); basicOverlay = new WebKitOverlay(new Uri("https://whyyouare.web.app"), 1280, 800, "webkitTest", "WebKit", OverlayType.Dashboard); basicOverlay.DashboardOverlay.Width = 3.0f; basicOverlay.DashboardOverlay.SetThumbnail("Resources/webkit-logo.png"); basicOverlay.BrowserPreInit += Overlay_BrowserPreInit; basicOverlay.BrowserReady += Overlay_BrowserReady; basicOverlay.StartBrowser(); basicOverlay.EnableKeyboard = true; basicOverlay.MessageHandler.DebugMode = true; basicOverlay.MouseDeltaTolerance = 20; //basicOverlay.AlphaMask = new Bitmap(Environment.CurrentDirectory + "\\Resources\\alphamap.png"); SteamVR_WebKit.SteamVR_WebKit.TraceLevel = true; videoOverlay = new WebKitOverlay(new Uri("https://www.youtube.com/embed/d7Co9PyueSk"), 1920, 1080, "videoTest", "Video", OverlayType.Both); videoOverlay.InGameOverlay.SetAttachment(AttachmentType.Overlay, new Vector3(2.5f, 0.6f, 1.5f), new Vector3(0, 45f, -35f), "system.vrdashboard"); videoOverlay.EnableNonDashboardInput = true; videoOverlay.InGameOverlay.Width = 3f; videoOverlay.BrowserPreInit += VideoOverlay_BrowserPreInit; videoOverlay.BrowserReady += VideoOverlay_BrowserReady; videoOverlay.DashboardOverlay.Width = 3.0f; videoOverlay.StartBrowser(); //videoOverlay.AlphaMask = new Bitmap(Environment.CurrentDirectory + "\\Resources\\alphamap.png"); videoOverlay.UpdateEveryFrame = true; /*applicationsOverlay = new WebKitOverlay(new Uri("file://" + Environment.CurrentDirectory + "/Resources/applications.html"), 1024, 1024, "webkitTestApps", "WebKit-Apps", OverlayType.Dashboard); * applicationsOverlay.DashboardOverlay.Width = 2.0f; * applicationsOverlay.DashboardOverlay.SetThumbnail("Resources/webkit-logo.png"); * applicationsOverlay.BrowserPreInit += ApplicationsOverlay_BrowserPreInit; * applicationsOverlay.BrowserReady += ApplicationsOverlay_BrowserReady; * applicationsOverlay.StartBrowser();*/ controllerOverlay = new WebKitOverlay(new Uri("https://www.youtube.com/embed/XOn5ckvIF3U?autoplay=1&start=27"), 550, 250, "controllerTest", "controllerVideo", OverlayType.InGame); controllerOverlay.InGameOverlay.SetDeviceAttachment(AttachmentType.RightController, new Vector3(0.0f, 0.0f, -0.1f), new Vector3(0.0f, 0.0f, 1.35f)); controllerOverlay.InGameOverlay.Width = .25f; controllerOverlay.BrowserPreInit += ControllerOverlay_BrowserPreInit; controllerOverlay.BrowserReady += ControllerOverlay_BrowserReady; controllerOverlay.StartBrowser(true); //SteamVR_Application application = new SteamVR_Application(); //application.InstallManifest(true); //application.SetAutoStartEnabled(false); //application.RemoveManifest(); SteamVR_WebKit.SteamVR_WebKit.RunOverlays(); // Runs update/draw calls for all active overlays. And yes, it's blocking. }
static void Main(string[] args) { SteamVR_WebKit.SteamVR_WebKit.Init(); SteamVR_WebKit.SteamVR_WebKit.FPS = 30; //Notifications.RegisterIcon("default", new Bitmap(Environment.CurrentDirectory + "\\Resources\\alert.png")); basicOverlay = new WebKitOverlay(new Uri("file://" + Environment.CurrentDirectory + "/Resources/index.html"), 1024, 1024, "webkitTest", "WebKit-Core", OverlayType.Dashboard); //overlay = new WebKitOverlay(new Uri("https://codepen.io/AtomicNoggin/full/yqwsG/"), 1024, 1024, "webkitTest", "WebKit", OverlayType.Dashboard); basicOverlay.DashboardOverlay.Width = 2.0f; basicOverlay.DashboardOverlay.SetThumbnail("Resources/webkit-logo.png"); basicOverlay.BrowserPreInit += Overlay_BrowserPreInit; basicOverlay.BrowserReady += Overlay_BrowserReady; basicOverlay.StartBrowser(); //videoOverlay = new WebKitOverlay(new Uri("https://www.youtube.com/embed/d7Co9PyueSk"), 1920, 1080, "videoTest", "Video", OverlayType.Both); //videoOverlay.InGameOverlay.SetDeviceAttachment(AttachmentType.Absolute, new Vector3(0f, 1.0f, -1f), Quaternion.FromEulerAngles(0f, 45f, 0f)); //videoOverlay.InGameOverlay.Width = 0.5f; //videoOverlay.BrowserPreInit += VideoOverlay_BrowserPreInit; //videoOverlay.BrowserReady += VideoOverlay_BrowserReady; //videoOverlay.DashboardOverlay.Width = 2.0f; //videoOverlay.StartBrowser(); //applicationsOverlay = new WebKitOverlay(new Uri("file://" + Environment.CurrentDirectory + "/Resources/applications.html"), 1024, 1024, "webkitTestApps", "WebKit-Apps", OverlayType.Dashboard); //applicationsOverlay.DashboardOverlay.Width = 2.0f; //applicationsOverlay.DashboardOverlay.SetThumbnail("Resources/webkit-logo.png"); //applicationsOverlay.BrowserPreInit += ApplicationsOverlay_BrowserPreInit; //applicationsOverlay.BrowserReady += ApplicationsOverlay_BrowserReady; //applicationsOverlay.StartBrowser(); //controllerOverlay = new WebKitOverlay(new Uri("https://www.youtube.com/embed/XOn5ckvIF3U?autoplay=1&start=27"), 550, 250, "controllerTest", "controllerVideo", OverlayType.InGame); //controllerOverlay.InGameOverlay.SetDeviceAttachment(AttachmentType.RightController, new Vector3(0.0f, 0.0f, -0.1f), Quaternion.FromEulerAngles(0.0f, 0.0f, 1.35f)); //controllerOverlay.InGameOverlay.Width = .25f; //controllerOverlay.BrowserPreInit += ControllerOverlay_BrowserPreInit; //controllerOverlay.BrowserReady += ControllerOverlay_BrowserReady; //controllerOverlay.StartBrowser(true); SteamVR_Application application = new SteamVR_Application(); application.InstallManifest(true); //application.SetAutoStartEnabled(false); application.RemoveManifest(); SteamVR_WebKit.SteamVR_WebKit.RunOverlays(); // Runs update/draw calls for all active overlays. And yes, it's blocking. }
static void Main(string[] args) { SteamVR_WebKit.SteamVR_WebKit.Init(new CefSharp.CefSettings() { PersistSessionCookies = true, CachePath = "chrome-cache" }); SteamVR_WebKit.SteamVR_WebKit.FPS = 30; script = File.ReadAllText("Resources/Script.js"); current_artist = ""; current_song = ""; //SteamVR_WebKit.JsInterop.Notifications.RegisterIcon("default", new Bitmap(Environment.CurrentDirectory + "\\Resources\\spotify-logo-small.png")); -- leads to exception overlay = new WebKitOverlay(new Uri("https://open.spotify.com"), 1024, 1024, "spotify", "Spotify", OverlayType.Dashboard); overlay.CachePath = "chrome-cache"; overlay.DashboardOverlay.Width = 2.0f; overlay.DashboardOverlay.SetThumbnail("Resources/spotify-logo-small.png"); overlay.BrowserPreInit += Overlay_BrowserPreInit; if (args.Length > 0 && args[0] == "--debug") { overlay.BrowserReady += Overlay_BrowserReady; } overlay.StartBrowser(); EventHandler <CefSharp.LoadingStateChangedEventArgs> handler = PageReady; overlay.Browser.LoadingStateChanged += handler; SteamVR_Application application = new SteamVR_Application(); application.InstallManifest(true); if (args.Length > 0 && args[0] == "--debug") { application.RemoveManifest(); } SteamVR_WebKit.SteamVR_WebKit.RunOverlays(); // Runs update/draw calls for all active overlays. And yes, it's blocking. }
public void Setup(string path, string keyPrefix = "builtin") { BasePath = path; ParseManifest(path); if (!ShowAsDashboard && !ShowAsFloating) { Logger.Fatal("[OVERLAY] Overlay must have show_as_dashboard and/or show_as_floating set to true, both as false is not permitted."); return; } if (!Environment.GetCommandLineArgs().Contains("-debug")) { DebugMode = false; } _wkOverlay = new WebKitOverlay(new Uri(EntryPoint), Width, Height, "vrub." + DerivedKey, Name, ShowAsDashboard ? (ShowAsFloating ? OverlayType.Both : OverlayType.Dashboard) : OverlayType.InGame); _wkOverlay.BrowserReady += _wkOverlay_BrowserReady; _wkOverlay.BrowserPreInit += _wkOverlay_BrowserPreInit; _wkOverlay.CachePath = Path.Combine(GetLocalStoragePath(), "Cache"); _wkOverlay.RequestContextHandler = new OverlayRequestContextHandler(this); _wkOverlay.MouseDeltaTolerance = MouseDeltaTolerance; _wkOverlay.MessageHandler.DebugMode = DebugMode; _wkOverlay.FragmentShaderPath = FragmentShader; if (AlphaMask != null) { SetAlphaMask(AlphaMask); } _wkOverlay.AllowScrolling = !DisableScrolling; _wkOverlay.UpdateInputSettings(); Attach(); SetupRenderModels(); if (Thumbnail != null && _wkOverlay.DashboardOverlay != null) { string thumbPath = Path.IsPathRooted(Thumbnail) ? Thumbnail : Path.Combine(path, Thumbnail); if (File.Exists(thumbPath)) { _wkOverlay.DashboardOverlay.SetThumbnail(thumbPath); } else { Logger.Warning("[OVERLAY] Failed to locate thumbnail for " + DerivedKey + ": " + thumbPath); } } SetOpacity(Opacity); if (ShowAsFloating) { _wkOverlay.EnableNonDashboardInput = EnableMouseInput; } _wkOverlay.SchemeHandlers.Add(new CefCustomScheme() { SchemeName = "addon", SchemeHandlerFactory = new RestrictedPathSchemeHandler("addon", _addon.BasePath), }); _wkOverlay.SchemeHandlers.Add(new CefCustomScheme() { SchemeName = "vrub", SchemeHandlerFactory = new RestrictedPathSchemeHandler("vrub", PathUtilities.Constants.GlobalStaticResourcesPath), }); _wkOverlay.SchemeHandlers.Add(new CefCustomScheme() { SchemeName = "plugin", SchemeHandlerFactory = new PluginSchemeHandler(), }); _wkOverlay.EnableKeyboard = EnableKeyboard; UpdateWidths(); }