bool VAAPIContext::CreateDisplay(QSize size, bool noreuse) { m_size = size; if (!m_copy) { m_copy = new MythUSWCCopy(m_size.width()); } else { m_copy->reset(m_size.width()); } bool ok = true; m_display = VAAPIDisplay::GetDisplay(m_dispType, noreuse); CREATE_CHECK(!m_size.isEmpty(), "Invalid size"); CREATE_CHECK(m_display != NULL, "Invalid display"); CREATE_CHECK(InitDisplay(), "Invalid VADisplay"); CREATE_CHECK(InitProfiles(), "No supported profiles"); if (ok) LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Created context (%1x%2->%3x%4)") .arg(size.width()).arg(size.height()) .arg(m_size.width()).arg(m_size.height())); // ATI hue adjustment if (m_display) m_hueBase = VideoOutput::CalcHueBase(m_display->GetDriver()); return ok; }
void GoToSleep() { gFlags.light_sleep = !( gFlags.has_x32 || dfStatus.lsloff || gFlags.noclock ); ScreenOff(); LEDOff(); gFlags.firing = 0; BatReadTimer = 50; RTCSleep(); DevicesOnOff( 1 ); CLK_SysTickDelay( 250 ); CLK_SysTickDelay( 250 ); CLK_SysTickDelay( 250 ); if ( dfStatus.off || PE0 || KeyPressTime == 1100 ) { SYS_UnlockReg(); WDT_Close(); FlushAndSleep(); PreheatDelay = 0; } WDT_Open( WDT_TIMEOUT_2POW14, WDT_RESET_DELAY_18CLK, TRUE, FALSE ); SYS_LockReg(); gFlags.refresh_battery = 1; DevicesOnOff( 0 ); RTCWakeUp(); InitDisplay(); }
Boolean CBiddingForm::OnOpen(EventPtr pEvent, Boolean& bHandled) { InitDisplay(); player_has_bid = false; FormPtr frmP = FrmGetActiveForm(); FrmDrawForm(frmP); // // if the user exited the app from the bidding form, we will // restart the bidding process // GameStatus tmp = gManager->Status(); if ( tmp == SetHandTrump || tmp == GetHandBids ) { gManager->Status(GetHandBids); gManager->NewTrick(false); } // // start bidding to the left of the dealer // gManager->tbl->current_bidder = gManager->getNextPlayerIter(gManager->tbl->dealer); EventType event; event.eType = nilEvent; EvtAddEventToQueue (&event); bHandled = false; return true; }
int main ( int argc, char** argv ) { int nargs; char *env; /* rkt: check for and handle version tag */ nargs = handle_version_option (argc, argv, "$Id: test_window_env.c,v 1.10 2011/03/02 00:04:40 nicks Exp $", "$Name: $"); if (nargs && argc - nargs == 1) exit (0); argc -= nargs; env = getenv("DISPLAY"); if ( NULL == env ) { printf("DISPLAY env var not set. Skipping test.\n"); exit (77); } #if 0 GLenum bSuccess; bSuccess = tkoInitWindow( "test" ); printf( "tkoInitWindow() returned %s\n", (GL_TRUE == bSuccess ? "GL_TRUE" : "GL_FALSE") ); #endif InitDisplay(); FindVisual(); return 0; }
int cxAndroid::InitSurface() { EGLint w, h; if(InitDisplay() != 0){ return -1; } if(ANativeWindow_setBuffersGeometry(window, 0, 0, format) != 0){ CX_ERROR("ANativeWindow_setBuffersGeometry error"); return -1; } surface = eglCreateWindowSurface(display, eglConfig, window, NULL); if(surface == NULL){ CX_ERROR("eglCreateWindowSurface error"); return -1; } if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE) { CX_ERROR("Unable to eglMakeCurrent"); return -1; } if(!eglQuerySurface(display, surface, EGL_WIDTH, &w)){ CX_ERROR("eglQuerySurface error"); return -1; } if(!eglQuerySurface(display, surface, EGL_HEIGHT, &h)){ CX_ERROR("eglQuerySurface error"); return -1; } width = w; height = h; return 0; }
int main(int argc, char **argv) { glutInit(&argc, argv); InitDisplay(); // setup haptic renderer InitHL(); HandleMenuCommand('d'); // reset the surface properties to default //mPS.StartConstructingSystem(); //mDesign = true; ConstructSurface(mSurfaceParticles); mPause = false; // create pulldown menus CreateMenus(); /* The GLUT main loop won't return control, so we need to perform cleanup using an exit handler. */ atexit(exitHandler); // turn over control to GLUT glutMainLoop(); return 0; }
int main(int argc, char * argv[]) { GC gc; XFontStruct* font; XGCValues values; Display* dpy = InitDisplay(); if(!dpy) return EXIT_FAILURE; Window win = InitWindow(dpy, argc, argv); if(!win) return EXIT_FAILURE; // ListFontNames(dpy); if(!(font = XLoadQueryFont(dpy, "-misc-fixed-bold-r-normal--18-120-100-100-c-90-iso10646-1"))) { fprintf(stderr, "%s: cannot open 9x15 font.\n", argv[0]); return EXIT_FAILURE; } gc = XCreateGC(dpy, win, 0, &values); XSetFont(dpy, gc, font->fid); XSetForeground(dpy, gc, BlackPixel(dpy, DefaultScreen(dpy))); XMapWindow(dpy, win); //XFlush(dpy);//force message sending MsgLoop(dpy, win, gc, font); XFreeFont(dpy, font); XFreeGC(dpy, gc); XCloseDisplay(dpy); return EXIT_SUCCESS; }
void Crlp4002::Rotate() { rotate = ! rotate; InitDisplay(); }
static void Init() { float lightRadius = 1.0f; int i; canvas = NewPixBuf(PIXBUF_CLUT, WIDTH, HEIGHT); PixBufClear(canvas); uvmap = NewUVMap(WIDTH, HEIGHT, UV_FAST, 256, 256); UVMapGenerateTunnel(uvmap, 32.0f, 3, 4.0 / 3.0, 0.5, 0.5, NULL); UVMapSetTexture(uvmap, texture); flare = NewPixBuf(PIXBUF_GRAY, 64, 64); GeneratePixels(flare, (GenPixelFuncT)LightLinearFalloff, &lightRadius); for (i = 0; i < flare->width * flare->height; i++) flare->data[i] /= 4; origU = NewPixBuf(PIXBUF_GRAY, WIDTH, HEIGHT); PixBufBlit(origU, 0, 0, NewPixBufWrapper(WIDTH, HEIGHT, uvmap->map.fast.u), NULL); origV = NewPixBuf(PIXBUF_GRAY, WIDTH, HEIGHT); PixBufBlit(origV, 0, 0, NewPixBufWrapper(WIDTH, HEIGHT, uvmap->map.fast.v), NULL); InitDisplay(WIDTH, HEIGHT, DEPTH); LoadPalette(texturePal); }
static void Init() { canvas = NewPixBuf(PIXBUF_CLUT, WIDTH, HEIGHT); PixBufClear(canvas); ms = NewMatrixStack2D(); InitDisplay(WIDTH, HEIGHT, DEPTH); }
static void Init() { uvmap = NewUVMap(WIDTH, HEIGHT, UV_FAST, 256, 256); canvas = NewPixBuf(PIXBUF_CLUT, WIDTH, HEIGHT); ChangeMap(0); InitDisplay(WIDTH, HEIGHT, DEPTH); LoadPalette(texturePal); }
void Editor_Load() { InitFPS(); InitDisplay(); trap->RegisterCvarInt("cg_drawfps", "Draw FPS ingame?", 0, 1); eCurMode = EMODE_TILES; hotkeyDisplay = trap->RegisterStaticMenu("ui/editorhotkeys.html"); }
// Handle WM_COMMAND void CMainWnd::OnCommand(HWND hWnd,int iId,HWND hWndCtl,UINT iCodeNotify) { if (iId == IDM_EXIT) { // Terminate the Thread if (hThread) { // Close the Listener Socket closesocket(Listen); // Do Socket Cleanup WSACleanup(); } // Quit the Program PostQuitMessage(0); } else if (iId == IDM_STARTSERVER) { // Minimize the Window ShowWindow(hWnd,SW_MINIMIZE); // Cause a WM_PAINT RedrawWindow(hWnd,NULL,NULL,RDW_ERASE|RDW_INVALIDATE); // Start the Server as a new Thread hThread = CreateThread(NULL,0,LoadWinsock,(LPVOID)NULL,0,&dwThreadId); if (hThread == NULL) MessageBox(hWnd,"Failed to Create Socket Thread","Remote Control Server",MB_ICONEXCLAMATION|MB_OK); else { // Initialize the Display Variables InitDisplay(hWnd); hServerWnd = hWnd; EnableMenuItem(m_hMenu,IDM_STARTSERVER,MF_BYCOMMAND|MF_GRAYED); EnableMenuItem(m_hMenu,IDM_STOPSERVER,MF_BYCOMMAND|MF_ENABLED); } } else if (iId == IDM_STOPSERVER) { EnableMenuItem(m_hMenu,IDM_STARTSERVER,MF_BYCOMMAND|MF_ENABLED); EnableMenuItem(m_hMenu,IDM_STOPSERVER,MF_BYCOMMAND|MF_GRAYED); // Clear the Display Variables ClearDisplay(hWnd); // Terminate the Thread if (hThread) { // Close the Listener Socket closesocket(Listen); } } }
//--------------------------------------------------------------------------------------- void LAST_MODIFIED_LIST::DoCreateWindow (void) { InitDisplay (); NoEdit = true; NoKeys = true; DefineFields (); ReadAndVerifyRecords (); DISPLAY_WINDOW::DoCreateWindow (); }
bool NativeEngine::PrepareToRender() { do { // if we're missing a surface, context, or display, create them if (mEglDisplay == EGL_NO_DISPLAY || mEglSurface == EGL_NO_SURFACE || mEglContext == EGL_NO_CONTEXT) { // create display if needed if (!InitDisplay()) { LOGE("NativeEngine: failed to create display."); return false; } // create surface if needed if (!InitSurface()) { LOGE("NativeEngine: failed to create surface."); return false; } // create context if needed if (!InitContext()) { LOGE("NativeEngine: failed to create context."); return false; } LOGD("NativeEngine: binding surface and context (display %p, surface %p, context %p)", mEglDisplay, mEglSurface, mEglContext); // bind them if (EGL_FALSE == eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) { LOGE("NativeEngine: eglMakeCurrent failed, EGL error %d", eglGetError()); HandleEglError(eglGetError()); } // configure our global OpenGL settings ConfigureOpenGL(); } // now that we're sure we have a context and all, if we don't have the OpenGL // objects ready, create them. if (!mHasGLObjects) { LOGD("NativeEngine: creating OpenGL objects."); if (!InitGLObjects()) { LOGE("NativeEngine: unable to initialize OpenGL objects."); return false; } } } while(0); // ready to render return true; }
// OpenGlutWindow --- open a glut compatible window and set callbacks void OpenGlutWindow(int posx, int posy, int width, int height) { glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE); glutInitWindowPosition(posx, posy); glutInitWindowSize(width, height); win_id = glutCreateWindow("flowvr demo - Prime Numbers"); InitDisplay(width, height); glutReshapeFunc(ReshapeFunc); glutIdleFunc(IdleFunc); glutDisplayFunc(DisplayFunc); }
void XBoxStartup() { SDL_Surface *screen = InitDisplay(); players currentPlayers = { .NumPlayers = 0 }; SelectPlayers(screen, ¤tPlayers); while (currentPlayers.NumPlayers > 0) { PlayGame(screen, ¤tPlayers); SelectPlayers(screen, ¤tPlayers); } }
static void Init() { canvas = NewPixBuf(PIXBUF_CLUT, WIDTH, HEIGHT); PixBufClear(canvas); uvmap = NewUVMap(WIDTH, HEIGHT, UV_NORMAL, 256, 256); UVMapSetTexture(uvmap, texture); shades = NewPixBuf(PIXBUF_GRAY, WIDTH, HEIGHT); smallMap = NewUVMap(H_RAYS, V_RAYS, UV_ACCURATE, 256, 256); lightFunc = CalculateLightFunc(); LoadPalette(texturePal); InitDisplay(WIDTH, HEIGHT, DEPTH); }
__myevic__ void Plantouille( int xpsr, int* stack ) { int i, k; k = 0; SYS_UnlockReg(); WDT_Close(); SYS_LockReg(); InitDisplay(); while ( 1 ) { ClearScreenBuffer(); DrawImage( 0, 0, 'X'+0x27 ); DrawHexLong( 16, 0, xpsr, 0 ); DrawHexDigit( 0, 16, k ); for ( i = 0; i < 14 ; ++i ) { DrawHexLong( 16, 16+i*8, stack[i+k*14], 0 ); } DisplayRefresh(); while ( !PE0 || !PD2 || !PD3 ) CLK_SysTickDelay( 10000 ); while ( PE0 && PD2 && PD3 ) CLK_SysTickDelay( 10000 ); if ( !PE0 ) { SYS_UnlockReg(); SYS_ResetChip(); while ( 1 ) ; } if ( !PD2 ) ++k; if ( !PD3 ) --k; if ( k < 0 ) k = 0; else if ( k > 15 ) k = 15; } }
void ShowMainMenu() { int choice; DisplayInfo *mainMenu=(DisplayInfo *)malloc(sizeof(DisplayInfo)); mainMenu->curPos = 0; mainMenu->size = 4; init2DArray(&(mainMenu->words), MainStr, mainMenu->size); InitDisplay(mainMenu); for(;;) { switch(keyValue) { case Up: { keyValue = Null; CursorMoveUp(mainMenu); break; } case Down: { keyValue = Null; CursorMoveDown(mainMenu); break; } case Enter: { keyValue = Null; choice = mainMenu->curPos; switch(choice) { case 0:ParaMenu();break; case 1:ComMenu();break; case 2:ConstMenu();break; case 3:BacklistMenu();break; } ResumeDisplay(mainMenu); break; } default: { break; } } } free2DArray(&(mainMenu->words),mainMenu->size); free(mainMenu); }
void main() { auto INT8U Error; auto INT16U Ticks; auto unsigned int i; // Initialize uC/OS-II internal data structures OSInit(); InitDisplay(); Error = OSTaskCreateExt(DestructorTask, NULL, OS_LOWEST_PRIO - 2, 0, 512, NULL, OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR); // Begin multi-tasking by entering the first ready task OSStart(); }
void main(void) //----------------------------------------------------------------------------------------------------- // Purpose: The MCU will come here after reset. // // // Rev: 1.5a TEMPLATE RELEASE // // Notes: None //----------------------------------------------------------------------------------------------------- { //Initialization function calls init_ports(); motors_init(); system_clock_init(); InitDisplay("FHBTEST "); //Start-up splash changed to unity ID InitUART(); ADInit(); ENABLE_SWITCHES; /* LED initialization - macro defined in qsk_bsp.h */ ENABLE_LEDS //Polling for switch presses while(TRUE) { if(S1 == PRESSED) { BNSPrintf(LCD,"\tTEST \n "); project2ADemo(); } else if (S2 == PRESSED) { BNSPrintf(LCD,"\tOff \n "); } else if (S3 == PRESSED) { BNSPrintf(LCD,"\tFigure 8 \n "); DoFigureEight(); } else { BNSPrintf(LCD,"\tTeam 2 \n "); } } }
static void Init() { canvas = NewPixBuf(PIXBUF_CLUT, WIDTH, HEIGHT); shades = NewPixBuf(PIXBUF_GRAY, WIDTH, HEIGHT); PixBufSetColorMap(shades, colorMap); uvmap = NewUVMap(WIDTH, HEIGHT, UV_FAST, 256, 256); uvmap->lightMap = shades; UVMapGenerate4(uvmap); UVMapSetTexture(uvmap, texture); component = NewPixBufWrapper(WIDTH, HEIGHT, uvmap->map.fast.u); colorFunc = NewTable(uint8_t, 256); InitDisplay(WIDTH, HEIGHT, DEPTH); LoadPalette(texturePal); }
/*! LCD Task Main Loop */ static void DisplayTask(void *pvParameters) { tMessage Msg; InitDisplay(); for(;;) { if (xQueueReceive(QueueHandles[DISPLAY_QINDEX], &Msg, portMAX_DELAY)) { ShowMessageInfo(&Msg); DisplayQueueMessageHandler(&Msg); if (Msg.pBuffer) FreeMessageBuffer(Msg.pBuffer); CheckStackAndQueueUsage(DISPLAY_QINDEX); } } }
// OpenGlutWindow --- open a glut compatible window and set callbacks void OpenGlutWindow(int posx, int posy, int width, int height) { glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE); glutInitWindowPosition(posx, posy); glutInitWindowSize(width, height); win_id = glutCreateWindow("FlowVR Balls Visu "); InitDisplay(width, height); glutReshapeFunc(ReshapeFunc); glutIdleFunc(IdleFunc); glutDisplayFunc(DisplayFunc); glutMouseFunc(ProcessClick); glutMotionFunc(ProcessActiveMouseMotion); //glutPassiveMotionFunc(ProcessActiveMouseMotion); }
void LoadBoard(char *loadfile) { FILE *load; SAVERESTORE *Restore; Restore = new SAVERESTORE; if (!Restore) { MessageBox(hWndMain, "Not enough memory to perform operation", "OWL Chess", MB_OK | MB_ICONHAND); return; } if ((load = fopen(loadfile, "rb")) == NULL) Error("File not found"); else { fread(Restore, sizeof(SAVERESTORE), 1, load); fread(Board, sizeof(Board), 1, load); fclose(load); Player = Restore->Player; Opponent = Restore->Opponent; ProgramColor = Restore->ProgramColor; Turned = Restore->Turned; MultiMove = Restore->MultiMove; AutoPlay = Restore->AutoPlay; SingleStep = Restore->SingleStep; Level = Restore->Level; AverageTime = Restore->AverageTime; MaxLevel = Restore->MaxLevel; MoveNo = Restore->MoveNo; ChessClock.totaltime = Restore->ChessClockTotalTime; ChessTime[black].totaltime = Restore->BlackTotalTime ; ChessTime[white].totaltime = Restore->WhiteTotalTime; memcpy(PieceValue, Restore->PieceValue, 7 * sizeof(int)); ClearDisplay(); InitDisplay(); InvalidateRect(hWndMain, NULL, TRUE); PrintCurLevel(); ResetNewPos(); } delete Restore; }
static void Init() { canvas = NewPixBuf(PIXBUF_CLUT, WIDTH, HEIGHT); uvmap = NewUVMap(WIDTH, HEIGHT, UV_FAST, 256, 256); UVMapGenerate2(uvmap); UVMapSetTexture(uvmap, texture); orig = NewPixBuf(PIXBUF_GRAY, WIDTH, HEIGHT); PixBufBlit(orig, 0, 0, NewPixBufWrapper(WIDTH, HEIGHT, uvmap->map.fast.u), NULL); scene = NewScene(); SceneAddObject(scene, NewSceneObject("Object", mesh)); shades = NewPixBuf(PIXBUF_GRAY, WIDTH, HEIGHT); InitDisplay(WIDTH, HEIGHT, DEPTH); LoadPalette(texturePal); }
/* * Load demo. */ bool LoadDemo() { const char *loadImgPath = JsonQueryString(DemoConfig, "load/image"); const char *loadPalPath = JsonQueryString(DemoConfig, "load/palette"); const char *musicPath = JsonQueryString(DemoConfig, "music/file"); if ((TheLoadImg = NewPixBufFromFile(loadImgPath)) && (TheLoadPal = NewPaletteFromFile(loadPalPath)) && (TheMusic = AudioStreamOpen(musicPath)) && (TheCanvas = NewPixBuf(PIXBUF_CLUT, WIDTH, HEIGHT)) && InitDisplay(WIDTH, HEIGHT, DEPTH)) { c2p1x1_8_c5_bm(TheLoadImg->data, GetCurrentBitMap(), WIDTH, HEIGHT, 0, 0); LoadPalette(TheLoadPal); DisplaySwap(); return true; } return false; }
int main(int argc, char **argv) { srand( (unsigned)time( NULL ) ); InitGLUT(argc, argv, "Shooter", 500, 500) ; InitDisplay(true, true, false) ; InitCamera(10) ; InitMouse() ; glutDisplayFunc(DisplayHandler) ; glutKeyboardFunc(KeyboardHandler) ; glutMouseFunc(MouseButtonHandler) ; glutMotionFunc(MotionHandler) ; InitOptions() ; glutMainLoop() ; return 0 ; }
void LunaticInit(MGLDraw *mgl) { gamemgl = mgl; logFile = AppdataOpen("loonylog.txt", "wt"); InitCosSin(); InitDisplay(gamemgl); InitSound(); InitMonsters(); InitTiles(mgl); InitItems(); InitInterface(); LoadOptions(); MusicInit(); mgl->SetLastKey(0); MGL_srand(timeGetTime()); InitControls(); InitPlayer(INIT_GAME, 0, 0); msgFromOtherModules = 0; }