本文整理汇总了C++中setVideoMode函数的典型用法代码示例。如果您正苦于以下问题:C++ setVideoMode函数的具体用法?C++ setVideoMode怎么用?C++ setVideoMode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setVideoMode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _priority
ProtoConnectionWrapper::ProtoConnectionWrapper(const QString &address,
int priority,
int duration_ms,
bool skipProtoReply)
: _priority(priority)
, _duration_ms(duration_ms)
, _connection(address.toStdString())
{
_connection.setSkipReply(skipProtoReply);
connect(&_connection, SIGNAL(setGrabbingMode(GrabbingMode)), this, SIGNAL(setGrabbingMode(GrabbingMode)));
connect(&_connection, SIGNAL(setVideoMode(VideoMode)), this, SIGNAL(setVideoMode(VideoMode)));
}
示例2: endDraw
bool Graphics::resizeScreen(const int width, const int height)
{
#ifdef USE_SDL2
endDraw();
mRect.w = static_cast<int32_t>(width / mScale);
mRect.h = static_cast<int32_t>(height / mScale);
mWidth = width / mScale;
mHeight = height / mScale;
mActualWidth = width;
mActualHeight = height;
#ifdef USE_OPENGL
// +++ probably this way will not work in windows/mac
// Setup OpenGL
glViewport(0, 0, mActualWidth, mActualHeight);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
#else
// +++ need impliment resize in soft mode
#endif // USE_OPENGL
screenResized();
beginDraw();
return true;
#else
const int prevWidth = mWidth;
const int prevHeight = mHeight;
endDraw();
const bool success = setVideoMode(width, height, mScale, mBpp,
mFullscreen, mHWAccel, mEnableResize, mNoFrame);
// If it didn't work, try to restore the previous size. If that didn't
// work either, bail out (but then we're in deep trouble).
if (!success)
{
if (!setVideoMode(prevWidth, prevHeight, mScale, mBpp,
mFullscreen, mHWAccel, mEnableResize, mNoFrame))
{
return false;
}
}
screenResized();
beginDraw();
return success;
#endif // USE_SDL2
}
示例3: setImageRegistrationMode
OniStatus setImageRegistrationMode(OniImageRegistrationMode mode)
{
if (!isImageRegistrationModeSupported(mode))
return ONI_STATUS_NOT_SUPPORTED;
image_registration_mode = mode;
return setVideoMode(video_mode);
}
示例4: SDLInitException
void SDLAppDisplay::init(std::string window_title, int width, int height, bool fullscreen) {
if(SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO) != 0) {
throw SDLInitException(SDL_GetError());
}
const SDL_VideoInfo* display_info = SDL_GetVideoInfo();
//save the desktop resolution
desktop_width = display_info->current_w;
desktop_height = display_info->current_h;
atexit(SDL_Quit);
SDL_EnableUNICODE(1);
#if SDL_VERSION_ATLEAST(1,3,0)
#else
SDL_WM_SetCaption(window_title.c_str(),0);
#endif
setVideoMode(width, height, fullscreen);
//get actual opengl viewport
GLint viewport[4];
glGetIntegerv( GL_VIEWPORT, viewport );
this->width = viewport[2];
this->height = viewport[3];
this->fullscreen = fullscreen;
}
示例5: getVideoModes
void Core::setVideoModeIndex(int index, bool fullScreen, bool vSync, int aaLevel, int anisotropyLevel) {
std::vector<Rectangle> resList = getVideoModes();
if(index >= resList.size())
return;
setVideoMode(resList[index].w, resList[index].h, fullScreen, vSync, aaLevel, anisotropyLevel);
}
示例6: setProperty
virtual OniStatus setProperty(int propertyId, const void* data, int dataSize)
{
switch (propertyId)
{
default:
case ONI_STREAM_PROPERTY_HORIZONTAL_FOV: // float: radians
case ONI_STREAM_PROPERTY_VERTICAL_FOV: // float: radians
case ONI_STREAM_PROPERTY_MAX_VALUE: // int
case ONI_STREAM_PROPERTY_MIN_VALUE: // int
case ONI_STREAM_PROPERTY_STRIDE: // int
case ONI_STREAM_PROPERTY_NUMBER_OF_FRAMES: // int
// camera
case ONI_STREAM_PROPERTY_AUTO_WHITE_BALANCE: // OniBool
case ONI_STREAM_PROPERTY_AUTO_EXPOSURE: // OniBool
// xn
case XN_STREAM_PROPERTY_INPUT_FORMAT: // unsigned long long
case XN_STREAM_PROPERTY_CROPPING_MODE: // XnCroppingMode
return ONI_STATUS_NOT_SUPPORTED;
case ONI_STREAM_PROPERTY_VIDEO_MODE: // OniVideoMode*
#if 0
if (dataSize != sizeof(OniVideoMode))
{
LogError("Unexpected size for ONI_STREAM_PROPERTY_VIDEO_MODE");
return ONI_STATUS_ERROR;
}
if (ONI_STATUS_OK != setVideoMode(*(static_cast<const OniVideoMode*>(data))))
raisePropertyChanged(propertyId, data, dataSize);
return ONI_STATUS_OK;
#endif
return ONI_STATUS_NOT_SUPPORTED;
case ONI_STREAM_PROPERTY_CROPPING: // OniCropping*
#if 0
if (dataSize != sizeof(OniCropping))
{
LogError("Unexpected size for ONI_STREAM_PROPERTY_CROPPING");
return ONI_STATUS_ERROR;
}
cropping = *(static_cast<const OniCropping*>(data));
raisePropertyChanged(propertyId, data, dataSize);
return ONI_STATUS_OK;
#endif
return ONI_STATUS_NOT_SUPPORTED;
case ONI_STREAM_PROPERTY_MIRRORING: // OniBool
#if 0
if (dataSize != sizeof(OniBool))
{
LogError("Unexpected size for ONI_STREAM_PROPERTY_MIRRORING");
return ONI_STATUS_ERROR;
}
mirroring = *(static_cast<const OniBool*>(data));
raisePropertyChanged(propertyId, data, dataSize);
return ONI_STATUS_OK;
#endif
return ONI_STATUS_NOT_SUPPORTED;
}
}
示例7: fprintf
bool
IOContext_SDL::init()
{
if(!(SDL_WasInit(0) & SDL_INIT_VIDEO)) {
if(SDL_Init(SDL_INIT_VIDEO) != 0) {
fprintf(stderr, "IOContext_SDL::init(): Couldn't initialize SDL: %s\n", SDL_GetError());
return false;
}
}
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
SDL_Surface *screen = setVideoMode();
if(!screen) {
fprintf(stderr, "IOContext_SDL::init(): setVideoMode failed: %s\n", SDL_GetError());
SDL_Quit();
return false;
}
if(m_windowTitle.length() > 0)
SDL_WM_SetCaption(m_windowTitle.c_str(), NULL);
else
SDL_WM_SetCaption("Drome Engine", NULL);
if(m_grabInput) {
SDL_ShowCursor(SDL_DISABLE);
SDL_WM_GrabInput(SDL_GRAB_ON);
}
fprintf(stderr, "SDL initialized\n");
m_initialized = true;
return true;
}
示例8: FreenectVideoStream
FreenectDepthStream::FreenectDepthStream(Freenect::FreenectDevice* pDevice) : FreenectVideoStream(pDevice)
{
video_mode = makeOniVideoMode(ONI_PIXEL_FORMAT_DEPTH_1_MM, 640, 480, 30);
image_registration_mode = ONI_IMAGE_REGISTRATION_DEPTH_TO_COLOR;
mirroring = false;
setVideoMode(video_mode);
}
示例9: SDL_QuitSubSystem
//----------------------------------------------------------------------------
void Video::updateSettings( void)
{
bool fullscreen = _isFullscreen;
ConfigS::instance()->getBoolean( "fullscreen", _isFullscreen);
int width = 0;
ConfigS::instance()->getInteger( "width", width);
int height = 0;
ConfigS::instance()->getInteger( "height", height);
if( (fullscreen != _isFullscreen) || (width != _width) || (height != _height))
{
#ifdef DYNAMIC_GL
SDL_QuitSubSystem( SDL_INIT_VIDEO);
if( SDL_InitSubSystem( SDL_INIT_VIDEO) < 0 )
{
LOG_ERROR << "Update Video: failed # " << SDL_GetError() << endl;
}
#endif
setVideoMode();
reload();
#ifdef DYNAMIC_GL
grabAndWarpMouse();
#endif
}
ConfigS::instance()->getBoolean( "showStarfield", _showStarfield);
ConfigS::instance()->getBoolean( "showNebulas", _showNebulas);
}
示例10: main
int main(int argc, char * argv[])
{
struct pwcmech * pwcmech;
pwcmech->dev = ifinit_pwcblock();
pwcmech->com = ifinit_usbcom();
ifbind_pwcblock(pwcmech->dev, pwcmech->com);
//use driver
usb_init(pwcmech->com);
if ( usb_open(pwcmech->com) )
{
finish(pwcmech);
return 0;
}
//should work seamlessly
usb_if_claim(pwcmech->com, pwcmech->com->standard_descriptors.highspeed.cameraStream.cameraStreamConf);
setVideoMode(pwcmech, 9);
setLeds(pwcmech, 10,5);
usb_release_interface(pwcmech->com, pwcmech->com->standard_descriptors.highspeed.cameraStream.cameraStreamConf);
usb_close(pwcmech->com);
finish(pwcmech);
return 0;
}
示例11: setVideoMode
bool Graphics::setFullscreen(const bool fs)
{
if (mFullscreen == fs)
return true;
return setVideoMode(mActualWidth, mActualHeight, mScale, mBpp, fs,
mHWAccel, mEnableResize, mNoFrame);
}
示例12: setVideoMode
bool Graphics::setFullscreen(bool fs)
{
if (mFullscreen == fs)
return true;
return setVideoMode(mScreen->w, mScreen->h,
mScreen->format->BitsPerPixel, fs, mHWAccel);
}
示例13: Menu
void Menu()
{
int done = 0;
int ctrl = 0;
// Set video mode based on aspect ratio
if(CONF_GetAspectRatio() == CONF_ASPECT_16_9) isWide = 1;
setVideoMode();
drawLogo();
dListTotal = findPaks();
dListCurrentPosition = 0;
if(dListTotal != 1)
{
sortList();
getAllLogs();
initMenu(1);
drawMenu();
pControl = ControlMenu;
while(!done)
{
ctrl = Control();
switch(ctrl)
{
case 1:
case 2:
done = 1;
break;
case 3:
drawLogs();
break;
case -1:
drawMenu();
break;
case -2:
// BGM player isn't supported
break;
}
}
freeAllLogs();
termMenu();
if(ctrl == 2)
{
if (filelist)
{
free(filelist);
filelist = NULL;
}
borExit(0);
}
}
getBasePath(packfile, filelist[dListCurrentPosition+dListScrollPosition].filename, 1);
free(filelist);
}
示例14: setVideoMode
void Renderer::init()
{
if (m_initialized) return;
// Set Video mode, if requested.
// Must be done before DirectFBCreate()!
if (m_videoMode != -1)
{
setVideoMode(m_videoMode);
}
DFBSurfaceDescription dsc;
if (DirectFBCreate(&m_dfb) != DFB_OK) {
fprintf(stderr, "Error in DirectFBCreate!\n"); return;
}
if (m_dfb->SetCooperativeLevel(m_dfb, DFSCL_EXCLUSIVE) != DFB_OK) {
fprintf(stderr, "Error in SetCooperativeLevel!\n"); return;
}
dsc.flags = (DFBSurfaceDescriptionFlags)(DSDESC_CAPS | DSDESC_PIXELFORMAT);
dsc.caps = (DFBSurfaceCapabilities)(DSCAPS_PRIMARY | DSCAPS_DOUBLE);
dsc.pixelformat = (DFBSurfacePixelFormat)DSPF_ARGB;
if (m_dfb->CreateSurface( m_dfb, &dsc, &m_surface ) != DFB_OK) {
fprintf(stderr, "Error in CreateSurface!\n"); return;
}
if (m_surface->GetSize (m_surface, &m_width, &m_height) != DFB_OK) {
fprintf(stderr, "Error in GetSize!\n"); return;
}
m_scale = ((float)m_width) / VIRTUAL_WIDTH;
m_width = VIRTUAL_WIDTH;
m_height = VIRTUAL_HEIGHT;
m_curr_buffer = 0;
color(0,0,0,0xff);
rect(0,0,m_width, m_height); flip();
rect(0,0,m_width, m_height); flip();
if (m_dfb->GetInputDevice (m_dfb, INPUT_DEVICE, &m_input) != DFB_OK) {
fprintf(stderr, "Error in GetInputDevice!\n"); return;
}
if (m_input->CreateEventBuffer (m_input, &m_eventBuffer) != DFB_OK) {
fprintf(stderr, "Error in CreateEventBuffer!\n"); return;
}
// m_image_loader = new ImageLoader();
// m_image_loader->start();
m_exit = false;
m_initialized = true;
}
示例15: ExecKernel
static int ExecKernel(void *binary)
{
entry_t kernelEntry;
int ret;
bootArgs->kaddr = bootArgs->ksize = 0;
ret = DecodeKernel(binary, &kernelEntry, (char **)&bootArgs->kaddr, (int *)&bootArgs->ksize);
if (ret != 0) {
return ret;
}
// Reserve space for boot args
reserveKernBootStruct();
// Load boot drivers from the specifed root path.
if (!gHaveKernelCache) {
LoadDrivers("/");
}
clearActivityIndicator();
if (gErrors) {
printf("Errors encountered while starting up the computer.\n");
printf("Pausing %d seconds...\n", kBootErrorTimeout);
sleep(kBootErrorTimeout);
}
setupFakeEfi();
verbose("Starting Darwin %s\n",( archCpuType == CPU_TYPE_I386 ) ? "x86" : "x86_64");
bool dummyVal;
if (getBoolForKey(kWaitForKeypressKey, &dummyVal, &bootInfo->bootConfig) && dummyVal) {
printf("Press any key to continue...");
getc();
}
// If we were in text mode, switch to graphics mode.
// This will draw the boot graphics unless we are in
// verbose mode.
if (gVerboseMode) {
setVideoMode(GRAPHICS_MODE, 1);
} else {
drawBootGraphics();
}
finalizeBootStruct();
// Jump to kernel's entry point. There's no going back now.
startprog(kernelEntry, bootArgs);
// Not reached
return 0;
}