这篇教程C++ CommonInit函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CommonInit函数的典型用法代码示例。如果您正苦于以下问题:C++ CommonInit函数的具体用法?C++ CommonInit怎么用?C++ CommonInit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CommonInit函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: mainintmain(int argc, char *argv[]){ int fsaa, accel; int value; int i, done; SDL_DisplayMode mode; SDL_Event event; Uint32 then, now, frames; int status; /* Initialize parameters */ fsaa = 0; accel = 0; /* Initialize test framework */ state = CommonCreateState(argv, SDL_INIT_VIDEO); if (!state) { return 1; } for (i = 1; i < argc;) { int consumed; consumed = CommonArg(state, i); if (consumed == 0) { if (SDL_strcasecmp(argv[i], "--fsaa") == 0) { ++fsaa; consumed = 1; } else if (SDL_strcasecmp(argv[i], "--accel") == 0) { ++accel; consumed = 1; } else { consumed = -1; } } if (consumed < 0) { fprintf(stderr, "Usage: %s %s [--fsaa] [--accel]/n", argv[0], CommonUsage(state)); quit(1); } i += consumed; } /* Set OpenGL parameters */ state->window_flags |= SDL_WINDOW_OPENGL; SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); if (fsaa) { SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, fsaa); } if (accel) { SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); } if (!CommonInit(state)) { quit(2); } context=SDL_calloc(state->num_windows, sizeof(SDL_GLContext)); if (context==NULL) { fprintf(stderr, "Out of memory!/n"); quit(2); } /* Create OpenGL ES contexts */ for (i=0; i<state->num_windows; i++) { context[i] = SDL_GL_CreateContext(state->windows[i]); if (!context[i]) { fprintf(stderr, "SDL_GL_CreateContext(): %s/n", SDL_GetError()); quit(2); } } if (state->render_flags & SDL_RENDERER_PRESENTVSYNC) { SDL_GL_SetSwapInterval(1); } else { SDL_GL_SetSwapInterval(0); } SDL_GetCurrentDisplayMode(&mode); printf("Screen BPP: %d/n", SDL_BITSPERPIXEL(mode.format)); printf("/n"); printf("Vendor : %s/n", glGetString(GL_VENDOR)); printf("Renderer : %s/n", glGetString(GL_RENDERER)); printf("Version : %s/n", glGetString(GL_VERSION)); printf("Extensions : %s/n", glGetString(GL_EXTENSIONS)); printf("/n"); status=SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &value); if (!status) { printf("SDL_GL_RED_SIZE: requested %d, got %d/n", 5, value); } else { fprintf(stderr, "Failed to get SDL_GL_RED_SIZE: %s/n", SDL_GetError()); } status=SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &value); if (!status) {//.........这里部分代码省略.........
开发者ID:jjgod,项目名称:SDL,代码行数:101,
示例2: Open/** * It creates a Direct3D vout display. */static int Open(vlc_object_t *object){ vout_display_t *vd = (vout_display_t *)object; vout_display_sys_t *sys; /* Allocate structure */ vd->sys = sys = calloc(1, sizeof(vout_display_sys_t)); if (!sys) return VLC_ENOMEM; if (Direct3DCreate(vd)) { msg_Err(vd, "Direct3D could not be initialized"); Direct3DDestroy(vd); free(sys); return VLC_EGENERIC; } sys->use_desktop = var_CreateGetBool(vd, "video-wallpaper"); sys->reset_device = false; sys->reset_device = false; sys->allow_hw_yuv = var_CreateGetBool(vd, "directx-hw-yuv"); sys->desktop_save.is_fullscreen = vd->cfg->is_fullscreen; sys->desktop_save.is_on_top = false; sys->desktop_save.win.left = var_InheritInteger(vd, "video-x"); sys->desktop_save.win.right = vd->cfg->display.width; sys->desktop_save.win.top = var_InheritInteger(vd, "video-y"); sys->desktop_save.win.bottom = vd->cfg->display.height; if (CommonInit(vd)) goto error; /* */ video_format_t fmt; if (Direct3DOpen(vd, &fmt)) { msg_Err(vd, "Direct3D could not be opened"); goto error; } /* */ vout_display_info_t info = vd->info; info.is_slow = true; info.has_double_click = true; info.has_hide_mouse = false; info.has_pictures_invalid = true; info.has_event_thread = true; if (var_InheritBool(vd, "direct3d-hw-blending") && sys->d3dregion_format != D3DFMT_UNKNOWN && (sys->d3dcaps.SrcBlendCaps & D3DPBLENDCAPS_SRCALPHA) && (sys->d3dcaps.DestBlendCaps & D3DPBLENDCAPS_INVSRCALPHA) && (sys->d3dcaps.TextureCaps & D3DPTEXTURECAPS_ALPHA) && (sys->d3dcaps.TextureOpCaps & D3DTEXOPCAPS_SELECTARG1) && (sys->d3dcaps.TextureOpCaps & D3DTEXOPCAPS_MODULATE)) info.subpicture_chromas = d3d_subpicture_chromas; else info.subpicture_chromas = NULL; /* Interaction */ vlc_mutex_init(&sys->lock); sys->ch_desktop = false; sys->desktop_requested = sys->use_desktop; vlc_value_t val; val.psz_string = _("Desktop"); var_Change(vd, "video-wallpaper", VLC_VAR_SETTEXT, &val, NULL); var_AddCallback(vd, "video-wallpaper", DesktopCallback, NULL); /* Setup vout_display now that everything is fine */ vd->fmt = fmt; vd->info = info; vd->pool = Pool; vd->prepare = Prepare; vd->display = Display; vd->control = Control; vd->manage = Manage; /* Fix state in case of desktop mode */ if (sys->use_desktop && vd->cfg->is_fullscreen) vout_display_SendEventFullscreen(vd, false); return VLC_SUCCESS;error: Direct3DClose(vd); CommonClean(vd); Direct3DDestroy(vd); free(vd->sys); return VLC_EGENERIC;}
开发者ID:BtbN,项目名称:vlc,代码行数:91,
示例3: idWindowidFieldWindow::idFieldWindow( idUserInterfaceLocal *g ) : idWindow( g ){ gui = g; CommonInit();}
开发者ID:revelator,项目名称:MHDoom,代码行数:5,
示例4: CommonInitImageDrawingArea::ImageDrawingArea(){ CommonInit();}
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:4,
示例5: m_ImplCBCGPropertySheet::CBCGPropertySheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage) :CPropertySheet(pszCaption, pParentWnd, iSelectPage), m_Impl (*this){ CommonInit ();}
开发者ID:SnipeDragon,项目名称:gamecq,代码行数:6,
示例6: Openstatic int Open(vlc_object_t *object){ vout_display_t *vd = (vout_display_t *)object; vout_display_sys_t *sys; vd->sys = sys = calloc(1, sizeof(*sys)); if (!sys) return VLC_ENOMEM;#ifdef MODULE_NAME_IS_wingapi /* Load GAPI */ sys->gapi_dll = LoadLibrary(_T("GX.DLL")); if (!sys->gapi_dll) { msg_Warn(vd, "failed loading gx.dll"); free(sys); return VLC_EGENERIC; } GXOpenDisplay = (void *)GetProcAddress(sys->gapi_dll, _T("[email C++ CommonPrepareEpilogue函数代码示例 C++ CommitTransactionCommand函数代码示例
|