static inline bool LatestVersion(int *major, int *minor, int *current_line) { u32 http_status = 0; u8* outbuf = NULL; u32 filesize; int line = *current_line; PrintFormat(DEFAULT_SIZE, BLACK, MENU_POS_X, MENU_POS_Y + 20*line, Downloads[DOWNLOAD_VERSION].text); UpdateScreen(); line++; if(!http_request(Downloads[DOWNLOAD_VERSION].url, Downloads[DOWNLOAD_VERSION].max_size)) { PrintFormat(DEFAULT_SIZE, BLACK, MENU_POS_X, MENU_POS_Y + 20*line, "Failed to retrieve version"); UpdateScreen(); *current_line = line; return false; } http_get_result(&http_status, &outbuf, &filesize); if (((int)*outbuf & 0xF0000000) == 0xF0000000) { if (outbuf != NULL) free(outbuf); *current_line = line; return false; } sscanf((char*)outbuf, " #ifndef %*s #define %*s #define NIN_MAJOR_VERSION %i #define NIN_MINOR_VERSION %i", major, minor); gprintf("major = %i, minor = %i\r\n", *major, *minor); if (outbuf != NULL) free(outbuf); if ((*major <= NIN_MAJOR_VERSION) && (*minor <= NIN_MINOR_VERSION)) { bool still_download = true; PrintFormat(DEFAULT_SIZE, BLACK, MENU_POS_X, MENU_POS_Y + 20*line, "You already have the latest version"); line++; PrintFormat(DEFAULT_SIZE, BLACK, MENU_POS_X, MENU_POS_Y + 20*line, "Download anyway? (A: Yes, B: No)"); line++; UpdateScreen(); while(true) { DrawBuffer(); FPAD_Update(); if (FPAD_Cancel(0)) { gprintf("Cancelling download\n"); still_download = false; break; } if (FPAD_OK(0)) { gprintf("okay\n"); break; } GRRLIB_Render(); } if(!still_download) { *current_line = line; return false; } } *current_line = line; return (*major + *minor) > 0; }
void CGeneral::BonusGame() { int i, j, k; char dat[] = {0xe9, 0x85, 0x8d, 0x00, 0xe7, 0x89, 0x8c, 0x00, 0xe5, 0x87, 0xba, 0x00, 0xe8, 0xa1, 0x80, 0x00, 0xe5, 0xa5, 0x96, 0xe5, 0x8a, 0xb1, 0xe6, 0xb8, 0xb8, 0xe6, 0x88, 0x8f, 0x00}; SDL_BlitSurface(m_imgBonusGame, NULL, gpScreen, NULL); UpdateScreen(); PlayMusic(m_musBGame, 0); UTIL_Delay(6000); bool locked = false; if (SDL_MUSTLOCK(gpScreen)) { SDL_LockSurface(gpScreen); locked = true; } for (i = 0; i < 640; i++) { for (j = 0; j < 480; j++) { unsigned char r, g, b; k = 0; UTIL_GetPixel(gpScreen, i, j, &r, &g, &b); k += r; k += g; k += b; k /= 3; UTIL_PutPixel(gpScreen, i, j, k, k, k); } } if (locked) { SDL_UnlockSurface(gpScreen); } for (i = 0; i < 4; i++) { DrawUTF8Text(&dat[i * 4], 150 + i * 100, 100, 2, 255, 255, 0); UpdateScreen(); PlaySound(SND_SOUND1); UTIL_Delay(1300); } DrawUTF8Text(&dat[i * 4], 175, 200, 2, 0, 255, 255); PlaySound(SND_DISCARD2); UpdateScreen(); UTIL_Delay(2500); ScreenFade(); }
void CGeneral::AnimSelfDrawn(const CTile &t) { EraseArea(20, 265, TILE_WIDTH * 10, 303 + TILE_HEIGHT_SHOWN - 265); UpdateScreen(20, 265, TILE_WIDTH * 10, 303 + TILE_HEIGHT_SHOWN - 265); int i; SDL_Rect dstrect; PlaySound(SND_FLASH); for (i = 0; i < 12; i++) { EraseArea(20, 265, TILE_WIDTH * 10, 303 + TILE_HEIGHT_SHOWN - 265); EraseArea(dstrect.x, dstrect.y, dstrect.w, 30); dstrect.x = 245; dstrect.y = 235; dstrect.w = m_imgFlash1->w; dstrect.h = m_imgFlash1->h; SDL_BlitSurface(m_imgFlash1, NULL, gpScreen, &dstrect); DrawTile(t, 280, 255); UpdateScreen(20, 235, TILE_WIDTH * 10, 303 + TILE_HEIGHT_SHOWN - 235); UTIL_Delay(50); EraseArea(20, 265, TILE_WIDTH * 10, 303 + TILE_HEIGHT_SHOWN - 265); EraseArea(dstrect.x, dstrect.y, dstrect.w, 30); dstrect.w = m_imgFlash2->w; dstrect.h = m_imgFlash2->h; SDL_BlitSurface(m_imgFlash2, NULL, gpScreen, &dstrect); DrawTile(t, 280, 255); UpdateScreen(20, 235, TILE_WIDTH * 10, 303 + TILE_HEIGHT_SHOWN - 235); UTIL_Delay(50); } UTIL_Delay(20); EraseArea(20, 265, TILE_WIDTH * 10, 303 + TILE_HEIGHT_SHOWN - 265); EraseArea(dstrect.x, dstrect.y, dstrect.w, 30); dstrect.w = m_imgFlash1->w; dstrect.h = m_imgFlash1->h; SDL_BlitSurface(m_imgFlash1, NULL, gpScreen, &dstrect); DrawTile(t, 280, 255); DrawUTF8Text(msg("out_selfdrawn"), 215, 265, 2, 255, 255, 255); UpdateScreen(20, 205, TILE_WIDTH * 10, 303 + TILE_HEIGHT_SHOWN - 205); UTIL_Delay(1000); EraseArea(20, 265, TILE_WIDTH * 10, 303 + TILE_HEIGHT_SHOWN - 265); EraseArea(dstrect.x, dstrect.y, dstrect.w, 30); UpdateScreen(20, 205, TILE_WIDTH * 10, 303 + TILE_HEIGHT_SHOWN - 205); }
int main() { Handle splash = 0; CreateImage(splash, splash_png, sizeof(splash_png)); DrawImage(splash, 0, 0); UpdateScreen(); do { Wait(WAIT_KEY); if(GetKeys() & MAK_FIRE) break; } while(1); DestroyObject(splash); Handle backg = 0; CreateImage(backg, ttsdemo_png, sizeof(ttsdemo_png)); DrawImage(backg, 0, 0); UpdateScreen(); int oldKeys = GetKeys(); while(1) { Wait(WAIT_KEY); int newKeys = GetKeys(); int downedKeys = newKeys & (~oldKeys); oldKeys = newKeys; if(downedKeys) StopSpeaking(); if(downedKeys & MAK_FIRE) { StartSpeaking("Du står i korsningen Götgatan Åsögatan riktning Slussen. En meter till " "vänster om dig är ett övergångställe, för passage över Götgatan med " "tryckknapp för gångtrafikanter. Vid trottoarkanten löper en cykelväg."); } if(downedKeys & MAK_DOWN) { StartSpeaking("Tre meter bakom dig i riktning Skanstull är ett övergångställe för " "passage över Åsögatan."); } if(downedKeys & MAK_UP) { StartSpeaking("Trottoaren rakt framfortsätter 50 meter till nästa korsning Folkungagatan. " "På andra sidan av övergångstället finns ingångar till tunnelbanestation " "medborgarplatsen."); } /*if(downedKeys & MAK_RIGHT) { StartSpeaking("Am I right? Of course I'm right."); } if(downedKeys & MAK_LEFT) { StartSpeaking("No one is left behind."); }*/ } return 0; }
/* ================ idCommonLocal::TimeRenderDemo ================ */ void idCommonLocal::TimeRenderDemo( const char *demoName, bool twice, bool quit ) { idStr demo = demoName; StartPlayingRenderDemo( demo ); if ( twice && readDemo ) { while ( readDemo ) { const bool captureToImage = false; UpdateScreen( captureToImage ); AdvanceRenderDemo( true ); } StartPlayingRenderDemo( demo ); } if ( !readDemo ) { return; } if ( quit ) { // this allows hardware vendors to automate some testing timeDemo = TD_YES_THEN_QUIT; } else { timeDemo = TD_YES; } }
//------------------------------------------------------------ EndExperiment() // static int EndExperiment(void){ ShowBackground(RGB_Blue); UpdateScreen(); sleep(2); ExperimentSave(); exit (APPSUCCESS); }
void CWsBackedUpWindow::Scroll(const TRect &aClipRect, const TPoint &aOffset,const TRect &aRect) { TRect winBorder=TRect(iWsWin->Size()); TRect clipRect=aClipRect; TRect srcRect = aRect; clipRect.Intersection(winBorder); if (!clipRect.IsEmpty()) { // If we have to do something (a visible part will change) srcRect.Intersection(clipRect); STACK_REGION regionToClear; regionToClear.AddRect(aRect); regionToClear.SubRect(srcRect); regionToClear.Offset(aOffset); ActivateGc(); iBitGc->SetClippingRect(clipRect); iBitGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); iBitGc->CopyRect(aOffset,srcRect); for (TInt k=0;k<regionToClear.Count();k++) { iBitGc->Clear(regionToClear[k]); } iBitGc->SetClippingRect(winBorder); iBitGc->SetDrawMode(CGraphicsContext::EDrawModePEN); TRegionFix<1> fixRegion(iWsWin->AbsRect()); UpdateScreen(fixRegion); regionToClear.Close(); } }
void Graphics::Rendering() { UpdateScreen(); // Draw moving tetromino float transX = mTetromino->GetTopLeft()->col; float transY = mTetromino->GetTopLeft()->row; for(int row=0; row<mTetromino->GetHeight(); row++) { for(int col=0; col<mTetromino->GetWidth(); col++) { if(mTetromino->GetShape()[row][col] != 0) { DrawSquare2D(col + transX, row + transY, mTetromino->GetShape()[row][col]); } } } // Draw landed tetrominos for(int row=0; row<mRow; row++) { for(int col=0; col<mCol; col++) { DrawSquare2D(col, row, mBoard->GetLanded()[row][col]); } } SwapFrameBuffer(); }
void RemoveLine(int LineNumber) { int i,j; int count=0; int Temp[COLS]; for(i=0; i<COLS; i++) { Temp[i]=ScreenLayout[i][LineNumber]; //assign value to temp } for(j=0; j<10; j++) { for(i=0; i<COLS; i++) //for dazzling filled line { ScreenLayout[i][LineNumber]=(count ? Temp[i] : BLANK); //if count value 0 set temp value else set 0 to ScreenLayout } count = !count; //reverse count value UpdateScreen(); delay(50); } for(i=LineNumber; i>0; i--) for(j=0; j<COLS; j++) { ScreenBackgroundLayout[j][i] = ScreenBackgroundLayout[j][i-1]; //move down all blocks to fill the blank space } for(j=0; j<COLS; j++) ScreenBackgroundLayout[j][0] = BLANK; //assign value 0 to top most line for(i=0; i<COLS; i++) for(j=0; j<ROWS; j++) ScreenLayout[i][j] = ScreenBackgroundLayout[i][j]; //assign value to ScreenLayout for display ++LinesCleared; PrintLinesCleared(); if(!(LinesCleared % 20)) //if 20 line cleared increase speed IncreaseSpeed(); }
void CChronosceptor::WeaponIdle( void ) { UpdateScreen(); if ( gpGlobals->time >= m_flShockTime ) { EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_WEAPON, "weapons/chronosceptor_idle.wav", 0.9, ATTN_NORM ); m_flShockTime = gpGlobals->time +1.6; } if (m_flTimeWeaponIdle > gpGlobals->time) return; if (m_fInAttack==1) { StartFire(); m_fInAttack = 0; return; } else if (m_fInAttack==2) { DisarmClip(); m_fInAttack = 0; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.6; return; } switch (RANDOM_LONG(0,1)) { case 0: SendWeaponAnim( CHRONO_IDLE ); break; case 1: SendWeaponAnim( CHRONO_IDLE2 ); break; } m_flTimeWeaponIdle = gpGlobals->time + RANDOM_FLOAT ( 10, 15 ); }
/* If one or two player will collide, this function will call another function for winning/losing animation. Check Collision Resets game if collision detected Draw Box of black to wipe game screen Else Update Player Positions Update Screen */ void UpdateGame( struct Player* Player1, struct Player* Player2, int** Grid, int *GameStatus, alt_up_pixel_buffer_dma_dev* pixel_buffer) { int terminate =0; //=========================================================== // Check Collision terminate = CheckPlayerCollision( Player1, Player2, Grid); if (terminate != 0){ //=========================================================== // If collision detected *GameStatus = 0; GameReset(Player1, Player2, Grid); //=========================================================== // Draws black box to clear the positions alt_up_pixel_buffer_dma_draw_box(pixel_buffer, 150, 45, 299, 194, 0, 0); // Display win or lose } else{ //=========================================================== // Updating the grid UpdatePositions( Player1, Player2, Grid); //=========================================================== // Draw pixels where the players are UpdateScreen(Player1, Player2, pixel_buffer); } }
void CGeneral::DrawDotBar(int x, int y, bool anim) { SDL_Rect dstrect, dstrect2; dstrect.x = x; dstrect2.x = 359; dstrect.w = dstrect2.w = 20; if (anim) { int i; for (i = 0; i < 20; i++) { dstrect.y = y + (20 - i) * 85 / 40; dstrect2.y = 531 + (20 - i) * 85 / 40; dstrect.h = dstrect2.h = i * 85 / 20; SDL_BlitSurface(m_imgTiles, &dstrect2, gpScreen, &dstrect); UpdateScreen(dstrect.x, dstrect.y, dstrect.w, dstrect.h); UTIL_Delay(10); } } dstrect.h = dstrect2.h = 85; dstrect.y = y; dstrect2.y = 531; SDL_BlitSurface(m_imgTiles, &dstrect2, gpScreen, &dstrect); }
TBool CWsBackedUpWindow::CommandL(TInt aOpcode, TWsWinCmdUnion &aCmd) { switch(aOpcode) { case EWsWinOpUpdateBackupBitmap: break; case EWsWinOpMaintainBackup: break; case EWsWinOpBitmapHandle: SetReply(iBitmap->Handle()); break; case EWsWinOpUpdateScreen: { TRegionFix<1> fixRegion(iWsWin->AbsRect()); UpdateScreen(fixRegion); } break; case EWsWinOpUpdateScreenRegion: { RWsRegion *clientRegion=NULL; TRAPD(err,clientRegion=GetRegionFromClientL(iWsWin->WsOwner(), *aCmd.Int)); if (err==KErrNone && !clientRegion->CheckError()) { clientRegion->Offset(iWsWin->Origin()); clientRegion->ClipRect(iWsWin->AbsRect()); UpdateScreen(*clientRegion); } else { TRegionFix<1> fixRegion(iWsWin->AbsRect()); UpdateScreen(fixRegion); } clientRegion->Destroy(); } break; case EWsWinOpSetBackgroundSurface: case EWsWinOpSetBackgroundSurfaceConfig: case EWsWinOpGetBackgroundSurfaceConfig: OwnerPanic(EWservPanicDrawable); // Backed up windows don't support these break; default: return(EFalse); } return(ETrue); }
/* ================ idCommonLocal::DemoShot A demoShot is a single frame demo ================ */ void idCommonLocal::DemoShot( const char *demoName ) { StartRecordingRenderDemo( demoName ); // force draw one frame const bool captureToImage = false; UpdateScreen( captureToImage ); StopRecordingRenderDemo(); }
/***************************************************************************** * End: terminate omap framebuffer video thread output method *****************************************************************************/ static void End( vout_thread_t *p_vout ) { /* Clear the screen */ UpdateScreen( p_vout, 0, 0, p_vout->p_sys->fb_vinfo.xres, p_vout->p_sys->fb_vinfo.yres, p_vout->p_sys->fb_vinfo.xres, p_vout->p_sys->fb_vinfo.yres, OMAPFB_COLOR_RGB565 ); }
void CAdapterPage::OnShowWindow(BOOL bShow, UINT nStatus) // OnShowWindow with bShow set to TRUE is done before the call to the page losing the focus ///////////////////////////////////////////////////////////////////////////// { ULONG ulValue; CPropertyPage::OnShowWindow(bShow, nStatus); if( bShow ) { if( !m_pHalAdapter->IsOpen() ) return; m_pHalMixer->GetControl( LINE_ADAPTER, LINE_NO_SOURCE, CONTROL_AIN12_TRIM, 0, &ulValue ); CheckRadioButton( IDC_TRIM_AIN12_PLUS4, IDC_TRIM_AIN12_MINUS10, IDC_TRIM_AIN12_PLUS4 + ulValue ); m_pHalMixer->GetControl( LINE_ADAPTER, LINE_NO_SOURCE, CONTROL_AIN34_TRIM, 0, &ulValue ); CheckRadioButton( IDC_TRIM_AIN34_PLUS4, IDC_TRIM_AIN34_MINUS10, IDC_TRIM_AIN34_PLUS4 + ulValue ); m_pHalMixer->GetControl( LINE_ADAPTER, LINE_NO_SOURCE, CONTROL_AOUT12_TRIM, 0, &ulValue ); CheckRadioButton( IDC_TRIM_AOUT12_PLUS4, IDC_TRIM_AOUT12_MINUS10, IDC_TRIM_AOUT12_PLUS4 + ulValue ); m_pHalMixer->GetControl( LINE_ADAPTER, LINE_NO_SOURCE, CONTROL_AOUT34_TRIM, 0, &ulValue ); CheckRadioButton( IDC_TRIM_AOUT34_PLUS4, IDC_TRIM_AOUT34_MINUS10, IDC_TRIM_AOUT34_PLUS4 + ulValue ); m_pHalMixer->GetControl( LINE_ADAPTER, LINE_NO_SOURCE, CONTROL_DIGITAL_FORMAT, 0, &ulValue ); CheckRadioButton( IDC_DF_AESEBU, IDC_DF_SPDIF, IDC_DF_AESEBU + ulValue ); m_pHalMixer->GetControl( LINE_ADAPTER, LINE_NO_SOURCE, CONTROL_DITHER_TYPE, 0, &ulValue ); CheckRadioButton( IDC_DITHERTYPE_NONE, IDC_DITHERTYPE_RECTANGULAR, IDC_DITHERTYPE_NONE + ulValue ); UpdateSampleClock(); BYTE ucData; m_pHalAdapter->IORead( kOptionIOControl, &ucData ); CheckRadioButton( IDC_LS1_FCKDIR_OUT, IDC_LS1_FCKDIR_IN, (ucData & IO_OPT_OPBFCKDIR) ? IDC_LS1_FCKDIR_IN : IDC_LS1_FCKDIR_OUT ); CheckRadioButton( IDC_LS2_FCKDIR_OUT, IDC_LS2_FCKDIR_IN, (ucData & IO_OPT_OPHFCKDIR) ? IDC_LS2_FCKDIR_IN : IDC_LS2_FCKDIR_OUT ); CheckRadioButton( IDC_LS2_OUTPUT18, IDC_LS2_OUTPUT916, (ucData & IO_OPT_OPHBLKSEL) ? IDC_LS2_OUTPUT916 : IDC_LS2_OUTPUT18 ); CheckRadioButton( IDC_LS2_HD1DIR_OUT, IDC_LS2_HD1DIR_IN, (ucData & IO_OPT_OPHD1DIR) ? IDC_LS2_HD1DIR_IN : IDC_LS2_HD1DIR_OUT ); CheckRadioButton( IDC_LS2_HD2DIR_OUT, IDC_LS2_HD2DIR_IN, (ucData & IO_OPT_OPHD2DIR) ? IDC_LS2_HD2DIR_IN : IDC_LS2_HD2DIR_OUT ); CheckRadioButton( IDC_LS2_HDINSEL_HD1, IDC_LS2_HDINSEL_HD2, (ucData & IO_OPT_OPHDINSEL) ? IDC_LS2_HDINSEL_HD2 : IDC_LS2_HDINSEL_HD1 ); m_pHalAdapter->IORead( kMisc, &ucData ); //((CButton *)GetDlgItem( IDC_VIDEN ))->SetCheck( ucData & IO_MISC_VIDEN ? TRUE : FALSE ); ((CButton *)GetDlgItem( IDC_TCRX_ENABLE ))->SetCheck( m_pHalAdapter->GetTCRx()->IsRunning() ); ((CButton *)GetDlgItem( IDC_TCTX_ENABLE ))->SetCheck( m_pHalAdapter->GetTCTx()->IsRunning() ); theApp.m_nPage = PAGE_ADAPTER; m_ulDigitalInStatus = -1; UpdateScreen(); } }
void CGeneral::Fire() { int i; SDL_Surface *save = SDL_CreateRGBSurface(gpScreen->flags & (~SDL_HWSURFACE), 575, 130, gpScreen->format->BitsPerPixel, gpScreen->format->Rmask, gpScreen->format->Gmask, gpScreen->format->Bmask, gpScreen->format->Amask); SDL_Rect dstrect; dstrect.x = 5; dstrect.y = 470 - 130; dstrect.w = 575; dstrect.h = 130; SDL_BlitSurface(gpScreen, &dstrect, save, NULL); UTIL_Delay(400); PlaySound(SND_FIRE); for (i = 0; i < 6; i++) { dstrect.y = 470 - 125; dstrect.h = 125; SDL_BlitSurface(m_imgFire1, NULL, gpScreen, &dstrect); UpdateScreen(0, 470 - 130, 575, 130); UTIL_Delay(100); dstrect.y = 470 - 130; dstrect.h = 130; SDL_BlitSurface(save, NULL, gpScreen, &dstrect); SDL_BlitSurface(m_imgFire2, NULL, gpScreen, &dstrect); UpdateScreen(0, 470 - 130, 575, 130); UTIL_Delay(100); SDL_BlitSurface(save, NULL, gpScreen, &dstrect); } UpdateScreen(0, 470 - 130, 575, 130); SDL_FreeSurface(save); UTIL_Delay(100); }
DSWindow::DSWindow(NativeWindowHandle h_wnd, DSScreen& s_up, DSScreen& s_dn, GUIHost& h) : Window(h_wnd, h), scr_up(s_up), scr_dn(s_dn) { # if YCL_Win32 yunseq( MessageMap[WM_DESTROY] += []{ YSLib::PostQuitMessage(0); // NOTE: Try to make sure all shells are released before destructing the // instance of %DSApplication. }, MessageMap[WM_PAINT] += [this]{ GSurface<WindowRegionDeviceContext> sf(Nonnull(GetNativeHandle())); const auto& r(sf.GetInvalidatedArea()); UpdateScreen(sf, scr_up, r); UpdateScreen(sf, scr_dn, r); } ); Show(); # endif }
void DoCredits() { #define HGHT 30 char *text[]={ "Arcomage v" ARCOVER, "by STiCK and GreatEmerald (2005-2009)", "", "This program was originally created", "as Individual Software Project", "at Charles University", "Prague, Czech Republic", "", "Since 2009 it became easier to access", "and its development was continued.", "", "http://stick.gk2.sk/projects/arcomage/", "", "This is a clone of Arcomage, a card game", "originally released by New World Computing", "and the 3DO Company as a part of", "Might and Magic VII: For Blood and Honor", "and re-released in 2001 as a stand-alone", "application.", "Since it didn't support any kind of", "modifications, this open source project", "aims to completely remake the original", "and make it more flexible.", "", "Original credits follow.", "", NULL }; int i,ypos=resY; BFont_SetCurrentFont(bigfont); while (event.type!=SDL_KEYDOWN || event.key.keysym.sym!=SDLK_ESCAPE) { Blit(CREDITS,SCREEN); i=0; while (text[i]) { if (ypos+i*HGHT>=-20 && ypos+i*HGHT<=resX) BFont_CenteredPutString(GfxData[SCREEN],ypos+i*HGHT,text[i]); i++; } UpdateScreen(); SDL_Delay(20); ypos--; SDL_PollEvent(&event); } BFont_SetCurrentFont(font); }
int EventLoop() { MSG msg; while (1) { if (PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE)) { if (!GetMessage(&msg, 0, 0, 0)) { return msg.wParam; } TranslateMessage(&msg); DispatchMessage(&msg); UpdateScreen(); } else WaitMessage(); } }
int DispatchLoop() { SPW_InputDispatchStruct dispatch_data; XEvent xevent; SPW_InputEvent spwevent; int done = FALSE; /* * Set up the callback struct */ SPW_InputInitDispatchStruct(&dispatch_data); dispatch_data.display = Spw_Dpy; dispatch_data.spwbw = Spw_ButtonWindow; dispatch_data.xevent = &xevent; dispatch_data.spwevent = &spwevent; dispatch_data.handle_motion = SpwMotionEvent; dispatch_data.handle_bpress = SpwButtonPressEvent; dispatch_data.handle_brelease = SpwButtonReleaseEvent; dispatch_data.delay = 1; /* * Loop, process events as possible Button Window, Spaceball, or app */ while(!done) { if(!XPending(Spw_Dpy) && Spw_Redraw) { Spw_Redraw=FALSE; UpdateScreen(); } XNextEvent(Spw_Dpy, &xevent); SPW_BwHandleEvent(Spw_ButtonWindow, &xevent); if(SPW_InputIsSpaceballEvent(Spw_Dpy, &xevent, &spwevent)) { SPW_InputDispatch(&dispatch_data); } else { Spw_Redraw|=HandleXEvent(&xevent, &done); } } return done; } /* end of DispatchLoop */
VOID ClkPaint (HWND hwnd) { RECTL rclUpdate; HPS hpsWnd; if (cp.usDispMode & DM_ANALOG) { WinBeginPaint (hwnd, hps, &rclUpdate); GpiCreateLogColorTable (hps, 0L, LCOLF_RGB, 0L, 0L, (PLONG)NULL); WinFillRect (hps, &rclUpdate, cp.clrBackground); if (fBufferDirty) { DrawClock (hpsBuffer); fBufferDirty = FALSE; } UpdateScreen (hps, &rclUpdate); /* * Draw the second hand last, so xor will work. */ if (fShowSecondHand && (cp.usDispMode & DM_SECONDHAND)) ClkDrawHand(hps, HT_SECOND, dt.seconds); WinEndPaint (hps); } else { /*For now, if it is not Analog, it must be digital*/ hpsWnd = WinBeginPaint (hwnd, NULLHANDLE, &rclUpdate); GpiCreateLogColorTable(hpsWnd, 0L, LCOLF_RGB, 0L, 0L, (PLONG) NULL); WinFillRect (hpsWnd, &rclUpdate, cp.clrBackground); memset (achOldTime, 0, sizeof(achOldTime)); memset (achOldAmPm, '0', sizeof(achOldAmPm)); memset (achOldDate, '0', sizeof(achOldDate)); DrawDigitalTime (hwnd); WinEndPaint (hpsWnd); } }
/* ================ idCommonLocal::AVIRenderDemo ================ */ void idCommonLocal::AVIRenderDemo( const char *_demoName ) { idStr demoName = _demoName; // copy off from va() buffer StartPlayingRenderDemo( demoName ); if ( !readDemo ) { return; } BeginAVICapture( demoName.c_str() ) ; // I don't understand why I need to do this twice, something // strange with the nvidia swapbuffers? const bool captureToImage = false; UpdateScreen( captureToImage ); }
void CGeneral::DrawText(const char *t, int x, int y, int r, int g, int b, int size) { SDL_Surface *s = m_fnt.Render(t, r, g, b, size); SDL_Rect dstrect; dstrect.x = x; dstrect.y = y; dstrect.w = s->w; dstrect.h = s->h; SDL_BlitSurface(s, NULL, gpScreen, &dstrect); SDL_FreeSurface(s); UpdateScreen(x, y, dstrect.w, dstrect.h); }
//============================================================================= int EventLoop() { static unsigned short _usCnt = 0; register MSG msg; while( 1 ) { if( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) { if( !GetMessage( &msg, NULL, 0, 0 ) ) { return msg.wParam; } TranslateMessage(&msg); DispatchMessage(&msg); UpdateScreen(); } else WaitMessage(); } }
// This is my primary Event Loop. This is where most of the fun stuff happens ;) void Megamaniac() { // WTF does this do? Something to do with my Data Structure I assume... Game game; while (true) { // Let's run our initial setup to get everything for the game ready. SetupGame(&game); // Do we need to change the level? Not really but we should probably start at Level 1. ChangeLevel(&game); // This is where the Event Loop actually starts. This will run repeatedly until our game is over. while (!game.game_over) { clear_screen(); GameStats(&game); int userInput = UserInput(&game); MovementPlayer(&game, userInput); MovementMissiles(&game, userInput); MovementAliens(&game); MovementBombs(&game); MovementBonuses(&game); CollisionMissiles(&game); CollisionAliens(&game); CollisionBombs(&game); CollisionBonuses(&game); UpdateScreen(&game); show_screen(); timer_pause(25); } GameOver(&game); int userInput = wait_char(); while (userInput != 'r' && userInput >= 0) { if (userInput == 'q') { exit(0); } if (userInput == 'r') { Megamaniac(); } userInput = wait_char(); } } }
/****************************************************************\ * Name:ClkTimer() * * Purpose: Handles window timer events * Returns: * 1 - if sucessful execution completed * 0 - if error \****************************************************************/ VOID ClkTimer (HWND hwnd) { /* if we must move the hour and minute hands, redraw it all */ if (dtNew.minutes != dt.minutes) { ClkDrawFace(hpsBuffer); ClkDrawDate(hpsBuffer, DM_REDRAW); ClkDrawHand(hpsBuffer, HT_HOUR_SHADE, dtNew.hours); ClkDrawHand(hpsBuffer, HT_MINUTE_SHADE, dtNew.minutes); ClkDrawHand(hpsBuffer, HT_HOUR, dtNew.hours); ClkDrawHand(hpsBuffer, HT_MINUTE, dtNew.minutes); UpdateScreen (hps, NULL); } }
void CGeneral::DrawCard(const CCard &c, int x, int y, int w, int h, bool update) { SDL_Surface *p = RenderCard(c, w, h); SDL_Rect dstrect; dstrect.x = x; dstrect.y = y; dstrect.w = w; dstrect.h = h; SDL_BlitSurface(p, NULL, gpScreen, &dstrect); SDL_FreeSurface(p); if (update) { UpdateScreen(x, y, dstrect.w, dstrect.h); } }
//------------------------------------------------------------ ExperimentGraphics() // static void ExperimentGraphics(Uint32 time_inc) { switch(g_trial_state) { case TRIAL_STATE_TAKE_A_REST://///////////////////////////////////////// ShowBackground(RGB_Grey); //ShowMessage(); break; case TRIAL_STATE_INTER_TRIAL://///////////////////////////////////////// ShowBackground(RGB_Black); //ShowMessage(); break; case TRIAL_STATE_INTER_FIX_CUE: case TRIAL_STATE_INTER_CUE_FIX: ShowBackground(RGB_Black); break; case TRIAL_STATE_INIT_FIXATION:///////////////////////////////////////// ShowFixation(); break; case TRIAL_STATE_SHOW_CUE:////////////////////////////////////////////// ShowCue(); //ShowFixation(); break; case TRIAL_STATE_RETURN_FIXATION://///////////////////////////////////// ShowBackground(RGB_Black); ShowFixation(); break; case TRIAL_STATE_SHOW_TARGET://///////////////////////////////////////// ShowTarget(); ShowFixation(); break; default: exit(APPERROR); break; } UpdateScreen(); }
IdleScreen::IdleScreen(MythScreenStack *parent) :MythScreenType(parent, "standbymode"), m_updateScreenTimer(new QTimer(this)), m_statusState(nullptr), m_currentRecordings(nullptr), m_nextRecordings(nullptr), m_conflictingRecordings(nullptr), m_conflictWarning(nullptr), m_secondsToShutdown(-1), m_pendingSchedUpdate(false), m_hasConflicts(false) { gCoreContext->addListener(this); GetMythMainWindow()->EnterStandby(); connect(m_updateScreenTimer, SIGNAL(timeout()), this, SLOT(UpdateScreen())); m_updateScreenTimer->start(UPDATE_INTERVAL); }