mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-06 10:40:45 -08:00
added js api clogframe_quit()
This commit is contained in:
parent
9d82642b3c
commit
909e444b5f
2 changed files with 7 additions and 0 deletions
6
clogframe/clogframe.cpp
vendored
6
clogframe/clogframe.cpp
vendored
|
|
@ -2,10 +2,16 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "webview.h"
|
#include "webview.h"
|
||||||
|
|
||||||
int main(int argc,char* argv[]) {
|
int main(int argc,char* argv[]) {
|
||||||
webview::webview w(true, nullptr);
|
webview::webview w(true, nullptr);
|
||||||
|
webview::webview *w2 = &w;
|
||||||
w.set_title(argv[1]);
|
w.set_title(argv[1]);
|
||||||
w.set_size(std::stoi(argv[3]), std::stoi(argv[4]), WEBVIEW_HINT_NONE);
|
w.set_size(std::stoi(argv[3]), std::stoi(argv[4]), WEBVIEW_HINT_NONE);
|
||||||
|
w.bind("clogframe_quit", [w2](std::string s) -> std::string {
|
||||||
|
w2->terminate();
|
||||||
|
return "";
|
||||||
|
});
|
||||||
std::ostringstream o;
|
std::ostringstream o;
|
||||||
o << "http://127.0.0.1:" << argv[2];
|
o << "http://127.0.0.1:" << argv[2];
|
||||||
w.navigate(o.str());
|
w.navigate(o.str());
|
||||||
|
|
|
||||||
|
|
@ -180,6 +180,7 @@
|
||||||
;; When *app-mode* set only run the game once and then shutdown the app
|
;; When *app-mode* set only run the game once and then shutdown the app
|
||||||
(when *app-mode*
|
(when *app-mode*
|
||||||
(sleep 2) ;; let end music play
|
(sleep 2) ;; let end music play
|
||||||
|
(js-execute body "clogframe_quit()") ;; does nothing if not in clogframe
|
||||||
(clog:shutdown)
|
(clog:shutdown)
|
||||||
(uiop:quit)))
|
(uiop:quit)))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue