本文整理汇总了C++中Global::setWindow方法的典型用法代码示例。如果您正苦于以下问题:C++ Global::setWindow方法的具体用法?C++ Global::setWindow怎么用?C++ Global::setWindow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Global
的用法示例。
在下文中一共展示了Global::setWindow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create_sk_window
SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv) {
printf("Started\n");
SkCommandLineFlags::Parse(argc, argv);
// Get the default Isolate created at startup.
Isolate* isolate = Isolate::GetCurrent();
Global* global = new Global(isolate);
// Set up things to look like a browser by creating
// a console object that invokes our print function.
const char* startupScript =
"function Console() {}; \n"
"Console.prototype.log = function() { \n"
" var args = Array.prototype.slice.call(arguments).join(' '); \n"
" print(args); \n"
"}; \n"
"console = new Console(); \n";
if (!global->parseScript(startupScript)) {
printf("Failed to parse startup script: %s.\n", FLAGS_infile[0]);
exit(1);
}
const char* script =
"function onDraw(canvas) { \n"
" canvas.fillStyle = '#00FF00'; \n"
" canvas.fillRect(20, 20, 100, 100); \n"
" canvas.inval(); \n"
"} \n";
SkAutoTUnref<SkData> data;
if (FLAGS_infile.count()) {
data.reset(SkData::NewFromFileName(FLAGS_infile[0]));
script = static_cast<const char*>(data->data());
}
if (NULL == script) {
printf("Could not load file: %s.\n", FLAGS_infile[0]);
exit(1);
}
Path2D::AddToGlobal(global);
if (!global->parseScript(script)) {
printf("Failed to parse file: %s.\n", FLAGS_infile[0]);
exit(1);
}
JsContext* jsContext = new JsContext(global);
if (!jsContext->initialize()) {
printf("Failed to initialize.\n");
exit(1);
}
SkV8ExampleWindow* win = new SkV8ExampleWindow(hwnd, jsContext);
global->setWindow(win);
return win;
}