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))); }
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 }
int run() { SDL_Surface *surface = NULL; SDL_Event event; if (SDL_Init(SDL_INIT_VIDEO) < 0) { std::cerr << "Unable to initialize SDL: " << SDL_GetError() << '\n'; return -1; } surface = setVideoMode(); SDL_WM_SetCaption(PACKAGE_STRING, NULL); initGL(); while (!keyPressed[SDLK_ESCAPE] && event.type != SDL_QUIT) { update(); display(); SDL_GL_SwapBuffers(); while (SDL_PollEvent(&event)) { if (event.type == SDL_KEYDOWN || event.type == SDL_KEYUP) { keyPressed[event.key.keysym.sym] = static_cast<bool>(event.key.state); } if (event.type == SDL_VIDEORESIZE) { screenWidth = event.resize.w; screenHeight = event.resize.h; if (surface) SDL_FreeSurface(surface); surface = setVideoMode(); } } usleep(10000); } SDL_Quit(); return 0; }
OniStatus setImageRegistrationMode(OniImageRegistrationMode mode) { if (!isImageRegistrationModeSupported(mode)) return ONI_STATUS_NOT_SUPPORTED; image_registration_mode = mode; return setVideoMode(video_mode); }
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; }
void GUI_ModulesLoaded_hook(void* kernelEntry, void* arg2, void* arg3, void* arg4) { // Start the gui useGUI = true; // Override useGUI default getBoolForKey(kGUIKey, &useGUI, &bootInfo->bootConfig); if (useGUI && initGUI()) { // initGUI() returned with an error, disabling GUI. useGUI = false; } else if(useGUI) { replace_function("_initGraphicsMode", &GUI_initGraphicsMode); replace_function("_getBootOptions", &GUI_getBootOptions); replace_function("_clearBootArgs", &GUI_clearBootArgs); replace_function("_showHelp", &GUI_showHelp); replace_function("_printf", &GUI_printf); replace_function("_verbose", &GUI_verbose); replace_function("_error", &GUI_error); replace_function("_stop", &GUI_stop); setVideoMode( GRAPHICS_MODE, 0 ); drawBackground(); } // DBG("GUI loaded\n"); }
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); }
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; } }
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; }
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); }
//---------------------------------------------------------------------------- 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); }
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; }
bool Graphics::setFullscreen(const bool fs) { if (mFullscreen == fs) return true; return setVideoMode(mActualWidth, mActualHeight, mScale, mBpp, fs, mHWAccel, mEnableResize, mNoFrame); }
bool Graphics::setFullscreen(bool fs) { if (mFullscreen == fs) return true; return setVideoMode(mScreen->w, mScreen->h, mScreen->format->BitsPerPixel, fs, mHWAccel); }
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); }
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; }
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; }
bool Graphics::setFullscreen(bool fs) { if (mFullscreen == fs) return true; #ifdef X11 logger->log("Switching to %s mode", fs ? "fullscreen" : "windowed"); return SDL_WM_ToggleFullScreen(mTarget); #else return setVideoMode(mWidth, mHeight, mBpp, fs, mHWAccel); #endif }
bool Graphics::resizeVideoMode(int w, int h) { bool success = setVideoMode(w, h, mBpp, mFullscreen, mHWAccel); if (success) { gcn::Graphics::popClipArea(); _beginDraw(); } return success; }
void IOContext_SDL::setFullScreen(bool value) { m_fullscreen = value; if(m_initialized) { SDL_Surface *screen = setVideoMode(); if(!screen) { fprintf(stderr, "IOContext_SDL::setWindowDimensions(): setVideoMode failed: %s\n", SDL_GetError()); SDL_Quit(); } } }
/** ** The kernel is about to start, draw the boot graphics if we are not in ** verbose mode. **/ void GUI_ExecKernel_hook(void* kernelEntry, void* arg2, void* arg3, void* arg4) { if(!gVerboseMode) { // Note: shouldn't be needed, but just in case drawBootGraphics(); } else if(!useGUI) { setVideoMode( GRAPHICS_MODE, 0 ); //Slice - Why GRAPHICS_MODE if gVerboseMode? // DBG("GUI set GRAPHICS_MODE\n"); } }
void showBootLogo() { uint8_t *bootImageData = NULL; uint8_t *appleBootLogo = (uint8_t *) decodeRLE(appleLogoRLE, 686, 16384); setVideoMode(GRAPHICS_MODE); // Fill the background to 75% grey (same as BootX). drawColorRectangle(0, 0, VIDEO(width), VIDEO(height), 0x01); convertImage(APPLE_LOGO_WIDTH, APPLE_LOGO_HEIGHT, appleBootLogo, &bootImageData); drawDataRectangle(APPLE_LOGO_X, APPLE_LOGO_Y, APPLE_LOGO_WIDTH, APPLE_LOGO_HEIGHT, bootImageData); free(bootImageData); free(appleBootLogo); }
void IOContext_SDL::setWindowDimensions(int width, int height) { m_windowWidth = width; m_windowHeight = height; if(m_initialized) { SDL_Surface *screen = setVideoMode(); if(!screen) { fprintf(stderr, "IOContext_SDL::setWindowDimensions(): setVideoMode failed: %s\n", SDL_GetError()); SDL_Quit(); } if(m_handler) m_handler->windowDimensionsChanged(m_windowWidth, m_windowHeight); } }
bool ProtoConnection::parseReply(const proto::HyperionReply &reply) { bool success = false; switch (reply.type()) { case proto::HyperionReply::REPLY: { if (!_skipReply) { if (!reply.success()) { if (reply.has_error()) { throw std::runtime_error("PROTOCONNECTION ERROR: " + reply.error()); } else { throw std::runtime_error("PROTOCONNECTION ERROR: No error info"); } } else { success = true; } } break; } case proto::HyperionReply::GRABBING: { int grabbing = reply.has_grabbing() ? reply.grabbing() : 7; GrabbingMode gMode = (GrabbingMode)grabbing; emit setGrabbingMode(gMode); break; } case proto::HyperionReply::VIDEO: { int video = reply.has_video() ? reply.video() : 0; VideoMode vMode = (VideoMode)video; emit setVideoMode(vMode); break; } } return success; }
Grabber::Grabber(QString grabberName, int width, int height, int cropLeft, int cropRight, int cropTop, int cropBottom) : _imageResampler() , _useImageResampler(true) , _videoMode(VIDEO_2D) , _width(width) , _height(height) , _cropLeft(0) , _cropRight(0) , _cropTop(0) , _cropBottom(0) , _enabled(true) , _log(Logger::getInstance(grabberName)) { setVideoMode(VIDEO_2D); setCropping(cropLeft, cropRight, cropTop, cropBottom); }
void Pipeline::startRecording() { if(currentMode == MODE_IMAGE) setVideoMode(); currentFile = nextFileName(); emit savedFileNameChanged(currentFile); // set next file name g_object_set(camerabin, "filename", currentFile.toUtf8().constData(), NULL); // write video metadata writeMetadata(); g_signal_emit_by_name(camerabin, "capture-start", 0); }
void VI::statusChanged() { switch (*gfxInfo.VI_STATUS_REG & 3) { case 2: if (bpp != 16) { bpp = 16; setVideoMode(640, 480); } break; case 3: if (bpp != 32) { printf("VI:32bits\n"); bpp =32; } break; } }
/** Switches screen/window resolution and fullscreen mode. */ bool Gfx::setVideoMode(){ Uint32 screenFlags = SDL_DOUBLEBUF | SDL_HWSURFACE | SDL_RLEACCEL; if (fullscreen) screenFlags |= SDL_FULLSCREEN; screen = SDL_SetVideoMode(res.x, res.y, 32, screenFlags); if ( screen == NULL ) { if (fullscreen){ cerr << "Couldn't set " << res.x << "x" << res.y << "x32 FULLSCREEN video mode: " << SDL_GetError() << "; switching to WINDOWED" << endl; fullscreen = false; setVideoMode(); return false; }else{ cerr << "Couldn't set " << res.x << "x" << res.y << "x32 WINDOWED video mode: " << SDL_GetError() << "; Fatal error" << endl; exit(1); } } return true; }
GameWidget::GameWidget(const QString& qstring, QWidget* parent) : QGraphicsView(parent) { resourcePath = qstring; setWindowTitle(GameName); setViewportUpdateMode(QGraphicsView::SmartViewportUpdate); profile = new GameProfile(this); //profile->loadProfile(); this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); scene = new GameScene(this); scene->setProfile(profile); setScene(scene); //controls = new GameControls(scene); setVideoMode(); }
void SDLAppDisplay::resize(int width, int height) { int resized_width, resized_height; #if SDL_VERSION_ATLEAST(1,3,0) SDL_GetWindowSize(sdl_window, &resized_width, &resized_height); #else setVideoMode(width, height, fullscreen); const SDL_VideoInfo* display_info = SDL_GetVideoInfo(); resized_width = display_info->current_w; resized_height = display_info->current_h; #endif //set viewport to match what we ended up on glViewport(0, 0, resized_width, resized_height); this->width = resized_width; this->height = resized_height; }