本文整理汇总了C++中ContextPtr::open方法的典型用法代码示例。如果您正苦于以下问题:C++ ContextPtr::open方法的具体用法?C++ ContextPtr::open怎么用?C++ ContextPtr::open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContextPtr
的用法示例。
在下文中一共展示了ContextPtr::open方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: console_open_layer
int console_open_layer(ContextPtr env, char *cmd) {
struct stat filestatus;
func("open_layer(%s)", cmd);
// check that is a good file
if(strncasecmp(cmd, "/dev/video", 10) != 0) {
if(stat(cmd, &filestatus) < 0) {
error("invalid file %s: %s", cmd, strerror(errno));
return 0;
} else { // is it a directory?
if(S_ISDIR(filestatus.st_mode)) {
error("can't open a directory as a layer", cmd);
return 0;
}
}
}
// ok the path in cmd should be good here
LayerPtr l = env->open(cmd);
if(l) {
/*
if(!l->init(env)) {
error("can't initialize layer");
delete l;
} else {
*/
// l->set_fps(env->fps_speed);
// l->fps=env->fps_speed;
ViewPortPtr screen = getSelectedScreen();
if(!screen) {
::error("no screen currently selected");
return 0;
}
screen->add_layer(l);
int len = screen->getLayers().size();
notice("layer successfully created, now you have %i layers", len);
return len;
}
error("layer creation aborted");
return 0;
}
示例2: main
int main(int argc, char **argv) {
LayerPtr lay;
ConsoleControllerPtr con;
#ifdef WITH_JAVASCRIPT
bool interactive = true;
#endif //WITH_JAVASCRIPT
freej = MakeShared<Context>();
notice("%s version %s free the veejay", PACKAGE, VERSION);
act("2001-2009 RASTASOFT :: %s", PACKAGE_URL);
act("----------------------------------------------");
cmdline(argc, argv);
set_debug(debug_level);
// create SDL screen by default at selected size
screen = Factory<ViewPort>::get_instance("Screen", screen_name);
// screen = new SdlScreen();
if(!screen) {
error("no screen can be opened");
exit(1);
}
screen->init(width, height, 32);
setSelectedScreen(screen);
// add the screen to the context
freej->add_screen(screen);
if(fullscreen) screen->fullscreen();
/* sets realtime priority to maximum allowed for SCHED_RR (POSIX.1b)
this hangs on some linux kernels - darwin doesn't even bothers with it
anybody knows what's wrong when you turn it on? ouch! it hurts :|
set_rtpriority is inside jutils.cpp
if(set_rtpriority(true))
notice("running as root: high priority realtime scheduling allowed.");
*/
/* initialize the S-Lang text Console */
if(!noconsole) {
if(getenv("TERM")) {
con = MakeShared<SlwConsole>(freej);
freej->register_controller(con);
GlobalLogger::register_logger(con);
con->console_init();
}
}
#ifdef WITH_JAVASCRIPT
// load default settings
config_check("keyboard.js");
/* execute javascript */
if(javascript[0]) {
interactive = false;
open_script(javascript); // TODO: quit here when script failed??
if(freej->isQuitting()) {
// freej.close();
// here calling close directly we double the destructor
// fixed omitting the explicit close() call
// but would be better to make the destructor reentrant
exit(1);
} else {
interactive = true;
}
}
/* execute processing */
if(processing[0]) {
interactive = false;
char tmp[1024];
// parse includes our extra processing.js library
snprintf(tmp, 1023, "include(\"processing.js\");script = read_file(\"%s\");Processing(script);", processing);
freej->js->parse(tmp);
if(freej->isQuitting()) {
exit(1);
} else {
interactive = true;
}
}
#endif //WITH_JAVASCRIPT
// Set fps
freej->setFps(fps);
// TODO freej->setStartRunning(startstate);
/* create layers requested on commandline */
{
char *l, *p, *pp = layer_files;
while(cli_chars > 0) {
p = pp;
while(*p != '#' && cli_chars > 0) {
//.........这里部分代码省略.........