void TimeFactorWidget::MouseWheel(int delta) { if (Core::mainInput.IsControlKeyDown()) { if (delta < 0) { Core::timeFactor.Decrease(); ShowTitle(); } else if (delta > 0) { Core::timeFactor.Increase(); ShowTitle(); } } }
void MusicPlayer::PlaySelected(QModelIndex index) { PlayList->setCurrentIndex(index.row()); if(Player->state() != QMediaPlayer::PlayingState) Play(); ShowTitle(); }
int _tmain(int argc, _TCHAR* argv[]) { JaimeChapinal me; me.SetEmail("*****@*****.**"); me.SetWeb("www.jaimechapinal.com"); me.SetTelephone("678-97-57-76"); me.SetStudies(); me.SetPublications(); me.SetJobs(); me.SetGames(); me.SetSkills(); ShowTitle(me); bool bExit = false; int iOption = -1; while (!bExit) { ShowMainMenu(); iOption = ReadInput(); switch (iOption) { case 1: //Personal data ShowPersonalData(me); break; case 2: //Studies data ShowStudiesData(me.GetStudies()); break; case 3: //Professional data ShowPublications(me.GetPublications()); break; case 4: //Professional data ShowProfessionalData(me.GetJobs()); break; case 5: //Games ShowGames(me.GetGames()); break; case 6: //Skills ShowSkills(me.GetSkills()); break; case 0: //Exit bExit = true; break; default: std::cout << "Invalid option. Please, try again. " << std::endl; std::cout << std::endl; break; } } std::cout << std::endl; std::cout << "Thanks for your time! =) " << std::endl; getch(); return 0; }
void MusicPlayer::Next() { int tmp = PlayList->currentIndex()+1; if(tmp>=ui->playlist->count()) { PlayList->setCurrentIndex(0); } else { PlayList->next(); } ShowTitle(); }
void MusicPlayer::Prev() { int tmp = PlayList->previousIndex(); if(tmp < 0) { PlayList->setCurrentIndex(ui->playlist->count()-1); } else { PlayList->previous(); } ShowTitle(); }
void MusicPlayer::Play() { if(Player->state()!=QMediaPlayer::PlayingState) { Player->play(); ui->LengthSlider->setMaximum(Player->duration()); ui->button_start->setIcon(QIcon(":/new/prefix1/icons/pause.png")); ShowTitle(); } else { Player->pause(); ui->button_start->setIcon(QIcon(":/new/prefix1/icons/play.png")); } }
void CGuiTabWnd::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default CWnd::OnLButtonDown(nFlags, point); for (int iCont=0; iCont< m_Numtabs;iCont++) { CGuiTab* ct=(CGuiTab*) m_pArray[iCont]; if (ct->rect.PtInRect(point) != 0) { SetCurtab(iCont); ShowTitle(ct->lpMsg); return; } } }
void Game::GameLoopIteration() { sf::Event currentEvent; m_mainWindow.pollEvent(currentEvent); switch(m_gameState) { case eShowingSplash: { ShowSplashScreen(); break; } case eShowingTitle: { ShowTitle(); break; } case ePlaying: { m_mainWindow.clear(sf::Color(0, 0, 0)); sf::RenderStates state; m_gameObjectManager.DrawAll(m_mainWindow, state); m_mainWindow.display(); if(currentEvent.type == sf::Event::Closed) { m_gameState = eExiting; } break; } } }
int main(int argc, char *argv[]) { // Initialize the SDL library // This is required to avoid _main errors at runtime. #ifdef UseSDLMixer if ( SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0 ) { #else if ( SDL_Init(SDL_INIT_VIDEO ) < 0 ) { #endif fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError()); exit(1); } // Init SDL_Image - only applies above 1.2.7 // load support for the JPG and PNG image formats int IMGflags=IMG_INIT_JPG|IMG_INIT_PNG; int initted=IMG_Init(IMGflags); if(initted && IMGflags != IMGflags) { printf("IMG_Init: Failed to init required jpg and png support!\n"); printf("IMG_Init: %s\n", IMG_GetError()); // handle error } #ifdef UseSDLMixer // Initialize SDL mixer. if(Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 1024) != 0) { fprintf(stderr, "Unable to initialize audio: %s\n", Mix_GetError()); exit(1); } #endif // Retrieve display gamma for reference in fade in/fade out routines. SDL_GetGammaRamp(redGamma, greenGamma, blueGamma); // printf("%u", *redGamma); Initialize( ); LoadPrefs( ); ReserveMonitor( ); ShowTitle( ); ChooseMusic( 13 ); while( !finished ) { if( showStartMenu ) { GameStartMenu( ); showStartMenu = false; } if( !finished ) { DoFullRepaint = NeedRefresh; CheckKeys( ); HandlePlayers( ); UpdateOpponent( ); UpdateBalloon( ); UpdateSound( ); DoFullRepaint = NoPaint; if( needsRefresh ) { RefreshAll(); needsRefresh = false; } if( !showStartMenu && pauseKey ) { FreezeGameTickCount( ); PauseMusic( ); MaskRect( &playerWindowRect[0] ); MaskRect( &playerWindowRect[1] ); WaitForRelease( ); HandleDialog( kPauseDialog ); WaitForRelease( ); RefreshPlayerWindow( 0 ); RefreshPlayerWindow( 1 ); ResumeMusic( ); UnfreezeGameTickCount( ); } } } SavePrefs( ); ReleaseMonitor( ); return 0; } void NoPaint( void ) { } void MaskRect( MRect *r ) { SDL_Rect sdlRect; SDLU_MRectToSDLRect( r, &sdlRect ); SDLU_BlitFrontSurface( backdropSurface, &sdlRect, &sdlRect ); }
int main(int argc, char **argv) { TextStartup(); ShowTitle(); // skip program name itself argv++, argc--; if (argc <= 0) { ShowInfo(); TextShutdown(); exit(1); } if (strcmp(argv[0], "/?") == 0 || strcmp(argv[0], "-h") == 0 || strcmp(argv[0], "-help") == 0 || strcmp(argv[0], "--help") == 0 || strcmp(argv[0], "-HELP") == 0 || strcmp(argv[0], "--HELP") == 0) { ShowOptions(); TextShutdown(); exit(1); } BuildArgumentList(argc, argv); info = default_buildinfo; comms = default_buildcomms; if (GLBSP_E_OK != GlbspParseArgs(&info, &comms, resp_argv, resp_argc)) { TextFatalError("Error: %s\n", comms.message ? comms.message : "(Unknown error when parsing args)"); } #if 0 if (! FileExists(info.filename)) TextFatalError("Error: Cannot find WAD file: %s\n", info.filename); #endif /* process file */ if (GLBSP_E_OK != GlbspCheckInfo(&info, &comms)) { TextFatalError("Error: %s\n", comms.message ? comms.message : "(Unknown error when checking args)"); } if (info.no_progress) TextDisableProgress(); if (GLBSP_E_OK != GlbspBuildNodes(&info, &cmdline_funcs, &comms)) { TextFatalError("Error: %s\n", comms.message ? comms.message : "(Unknown error during build)"); } TextShutdown(); FreeArgumentList(); return 0; }
int computeFS () { uint refresh = 2,key; int index = 0,i,hcs; char ch; double ht,hz,v,bh,hd; double value[4] = {0.0,0.0,0.0,0.0}; const char * context[] = {"","","",""}; while(1){ if (refresh == REFRESH_ALL){ refresh = REFRESH_PART; Bdisp_AllClr_VRAM(); SetMyFont(&stHz12x12,&stAsc6x12); //¶¨Òå×ÖÌå´óС DispStr(2,1, "Ïß "); DispStr(2,12,"· "); DispStr(2,25,"·´ "); DispStr(2,38,"Ëã "); ShowTitle(TITLE); DispStr(17,0, "×ø±êX: "); DispStr(17,13,"×ø±êY: "); DispStr(17,26,"×ø±êZ: "); //DispStr(17,39,"×ø±êZ: "); for (i=0;i<4;++i){ PrintXY(50,2+i*12,(uchar*)context[i],0); } PrintIcon (0,"Rou",0); PrintIcon (1,"Set",0); PrintIcon (2,"Disp",0); PrintIcon (3,"=0=",1); PrintIcon (4,"Save",1); PrintIcon (5,"?",0); } if (refresh == REFRESH_PART){ for (i=0;i<4;++i){ PrintFloat(value[i],48,0+i*12,index==i,4); //ÊäÈë¿òλÖà } refresh = 0; } GetKey(&key); switch(key){ case KEY_CTRL_F1 : SET(); refresh=REFRESH_ALL; break; case KEY_CTRL_F2 : ZSSET(); refresh=REFRESH_ALL; break; case KEY_CTRL_F3 : RestoreDisp(SAVEDISP_PAGE1);refresh=REFRESH_ALL;WaitKey();break; case KEY_CTRL_F4 : case KEY_CTRL_F5 : Nodata(); refresh=REFRESH_ALL; break; case KEY_CTRL_F6 : About(); refresh=REFRESH_ALL; break; case KEY_CTRL_UP : refresh=REFRESH_PART; --index; break; case KEY_CTRL_DOWN : refresh=REFRESH_PART; ++index; break; case KEY_CTRL_EXE: if (index<3){ refresh = REFRESH_PART; index++; }else{ yscs.x1 = value[0]; yscs.y1 = value[1]; hz = value[2]; ht = value[3]; refresh=REFRESH_ALL; //yscs.k=0.0; yscs.k=xy_to_sdSrd( yscs.x1, yscs.y1, 0); yscs.d=xy_to_sdSrd( yscs.x1, yscs.y1, 1); //yscs.k=xy_to_sd( yscs.x1, yscs.y1, 0); //yscs.d=xy_to_sd( yscs.x1, yscs.y1, 1); //FS(); GC(); HP(); if (yscs.d<0) hcs=-1; //Æ«¾à×ó²à if (yscs.d>=0) hcs=1; //Æ«¾àÓÒ²à if (yscs.d*hcs<=zfset.zsp) hd=0; // if (zfset.zsh==0) hd=0; if (yscs.d*hcs>zfset.zsp && yscs.d*hcs-zfset.zsp<zfset.zsh) hd=(yscs.d*hcs-zfset.zsp)*hcs; if (yscs.d*hcs-zfset.zsp>=zfset.zsh) hd=zfset.zsh*hcs; bh=yscs.gch+(yscs.hpd*hd)-ht; Bdisp_AllClr_VRAM(); DispStr(2,0, "¼Æ "); DispStr(2,12,"Ëã "); DispStr(2,26,"½á "); DispStr(2,39,"¹û "); ShowTitle(TITLE); DispStr(17,0,"×®ºÅ "); DispStr(17,13,"Æ«¾à "); DispStr(17,26,"ÌîÍÚ: "); DispStr(17,39,"»ù¸ß: "); PrintfXY (48,2.5,0,"%.4f",yscs.k); PrintfXY (48,15,0,"%.4f",yscs.d); PrintfXY (48,28,0,"%.4f",yscs.gch); PrintfXY (48,42,0,"%.4f",yscs.hpd); //PrintfXY (22,40,0," H= %.3f",bh); //PrintfXY (22,48,0," H-Z= %.3f",hz-bh); SaveDisp(SAVEDISP_PAGE1); WaitKey(); ++index; }break; case KEY_CTRL_EXIT: return 0; default: if ((ch=GetPressNumChar(key))!=0){ char buf[14]; int r; refresh = REFRESH_PART; buf[0] = ch; buf[1] = '\0'; r = InputString (48,0+index*12,buf,0,12); //ÊäÈë¿òλÖà if (r != KEY_CTRL_EXIT){ value[index] = atof(buf); if (r==KEY_CTRL_DOWN) ++index; if (r==KEY_CTRL_UP) --index; if (r==KEY_CTRL_EXE && index<3) ++index; } break; } } if (index >=4) index = 2; if (index < 0) index = 3; } }
AMI_ILBM_Action AMI_ILBM_handleScreenActions(char **filename) { AMI_ILBM_Action action = ACTION_ERROR; int showTitleStatus = TRUE; while(action == ACTION_ERROR) { struct IntuiMessage *msg; /* Wait for a message from the window's user port */ Wait(1 << viewerDisplay.window->UserPort->mp_SigBit); /* Handle all the messages stored in the message queue */ while((msg = (struct IntuiMessage*)GetMsg(viewerDisplay.window->UserPort)) != NULL) { UWORD menuSelection; switch(msg->Class) { case IDCMP_MENUPICK: /* Handle menu events */ menuSelection = msg->Code; if(menuSelection != MENUNULL) { UWORD menuNum = MENUNUM(menuSelection); /* Retrieve the number of the menu of the selected menu item */ UWORD itemNum = ITEMNUM(menuSelection); /* Retrieve the number of the menuitem in the selected menu */ /* Determine which action to execute */ if(menuNum == 0) { switch(itemNum) { case 0: *filename = AMI_ILBM_openILBMFile(viewerDisplay.window, ""); if(*filename != NULL) action = ACTION_OPEN; break; case 1: action = ACTION_PREVIOUS; break; case 2: action = ACTION_NEXT; break; case 3: showTitleStatus = !showTitleStatus; ShowTitle(viewerDisplay.image.intuitionScreen, showTitleStatus); break; case 4: viewerDisplay.cycleModeEnabled = !viewerDisplay.cycleModeEnabled; break; case 5: action = ACTION_QUIT; break; } } } break; } /* Reply the message, so that it's removed from the message queue */ ReplyMsg((struct Message*)msg); } } /* Return the resulting action from the user */ return action; }
int main(void) { for(;;) { ShowTitle(); cout << "Input test item: "; char Choise[32] = {0}; cin >> Choise; int iChoise = atoi(Choise); cout << endl << endl << "------------------------------------------------" << endl; switch(iChoise) { case RC2TESTCHOISE: { SysKeyTest test; cout << "RC2 test:" << endl; test.TestKey(TEST_RC2_ALG); cout << "RC2 test finish!" << endl; } break; case RC4TESTCHOISE: { SysKeyTest test; cout << "RC4 test:" << endl; test.TestKey(TEST_RC4_ALG); cout << "RC4 test finish!" << endl; } break; case DESTESTCHOISE: { SysKeyTest test; cout << "DES test:" << endl; test.TestKey(TEST_DES_ALG); cout << "Test DES key finish!" << endl; } break; case AESTESTCHOISE: { SysKeyTest test; cout << "AES test:" << endl; test.TestKey(CALG_AES_128); cout << "Test AES key finish!" << endl; } break; case DERIVERC4KEYTESTCHOISE: { DeriveKeyTest derkeytest; cout << "Derive RC4 test:" << endl; derkeytest.Testkey(TEST_RC4_ALG); cout << "Test Derive RC4 key finish!" << endl; } break; case DERIVEDESKEYTESTCHOISE: { DeriveKeyTest derkeytest; cout << "Derive DES test:" << endl; derkeytest.Testkey(TEST_DES_ALG); cout << "Test derive des key finish!" << endl; } break; case DERIVEAESKEYTESTCHOISE: { DeriveKeyTest derkeytest; cout << "Derive AES test:" << endl; derkeytest.Testkey(CALG_AES_128); cout << "Test derive des key finish!" << endl; } break; case RSACHOISE: { CRSA rsaTest; cout << "RSA test:" << endl; rsaTest.TestRSA(); cout << "Test RSA key pair finish!" << endl; } break; case GETPROVPARAM: cout << "Get CSP Parameters:" << endl; GetProvParam(); cout << "Get CSP Parameters finish!" << endl; break; case TEST_EXIT: //cout << "Press any key to exit..." << endl; return 0; } cout << endl; } return 0; }
int _glfwPlatformOpenWindow( int width, int height, int redbits, int greenbits, int bluebits, int alphabits, int depthbits, int stencilbits, int mode, int accumredbits, int accumgreenbits, int accumbluebits, int accumalphabits, int auxbuffers, int stereo, int refreshrate ) { struct TagItem tagList[ 25 ]; int tagNR, accumbits; // Calculate sum of accumulator bits accumbits = accumredbits + accumgreenbits + accumbluebits + accumalphabits; // Clear window state _glfwWin.Screen = NULL; _glfwWin.Window = NULL; _glfwWin.Context = NULL; _glfwWin.PointerHidden = 0; _glfwWin.PointerSprite = NULL; _glfwWin.InputMP = NULL; _glfwWin.InputIO = NULL; // Create input.device message port if( !(_glfwWin.InputMP = CreatePort( NULL, 0 )) ) { _glfwPlatformCloseWindow(); return GL_FALSE; } // Create input.device I/O request if( !(_glfwWin.InputIO = (struct IOStdReq *) CreateExtIO( _glfwWin.InputMP, sizeof(struct IOStdReq) )) ) { _glfwPlatformCloseWindow(); return GL_FALSE; } // Open input.device (for pointer position manipulation) if( OpenDevice( "input.device", 0, (struct IORequest *)_glfwWin.InputIO, 0 ) ) { DeleteExtIO( (struct IORequest *) _glfwWin.InputIO ); _glfwWin.InputIO = NULL; _glfwPlatformCloseWindow(); return GL_FALSE; } // Do we want fullscreen? if( _glfwWin.Fullscreen ) { // Open a new Amiga screen if( !_glfwOpenScreen( &width, &height, &redbits, &greenbits, &bluebits, refreshrate ) ) { _glfwWin.Fullscreen = GL_FALSE; } } // Select window properties tagNR = 0; tagList[ tagNR ].ti_Tag = WA_Left; tagList[ tagNR++ ].ti_Data = 0; tagList[ tagNR ].ti_Tag = WA_Top; tagList[ tagNR++ ].ti_Data = 0; tagList[ tagNR ].ti_Tag = WA_IDCMP; tagList[ tagNR++ ].ti_Data = IDCMP_REFRESHWINDOW | IDCMP_CLOSEWINDOW | IDCMP_NEWSIZE | IDCMP_ACTIVEWINDOW | IDCMP_INACTIVEWINDOW | IDCMP_RAWKEY | IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS; tagList[ tagNR ].ti_Tag = WA_ReportMouse; tagList[ tagNR++ ].ti_Data = TRUE; tagList[ tagNR ].ti_Tag = WA_RMBTrap; tagList[ tagNR++ ].ti_Data = TRUE; tagList[ tagNR ].ti_Tag = WA_NoCareRefresh; tagList[ tagNR++ ].ti_Data = FALSE; tagList[ tagNR ].ti_Tag = WA_SimpleRefresh; tagList[ tagNR++ ].ti_Data = TRUE; tagList[ tagNR ].ti_Tag = WA_Activate; tagList[ tagNR++ ].ti_Data = TRUE; tagList[ tagNR ].ti_Tag = WA_CloseGadget; tagList[ tagNR++ ].ti_Data = _glfwWin.Fullscreen ? FALSE : TRUE; tagList[ tagNR ].ti_Tag = WA_SizeGadget; tagList[ tagNR++ ].ti_Data = _glfwWin.Fullscreen ? FALSE : ( _glfwWinHints.WindowNoResize ? FALSE : TRUE ); tagList[ tagNR ].ti_Tag = WA_DepthGadget; tagList[ tagNR++ ].ti_Data = _glfwWin.Fullscreen ? FALSE : TRUE; tagList[ tagNR ].ti_Tag = WA_DragBar; tagList[ tagNR++ ].ti_Data = _glfwWin.Fullscreen ? FALSE : TRUE; tagList[ tagNR ].ti_Tag = WA_Borderless; tagList[ tagNR++ ].ti_Data = _glfwWin.Fullscreen ? TRUE : FALSE; tagList[ tagNR ].ti_Tag = WA_Backdrop; tagList[ tagNR++ ].ti_Data = _glfwWin.Fullscreen ? TRUE : FALSE; if( _glfwWin.Fullscreen ) { tagList[ tagNR ].ti_Tag = WA_CustomScreen; tagList[ tagNR++ ].ti_Data = (ULONG) _glfwWin.Screen; tagList[ tagNR ].ti_Tag = WA_Width; tagList[ tagNR++ ].ti_Data = width; tagList[ tagNR ].ti_Tag = WA_Height; tagList[ tagNR++ ].ti_Data = height; } else { tagList[ tagNR ].ti_Tag = WA_GimmeZeroZero; tagList[ tagNR++ ].ti_Data = TRUE; tagList[ tagNR ].ti_Tag = WA_InnerWidth; tagList[ tagNR++ ].ti_Data = width; tagList[ tagNR ].ti_Tag = WA_InnerHeight; tagList[ tagNR++ ].ti_Data = height; tagList[ tagNR ].ti_Tag = WA_MinWidth; tagList[ tagNR++ ].ti_Data = 20; tagList[ tagNR ].ti_Tag = WA_MinHeight; tagList[ tagNR++ ].ti_Data = 20; tagList[ tagNR ].ti_Tag = WA_MaxWidth; tagList[ tagNR++ ].ti_Data = 9999; tagList[ tagNR ].ti_Tag = WA_MaxHeight; tagList[ tagNR++ ].ti_Data = 9999; tagList[ tagNR ].ti_Tag = WA_Title; tagList[ tagNR++ ].ti_Data = (ULONG) "GLFW Window"; tagList[ tagNR ].ti_Tag = WA_ScreenTitle; tagList[ tagNR++ ].ti_Data = (ULONG) "GLFW Application"; } tagList[ tagNR ].ti_Tag = TAG_DONE; // Open window _glfwWin.Window = OpenWindowTagList( NULL, tagList ); if( !_glfwWin.Window ) { _glfwPlatformCloseWindow(); return GL_FALSE; } // Fullscreen/windowed post fixups if( _glfwWin.Fullscreen ) { // Don't show screen title ShowTitle( _glfwWin.Screen, FALSE ); // Remember window size _glfwWin.Width = _glfwWin.Window->Width; _glfwWin.Height = _glfwWin.Window->Height; } else { // If we are not in fullscreen mode, get screen handle from window _glfwWin.Screen = _glfwWin.Window->WScreen; // Get ModeID for the current video mode _glfwWin.ModeID = GetVPModeID( &_glfwWin.Screen->ViewPort ); // Remember window size _glfwWin.Width = _glfwWin.Window->GZZWidth; _glfwWin.Height = _glfwWin.Window->GZZHeight; } // Put window on top WindowToFront( _glfwWin.Window ); // Create OpenGL context #ifdef _GLFW_STORMMESA tagNR = 0; tagList[ tagNR ].ti_Tag = AMA_Window; tagList[ tagNR++ ].ti_Data = (ULONG) _glfwWin.Window; tagList[ tagNR ].ti_Tag = AMA_RastPort; tagList[ tagNR++ ].ti_Data = (ULONG) _glfwWin.Window->RPort; tagList[ tagNR ].ti_Tag = AMA_Screen; tagList[ tagNR++ ].ti_Data = (ULONG) _glfwWin.Screen; tagList[ tagNR ].ti_Tag = AMA_Left; tagList[ tagNR++ ].ti_Data = 0; tagList[ tagNR ].ti_Tag = AMA_Bottom; tagList[ tagNR++ ].ti_Data = 0; tagList[ tagNR ].ti_Tag = AMA_Width; tagList[ tagNR++ ].ti_Data = _glfwWin.Width; tagList[ tagNR ].ti_Tag = AMA_Height; tagList[ tagNR++ ].ti_Data = _glfwWin.Height; tagList[ tagNR ].ti_Tag = AMA_DoubleBuf; tagList[ tagNR++ ].ti_Data = GL_TRUE; tagList[ tagNR ].ti_Tag = AMA_RGBMode; tagList[ tagNR++ ].ti_Data = GL_TRUE; tagList[ tagNR ].ti_Tag = AMA_AlphaFlag; tagList[ tagNR++ ].ti_Data = alphabits ? GL_TRUE : GL_FALSE; tagList[ tagNR ].ti_Tag = AMA_NoDepth; tagList[ tagNR++ ].ti_Data = depthbits ? GL_FALSE : GL_TRUE; tagList[ tagNR ].ti_Tag = AMA_NoStencil; tagList[ tagNR++ ].ti_Data = stencilbits ? GL_FALSE : GL_TRUE; tagList[ tagNR ].ti_Tag = AMA_NoAccum; tagList[ tagNR++ ].ti_Data = accumbits ? GL_FALSE : GL_TRUE; tagList[ tagNR ].ti_Tag = AMA_DirectRender; tagList[ tagNR++ ].ti_Data = GL_TRUE; tagList[ tagNR ].ti_Tag = AMA_DrawMode; tagList[ tagNR++ ].ti_Data = AMESA_AGA_C2P; tagList[ tagNR ].ti_Tag = TAG_DONE; _glfwWin.Context = AmigaMesaCreateContext( tagList ); #endif if( !_glfwWin.Context ) { _glfwPlatformCloseWindow(); return GL_FALSE; } // Make current #ifdef _GLFW_STORMMESA AmigaMesaMakeCurrent( _glfwWin.Context, _glfwWin.Context->buffer ); #endif return GL_TRUE; }
USHORT ECC_FTPGetFileShowStatus_S(STR *ip,STR *id,STR *pw,STR * Localfilename, STR * Remofilename,BYTE isSSL) { CURL *curl; CURLcode res; double filesize = 0.0; double totaltime = 0.0; BYTE statusline2[64]; struct FtpFile ftpfile={ "tmpfile", /* name to store the file as if succesful */ NULL }; CTOS_LCDSelectMode(d_LCD_TEXT_320x240_MODE); CTOS_LCDGClearCanvas(); ShowTitle(gTransTitle); ShowLine(0,40+16,Big_Font_Size,"資料下載中.",FALSE); ShowLine(0,40+40+16+10,Med_Font_Size,"下載進度",FALSE); curl_global_init(CURL_GLOBAL_DEFAULT); BYTE processstr[32]; USHORT ret= Eth_Connect(bgNETWORKChannel,ip,990); curl_socket_t sockfd=Socketfd; curl = curl_easy_init(); if(curl) { BYTE URL[128]; BYTE IDPW[64]; BYTE DNS[64]; BYTE *errstr; memset(URL,0x00,sizeof(URL)); sprintf(URL,"FTPS://%s%s",ip,Remofilename); memset(IDPW,0x00,sizeof(IDPW)); sprintf(IDPW,"%s:%s",id,pw); curl_easy_setopt(curl, CURLOPT_URL,URL); curl_easy_setopt(curl, CURLOPT_USERPWD,IDPW); /* Define our callback to get called when there's data to be written */ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_fwrite); /* Set a pointer to our struct to pass to the callback */ curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ftpfile); BYTE len=sizeof(DNS); USHORT ret = CTOS_EthernetConfigGet(d_ETHERNET_CONFIG_DNSIP, DNS,&len); curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); /* call this function to get a socket */ curl_easy_setopt(curl, CURLOPT_OPENSOCKETFUNCTION, opensocket); curl_easy_setopt(curl, CURLOPT_OPENSOCKETDATA, &sockfd); /* call this function to set options for the socket */ curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, sockopt_callback); curl_easy_setopt(curl, CURLOPT_BUFFERSIZE, 2024L); curl_easy_setopt(curl, CURLOPT_FTP_RESPONSE_TIMEOUT, 10); curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 3); curl_easy_setopt(curl, CURLOPT_TIMEOUT, 600); curl_easy_setopt(curl, CURLOPT_FTP_USE_EPSV, 0L); curl_easy_setopt(curl, CURLOPT_DNS_SERVERS, DNS); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL); curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L); curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, my_progress_func); /* Switch on full protocol/debug output */ curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); res = curl_easy_perform(curl); if(CURLE_OK != res) { /* we failed */ errstr=(char*)curl_easy_strerror(res); ErrorMessageBox(gTransTitle,"錯誤訊息",errstr,"","",d_MB_CHECK); SystemLog("ECC_FTPGetFile",errstr); return d_Fail; } res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &filesize); if((CURLE_OK == res) && (filesize>0.0)) { sprintf(statusline2,"filesize : %0.0f bytes\n", filesize); ShowLine(0,40+40+40+16+10,Med_Font_Size,statusline2,FALSE); } res = curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &totaltime); if((CURLE_OK == res) && (totaltime>0.0)) { sprintf(statusline2,"totaltime : %0.0f sec\n", totaltime); ShowLine(0,40+40+40+40+16+10,Med_Font_Size,statusline2,FALSE); } } if(ftpfile.stream) fclose(ftpfile.stream); /* close the local file */ // rename(ftpfile.filename,Localfilename); ULONG lsize=File_GetLen((char *)ftpfile.filename); if(lsize<=0) return d_Fail; remove(Localfilename); int iret= copyFiles((char *)ftpfile.filename, Localfilename); remove(ftpfile.filename); /* always cleanup */ curl_easy_cleanup(curl); curl_global_cleanup(); CTOS_Delay(2000); return d_OK; }
int main(int argc, char **argv) { int extra_idx = 0; TextStartup(); ShowTitle(); // skip program name itself argv++, argc--; if (argc <= 0) { ShowInfo(); TextShutdown(); exit(1); } if (strcmp(argv[0], "/?") == 0 || strcmp(argv[0], "-h") == 0 || strcmp(argv[0], "-help") == 0 || strcmp(argv[0], "--help") == 0 || strcmp(argv[0], "-HELP") == 0 || strcmp(argv[0], "--HELP") == 0) { ShowOptions(); TextShutdown(); exit(1); } BuildArgumentList(argc, argv); info = default_buildinfo; comms = default_buildcomms; if (GLBSP_E_OK != GlbspParseArgs(&info, &comms, resp_argv, resp_argc)) { TextFatalError("Error: %s\n", comms.message ? comms.message : "(Unknown error when parsing args)"); } if (info.extra_files) { int ext_j; /* catch this mistake: glbsp in.wad out.wad (forget the -o) */ if (info.input_file && info.extra_files[0] && ! info.extra_files[1] && FileExists(info.input_file) && ! FileExists(info.extra_files[0])) { TextFatalError("Error: Cannot find WAD file: %s (" "Maybe you forgot -o)\n", info.extra_files[0]); } /* balk NOW if any of the input files doesn't exist */ if (! FileExists(info.input_file)) TextFatalError("Error: Cannot find WAD file: %s\n", info.input_file); for (ext_j = 0; info.extra_files[ext_j]; ext_j++) { if (FileExists(info.extra_files[ext_j])) continue; TextFatalError("Error: Cannot find WAD file: %s\n", info.extra_files[ext_j]); } } /* process each input file */ for (;;) { if (GLBSP_E_OK != GlbspCheckInfo(&info, &comms)) { TextFatalError("Error: %s\n", comms.message ? comms.message : "(Unknown error when checking args)"); } if (info.no_progress) TextDisableProgress(); if (GLBSP_E_OK != GlbspBuildNodes(&info, &cmdline_funcs, &comms)) { TextFatalError("Error: %s\n", comms.message ? comms.message : "(Unknown error during build)"); } /* when there are extra input files, process them too */ if (! info.extra_files || ! info.extra_files[extra_idx]) break; ShowDivider(); GlbspFree(info.input_file); GlbspFree(info.output_file); info.input_file = GlbspStrDup(info.extra_files[extra_idx]); info.output_file = NULL; extra_idx++; } TextShutdown(); FreeArgumentList(); return 0; }
int main(int argc, char **argv) { try { // skip program name argv++, argc--; ArgvInit(argc, (const char **)argv); InitDebug(ArgvFind(0, "debug") >= 0); InitEndian(); if (ArgvFind('?', NULL) >= 0 || ArgvFind('h', "help") >= 0) { ShowTitle(); ShowInfo(); exit(1); } InitFLTK(); SetDefaults(); SetupRandom(); int W = 40; int H = 40; GetMapSize(&W, &H); PrintDebug("Map size %dx%d\n\n", W, H); the_world = new world_c(W, H); environ_build::CreateEnv(); area_build::CreateAreas(); island_build::CreateIslands(); island_build::Cleanup(); stage_build::CreateStages(); path_build::CreatePaths(); room_build::CreateRooms(); if (ArgvFind('g', "gui") >= 0) { guix_win = new Guix_MainWin(PROG_NAME); // run the GUI until the user quits while (! guix_win->want_quit) Fl::wait(); } CreateWAD(); } catch (const char * err) { DisplayError("%s", err); } #if 1 catch (assert_fail_c err) { DisplayError("Sorry, an internal error occurred:\n%s", err.GetMessage()); } catch (...) { DisplayError("An unknown problem occurred (UI code)"); } #endif delete guix_win; TermDebug(); return main_result; }
USHORT ECC_FTPGetFileShowStatusForTest(STR *title,STR *ip,STR *id,STR *pw,STR * Localfilename, STR * Remofilename,BYTE isSSL) { CURL *curl; CURLcode res; double totaltime,filesize; BYTE statusline2[64]; struct FtpFile ftpfile={ "tmpfile", /* name to store the file as if succesful */ NULL }; CTOS_LCDSelectMode(d_LCD_TEXT_320x240_MODE); CTOS_LCDGClearCanvas(); ShowTitle(title); ShowLine(0,40+16,Big_Font_Size,"資料下載中.",FALSE); ShowLine(0,40+40+16+10,Med_Font_Size,"下載進度",FALSE); curl_global_init(CURL_GLOBAL_DEFAULT); BYTE processstr[32]; curl = curl_easy_init(); if(curl) { BYTE URL[128]; BYTE IDPW[64]; BYTE DNS[64]; BYTE *errstr; memset(URL,0x00,sizeof(URL)); sprintf(URL,"FTPS://%s%s",ip,Remofilename); memset(IDPW,0x00,sizeof(IDPW)); sprintf(IDPW,"%s:%s",id,pw); curl_easy_setopt(curl, CURLOPT_URL,URL); curl_easy_setopt(curl, CURLOPT_USERPWD,IDPW); /* Define our callback to get called when there's data to be written */ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_fwrite); /* Set a pointer to our struct to pass to the callback */ curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ftpfile); BYTE len=sizeof(DNS); USHORT ret = CTOS_EthernetConfigGet(d_ETHERNET_CONFIG_DNSIP, DNS,&len); curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); curl_easy_setopt(curl, CURLOPT_BUFFERSIZE, 1024L*1000); curl_easy_setopt(curl, CURLOPT_FTP_RESPONSE_TIMEOUT, 600); curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 600); curl_easy_setopt(curl, CURLOPT_TIMEOUT, 600); curl_easy_setopt(curl, CURLOPT_DNS_SERVERS, DNS); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL); curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L); curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, my_progress_func); /* Switch on full protocol/debug output */ curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); res = curl_easy_perform(curl); if(CURLE_OK != res) { /* we failed */ errstr=(BYTE*)curl_easy_strerror(res); ErrorMessageBox(gTransTitle,"錯誤訊息",errstr,"","",d_MB_CHECK); CTOS_PrinterPutString (errstr); SystemLog("ECC_FTPGetFile",errstr); return res; } res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &filesize); if((CURLE_OK == res) && (filesize>0.0)) { sprintf(statusline2,"filesize : %0.0f bytes", filesize); ShowLine(0,40+40+40+16+10,Med_Font_Size,statusline2,FALSE); CTOS_PrinterPutString (statusline2); } res = curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &totaltime); if((CURLE_OK == res) && (totaltime>0.0)) { sprintf(statusline2,"totaltime : %0.0f sec", totaltime); ShowLine(0,40+40+40+40+16+10,Med_Font_Size,statusline2,FALSE); CTOS_PrinterPutString (statusline2); } } //curl_easy_cleanup(curl); curl_global_cleanup(); CTOS_Delay(2000); return d_OK; }
// Helper method to get the layout properties from the PrintLayout xml resource. void MgPrintLayout::GetLayoutPropertiesFromXml(MgXmlUtil* pXmlUtil) { CHECKNULL(pXmlUtil, L"MgPrintLayout.GetLayoutPropertiesFromXml()"); MG_TRY() // Retrieve values from the xml document DOMElement* root = pXmlUtil->GetRootNode(); CHECKNULL(root, L"MgPrintLayout.GetLayoutProperitesFromXml()"); // DOMElement* pageProperties = pXmlUtil->GetElementNode(root, "PageProperties"); DOMElement* backgroundColor = pXmlUtil->GetElementNode(root, "BackgroundColor"); wstring szRed; pXmlUtil->GetElementValue(backgroundColor, "Red", szRed); wstring szGreen; pXmlUtil->GetElementValue(backgroundColor, "Green", szGreen); wstring szBlue; pXmlUtil->GetElementValue(backgroundColor, "Blue", szBlue); DOMElement* layoutProperties = pXmlUtil->GetElementNode(root, "LayoutProperties"); wstring szShowTitle; pXmlUtil->GetElementValue(layoutProperties, "ShowTitle", szShowTitle, false); wstring szShowLegend; pXmlUtil->GetElementValue(layoutProperties, "ShowLegend", szShowLegend, false); wstring szShowScalebar; pXmlUtil->GetElementValue(layoutProperties, "ShowScaleBar", szShowScalebar, false); wstring szShowNorthArrow; pXmlUtil->GetElementValue(layoutProperties, "ShowNorthArrow", szShowNorthArrow, false); wstring szShowUrl; pXmlUtil->GetElementValue(layoutProperties, "ShowURL", szShowUrl, false); wstring szShowDateTime; pXmlUtil->GetElementValue(layoutProperties, "ShowDateTime", szShowDateTime, false); wstring szShowCustomLogos; pXmlUtil->GetElementValue(layoutProperties, "ShowCustomLogos", szShowCustomLogos, false); wstring szShowCustomText; pXmlUtil->GetElementValue(layoutProperties, "ShowCustomText", szShowCustomText, false); DOMNode* customLogosNode = pXmlUtil->GetElementNode(root, "CustomLogos", false); if (NULL != customLogosNode) { DOMNodeList* customLogosNodeList = pXmlUtil->GetNodeList(customLogosNode, "Logo"); if (NULL != customLogosNodeList) { for (XMLSize_t i = 0; i < customLogosNodeList->getLength(); ++i) { MgCustomLogoInfo logoInfo; wstring positionX; wstring positionY; wstring positionUnits; wstring resId; wstring name; wstring sizeWidth; wstring sizeHeight; wstring sizeUnits; wstring rotation; DOMNode* logoNode = customLogosNodeList->item(i); DOMNode* logoPositionNode = pXmlUtil->GetElementNode(logoNode, "Position", false); if (NULL != logoPositionNode) { pXmlUtil->GetElementValue(logoPositionNode, "Left", positionX, false); pXmlUtil->GetElementValue(logoPositionNode, "Bottom", positionY, false); pXmlUtil->GetElementValue(logoPositionNode, "Units", positionUnits, false); if (!positionUnits.empty() && positionUnits != L"meters" && positionUnits != L"inches" && positionUnits != L"percent") { // invalid print layout position units throw new MgInvalidPrintLayoutPositionUnitsException(L"MgPrintLayout.GetLayoutPropertiesFromXml", __LINE__, __WFILE__, NULL, L"", NULL); } } pXmlUtil->GetElementValue(logoNode, "ResourceId", resId, false); pXmlUtil->GetElementValue(logoNode, "Name", name, false); DOMNode* logoSizeNode = pXmlUtil->GetElementNode(logoNode, "Size", false); if (NULL != logoSizeNode) { pXmlUtil->GetElementValue(logoSizeNode, "Width", sizeWidth, false); pXmlUtil->GetElementValue(logoSizeNode, "Height", sizeHeight, false); pXmlUtil->GetElementValue(logoSizeNode, "Units", sizeUnits, false); if (!sizeUnits.empty() && sizeUnits != L"inches" && sizeUnits != L"meters") { // invalid print layout size units throw new MgInvalidPrintLayoutSizeUnitsException(L"MgPrintLayout.GetLayoutPropertiesFromXml", __LINE__, __WFILE__, NULL, L"", NULL); } } pXmlUtil->GetElementValue(logoNode, "Rotation", rotation, false); logoInfo.SetX( MgUtil::StringToDouble(positionX) ); logoInfo.SetY( MgUtil::StringToDouble(positionY) ); logoInfo.SetPositionUnits( positionUnits ); logoInfo.SetResourceId( resId ); logoInfo.SetName( name ); logoInfo.SetWidth( MgUtil::StringToDouble(sizeWidth) ); logoInfo.SetHeight( MgUtil::StringToDouble(sizeHeight) ); logoInfo.SetSizeUnits( sizeUnits ); logoInfo.SetRotation( MgUtil::StringToDouble(rotation) ); CustomLogos().push_back(logoInfo); } } } DOMNode* customTextNode = pXmlUtil->GetElementNode(root, "CustomText", false); if (NULL != customTextNode) { DOMNodeList* customTextNodeList = pXmlUtil->GetNodeList(customTextNode, "Text"); if (NULL != customTextNodeList) { for (XMLSize_t i = 0; i < customTextNodeList->getLength(); ++i) { MgCustomTextInfo textInfo; wstring positionX; wstring positionY; wstring positionUnits; wstring value; wstring fontName; wstring fontHeight; wstring fontSizeUnits; DOMNode* textNode = customTextNodeList->item(i); DOMNode* textPositionNode = pXmlUtil->GetElementNode(textNode, "Position", false); if (NULL != textPositionNode) { pXmlUtil->GetElementValue(textPositionNode, "Left", positionX, false); pXmlUtil->GetElementValue(textPositionNode, "Bottom", positionY, false); pXmlUtil->GetElementValue(textPositionNode, "Units", positionUnits, false); if (!positionUnits.empty() && positionUnits != L"percent" && positionUnits != L"meters" && positionUnits != L"inches") { // invalid print layout position units throw new MgInvalidPrintLayoutPositionUnitsException(L"MgPrintLayout.GetLayoutPropertiesFromXml", __LINE__, __WFILE__, NULL, L"", NULL); } } DOMNode* fontNode = pXmlUtil->GetElementNode(textNode, "Font", false); if (NULL != fontNode) { pXmlUtil->GetElementValue(fontNode, "Name", fontName, false); pXmlUtil->GetElementValue(fontNode, "Height", fontHeight, false); pXmlUtil->GetElementValue(fontNode, "Units", fontSizeUnits, false); if (!fontSizeUnits.empty() && fontSizeUnits != L"points" && fontSizeUnits != L"meters" && fontSizeUnits != L"inches") { // invalid print layout font size units throw new MgInvalidPrintLayoutFontSizeUnitsException(L"MgPrintLayout.GetLayoutPropertiesFromXml", __LINE__, __WFILE__, NULL, L"", NULL); } } pXmlUtil->GetElementValue(textNode, "Value", value, false); textInfo.SetX( MgUtil::StringToDouble( positionX ) ); textInfo.SetY( MgUtil::StringToDouble( positionY ) ); textInfo.SetPositionUnits( positionUnits ); textInfo.SetValue( value ); textInfo.SetFontName( fontName ); textInfo.SetFontHeight( MgUtil::StringToDouble( fontHeight ) ); textInfo.SetSizeUnits( fontSizeUnits ); CustomText().push_back(textInfo); } } } // Set MgPrintLayout values INT32 nRed = MgUtil::StringToInt32( szRed ); INT32 nGreen = MgUtil::StringToInt32( szGreen ); INT32 nBlue = MgUtil::StringToInt32( szBlue ); m_bgColor = new MgColor(nRed, nGreen, nBlue, 255); ShowTitle() = MgUtil::StringToBoolean( szShowTitle ); ShowLegend() = MgUtil::StringToBoolean( szShowLegend ); ShowScalebar() = MgUtil::StringToBoolean( szShowScalebar ); ShowNorthArrow() = MgUtil::StringToBoolean( szShowNorthArrow ); ShowUrl() = MgUtil::StringToBoolean( szShowUrl ); ShowDateTime() = MgUtil::StringToBoolean( szShowDateTime ); ShowCustomLogos() = MgUtil::StringToBoolean( szShowCustomLogos ); ShowCustomText() = MgUtil::StringToBoolean( szShowCustomText ); MG_CATCH_AND_THROW(L"MgPrintLayout.GetLayoutPropertiesFromXml") }
int main(int argc, char* argv[]) { //char* strTestItem = NULL; int iTestItem = 0xFF; ShowTitle(); bool bRunOneTime = false; for(;;) { if(1 == argc) { printf("\n\n\n"); printf("===============================================\n\n"); printf("1: DES 2: DES3 3: RC2 4:RC4 5:RSA 6:AES\n"); printf("0: Exit\n"); printf("-----------------------------------------------\n"); printf("Please select a item to test: "); scanf("%d", &iTestItem); } else { bRunOneTime = true; if(0==lstrcmpi(argv[1], "-DES")) iTestItem = 1; else if(0==lstrcmpi(argv[1], "-DES3")) iTestItem = 2; else if(0==lstrcmpi(argv[1], "-RC2")) iTestItem = 3; else if(0==lstrcmpi(argv[1], "-RC4")) iTestItem = 4; else if(0==lstrcmpi(argv[1], "-RSA")) iTestItem = 5; else iTestItem = 0; } switch(iTestItem) { case 1: { DesTest test(PKCS11_LIB_NAME); test.Test(); } break; case 2: { Des3Test test(PKCS11_LIB_NAME); test.Test(); } break; case 3: { RC2Test test(PKCS11_LIB_NAME); test.Test(); } break; case 4: { RC4Test test(PKCS11_LIB_NAME); test.Test(); } break; case 5: { RSATest rsa(PKCS11_LIB_NAME); rsa.Test(); } break; case 6: { AESTest test(PKCS11_LIB_NAME); test.Test(); } break; case 0: return 0; default: break; } if(bRunOneTime) break; } printf("\n\nTest finished.\n\nPress any key to exit ...\n"); getch(); return 0; }