void wxGL_PMFCanvas::Init() { FreezeRender = false; this->SetCurrent(); // === === === Init GL === === === // Initialize OpenGL function table vendor = wxString((char*)glGetString(GL_VENDOR), wxConvUTF8); renderer = wxString((char*)glGetString(GL_RENDERER), wxConvUTF8); version = wxString((char*)glGetString(GL_VERSION), wxConvUTF8); /*std::string extensions = (char*)glGetString(GL_EXTENSIONS); GLFunctions.LoadFunctionTable();*/ glClearDepth(1.0f); // Depth Buffer Setup glEnable(GL_DEPTH_TEST); // Enables Depth Testing glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations glShadeModel(GL_SMOOTH); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); glEnable(GL_NORMALIZE); glClearColor(0, 0, 0, 1.0f); // Black Background glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE); // glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR); glEnable(GL_COLOR_SUM); Reinit(true); // gr_debug = new debug_window(wxGetTopLevelParent(parent), GR_DEBUG_WINDOW, "Graphics Debug Output", wxPoint(1024-200,768-150), wxSize(200,150)); }
void CSoundtrackManager::SetGameState (EGameStates iNewState, CSoundType *pTrack) // SetGameState // // Sets the current game state and starts playing the given track. { // If our state has not changed, then nothing to do if (iNewState == m_iGameState && pTrack == m_pNowPlaying) return; // Set our state m_iGameState = iNewState; // If we're back at program intro then reinit our playlist. if (iNewState == stateProgramIntro) Reinit(); // Play the soundtrack Play(pTrack); }
//Init bool Menu::Init (Err *pErr, Config *pConfig, Config *pLanguage, Profiles *pProfiles, sf::RenderWindow *pWindow) { if (!m_Err.SetClass (pErr, L"Menu") || !Render::Init (&m_Err, pWindow)) { return false; } Err fErr (m_Err, L"Init"); if (pConfig == NULL || pLanguage == NULL || pProfiles == NULL) { return fErr.Set (sERR_ARGUMENTS); } m_pConfig = pConfig; m_pLanguage = pLanguage; m_pProfiles = pProfiles; if (!m_pConfig->Get (sCONF_LEVELDIR, &m_sLevelDir) || !m_pConfig->Get (L"LanguageDir", &m_sLanguageDir)) { return false; } m_sLevelDir += L"/"; m_sLanguageDir += L"/"; m_pCurrentScreen = &m_ScreenMain; return Reinit (); }//Init
int CUstpFtdcMduserApi::HandleMsgFromATF() { char rcvBuf[BUFSIZE] = {0}; char * pRcvBuf = NULL; MsgHead *pMsg = NULL; /*======check if is a msg(MSGID_S2C_QUOTE_DISCONNECT) come from ATF======*/ if(true == m_bLogined) { pRcvBuf = rcvBuf; int iExpectRcvLen = sizeof(MsgHead); if(iExpectRcvLen == TcpTimedRecvData(m_fdConnQuoteSvr,pRcvBuf,iExpectRcvLen,50)) { pMsg = (MsgHead *)pRcvBuf; if(MSGID_S2C_QUOTE_DISCONNECT == ntohs(pMsg->iMsgID)) { g_log.info("Received MSGID_S2C_QUOTE_DISCONNECT, %dB\n",iExpectRcvLen); m_FtdcMdSpi_instance->OnFrontDisconnected(0x1001); Reinit(); SetState(STATUS_QUOTE_INIT); return ATF_SUCC; } } } else return ATF_FAIL; return ATF_SUCC; }
bool SnapManager::Snap(Track *currentTrack, double t, bool rightEdge, double *outT, bool *snappedPoint, bool *snappedTime) { // Check to see if we need to reinitialize Reinit(); // First snap to points in mSnapPoints *outT = t; *snappedPoint = SnapToPoints(currentTrack, t, rightEdge, outT); // Now snap to the time grid *snappedTime = false; if (mSnapToTime) { if (*snappedPoint) { // Since mSnapPoints only contains points on the grid, we're done *snappedTime = true; } else { // Snap time to the grid mConverter.ValueToControls(t, GetActiveProject()->GetSnapTo() == SNAP_NEAREST); mConverter.ControlsToValue(); *outT = mConverter.GetValue(); *snappedTime = true; } } return *snappedPoint || *snappedTime; }
void wxStringTokenizer::SetString(const wxString& str, const wxString& delims, wxStringTokenizerMode mode) { if ( mode == wxTOKEN_DEFAULT ) { // by default, we behave like strtok() if the delimiters are only // whitespace characters and as wxTOKEN_RET_EMPTY otherwise (for // whitespace delimiters, strtok() behaviour is better because we want // to count consecutive spaces as one delimiter) const wxChar *p; for ( p = delims.c_str(); *p; p++ ) { if ( !wxIsspace(*p) ) break; } if ( *p ) { // not whitespace char in delims mode = wxTOKEN_RET_EMPTY; } else { // only whitespaces mode = wxTOKEN_STRTOK; } } m_delims = delims; m_mode = mode; Reinit(str); }
/** \fn ChromaKeyOSD::ProcessOSD(OSD*) * * \return true if we need a repaint, false otherwise */ bool ChromaKeyOSD::ProcessOSD(OSD *osd) { OSDSurface *osdsurf = NULL; if (osd) osdsurf = osd->Display(); int next = (current+1) & 0x1; if (!osdsurf && current >= 0) { Reset(); return true; } else if (!osdsurf || (revision == osdsurf->GetRevision())) return false; // first create a blank frame with the chroma key Reinit(next); // then blend the OSD onto it unsigned char *buf = (unsigned char*) shm_infos[next].shmaddr; osdsurf->BlendToARGB(buf, img[next]->bytes_per_line, vf[next].height, false/*blend_to_black*/, 16); // then set it as the current OSD image revision = osdsurf->GetRevision(); current = next; return true; }
SnapManager::SnapManager(const TrackList *tracks, const ZoomInfo *zoomInfo, const TrackClipArray *clipExclusions, const TrackArray *trackExclusions, bool noTimeSnap, int pixelTolerance) : mConverter(NumericConverter::TIME) { mTracks = tracks; mZoomInfo = zoomInfo; mClipExclusions = clipExclusions; mTrackExclusions = trackExclusions; mPixelTolerance = pixelTolerance; mNoTimeSnap = noTimeSnap; mProject = GetActiveProject(); wxASSERT(mProject); mSnapTo = 0; mRate = 0.0; mFormat.Empty(); // Two time points closer than this are considered the same mEpsilon = 1 / 44100.0; Reinit(); }
void AddTorrent::SetFilename (const QString& filename) { if (filename.isEmpty ()) return; Reinit (); XmlSettingsManager::Instance ()->setProperty ("LastTorrentDirectory", QFileInfo (filename).absolutePath ()); Ui_.TorrentFile_->setText (filename); ParseBrowsed (); }
/* ** SetSimpleMode ** Description: ** Tell af to use simple mode */ void AirframeClass::SetSimpleMode( int mode ) { if ( mode == simpleMode ) return; if(simpleMode != SIMPLE_MODE_OFF && mode == SIMPLE_MODE_OFF) { Reinit(); // MonoPrint("Reinit() Called \n"); } simpleMode = mode; }
void FinishPatching() { CopyTempPathFiles(); // Successfully updated! g_Patcher_IsUpdating = false; Reinit(); AddStatus( "Update successful!", g_StatusColor ); g_ShouldLaunchApp = true; }
void Tiger::Final(byte *hash) { PadLastBlock(56, 0x01); CorrectEndianess(data, data, 56); data[7] = countLo; Transform(digest, data); CorrectEndianess(digest, digest, DigestSize()); memcpy(hash, digest, DigestSize()); Reinit(); // reinit for next use }
MLIFont::MLIFont(const string &ttfFilePath, int fontSize, int strokeWidth, bool invertedColors) : ttfFilePath(ttfFilePath), fontSize(fontSize), strokeWidth(strokeWidth), cache(CacheSize, new CacheItemHandler(this)), invertedColors(invertedColors) { EnsureUIThread(); pTtfFont = NULL; pTtfFontMem = NULL; pAccessSemaphore = SDL_CreateSemaphore(1); Reinit(); }
// helper function: does real copy bool wxStringImpl::AssignCopy(size_t nSrcLen, const wxStringCharType *pszSrcData) { if ( nSrcLen == 0 ) { Reinit(); } else { if ( !AllocBeforeWrite(nSrcLen) ) { // allocation failure handled by caller return false; } memcpy(m_pchData, pszSrcData, nSrcLen*sizeof(wxStringCharType)); GetStringData()->nDataLength = nSrcLen; m_pchData[nSrcLen] = wxT('\0'); } return true; }
void AddTorrent::on_TorrentBrowse__released () { const auto& filename = QFileDialog::getOpenFileName (this, tr ("Select torrent file"), XmlSettingsManager::Instance ()->property ("LastTorrentDirectory").toString (), tr ("Torrents (*.torrent);;All files (*.*)")); if (filename.isEmpty ()) return; Reinit (); XmlSettingsManager::Instance ()->setProperty ("LastTorrentDirectory", QFileInfo (filename).absolutePath ()); Ui_.TorrentFile_->setText (filename); ParseBrowsed (); }
void HAVAL::Final (byte *hash) { PadLastBlock(118, 1); // first byte of padding for HAVAL is 1 instead of 0x80 CorrectEndianess(data, data, 120); data[29] &= 0xffff; data[29] |= ((word32)digestSize<<25) | ((word32)pass<<19) | ((word32)VERSION<<16); data[30] = countLo; data[31] = countHi; vTransform(data); Tailor(digestSize*8); CorrectEndianess(digest, digest, digestSize); memcpy(hash, digest, digestSize); Reinit(); // reinit for next use }
MLIFont::MLIFont(const string &fontId, int strokeWidth, bool invertedColors) : strokeWidth(strokeWidth), cache(CacheSize, new CacheItemHandler(this)), invertedColors(invertedColors) { EnsureUIThread(); this->fontId = fontId; pTtfFont = NULL; pTtfFontMem = NULL; pAccessSemaphore = SDL_CreateSemaphore(1); Reinit(); gpLocalizableContent->AddLocalizableFont(this); }
// assigns one string to another wxStringImpl& wxStringImpl::operator=(const wxStringImpl& stringSrc) { wxASSERT( stringSrc.GetStringData()->IsValid() ); // don't copy string over itself if ( m_pchData != stringSrc.m_pchData ) { if ( stringSrc.GetStringData()->IsEmpty() ) { Reinit(); } else { // adjust references GetStringData()->Unlock(); m_pchData = stringSrc.m_pchData; GetStringData()->Lock(); } } return *this; }
SnapResults SnapManager::Snap (Track *currentTrack, double t, bool rightEdge) { SnapResults results; // Check to see if we need to reinitialize Reinit(); results.timeSnappedTime = results.outTime = t; results.outCoord = mZoomInfo->TimeToPosition(t); // First snap to points in mSnapPoints results.snappedPoint = SnapToPoints(currentTrack, t, rightEdge, &results.outTime); if (mSnapToTime) { // Find where it would snap time to the grid mConverter.ValueToControls(t, GetActiveProject()->GetSnapTo() == SNAP_NEAREST); mConverter.ControlsToValue(); results.timeSnappedTime = mConverter.GetValue(); } results.snappedTime = false; if (mSnapToTime) { if (results.snappedPoint) { // Since mSnapPoints only contains points on the grid, we're done results.snappedTime = true; } else { results.outTime = results.timeSnappedTime; results.snappedTime = true; } } if (results.Snapped()) results.outCoord = mZoomInfo->TimeToPosition(results.outTime); return results; }
// helper function: does real copy bool wxStringImpl::AssignCopy(size_t nSrcLen, const wxStringCharType *pszSrcData) { if ( nSrcLen == 0 ) { Reinit(); } else { if ( !AllocBeforeWrite(nSrcLen) ) { // allocation failure handled by caller return false; } // use memmove() and not memcpy() here as we might be copying from our own // buffer in case of assignment such as "s = s.c_str()" (see #11294) memmove(m_pchData, pszSrcData, nSrcLen*sizeof(wxStringCharType)); GetStringData()->nDataLength = nSrcLen; m_pchData[nSrcLen] = wxT('\0'); } return true; }
void wxStringTokenizer::SetString(const wxString& str, const wxString& delims, wxStringTokenizerMode mode) { if ( mode == wxTOKEN_DEFAULT ) { // by default, we behave like strtok() if the delimiters are only // whitespace characters and as wxTOKEN_RET_EMPTY otherwise (for // whitespace delimiters, strtok() behaviour is better because we want // to count consecutive spaces as one delimiter) wxString::const_iterator p; for ( p = delims.begin(); p != delims.end(); ++p ) { if ( !wxIsspace(*p) ) break; } if ( p != delims.end() ) { // not whitespace char in delims mode = wxTOKEN_RET_EMPTY; } else { // only whitespaces mode = wxTOKEN_STRTOK; } } #if wxUSE_UNICODE // FIXME-UTF8: only wc_str() m_delims = delims.wc_str(); #else m_delims = delims.mb_str(); #endif m_delimsLen = delims.length(); m_mode = mode; Reinit(str); }
FThinkerIterator::FThinkerIterator (const PClass *type, int statnum, DThinker *prev) { if ((unsigned)statnum > MAX_STATNUM) { m_Stat = STAT_FIRST_THINKING; m_SearchStats = true; } else { m_Stat = statnum; m_SearchStats = false; } m_ParentType = type; if (prev == NULL || (prev->NextThinker->ObjectFlags & OF_Sentinel)) { Reinit(); } else { m_CurrThinker = prev->NextThinker; m_SearchingFresh = false; } }
void MD5MAC::TruncatedFinal(byte *hash, unsigned int size) { assert(size <= DIGESTSIZE); PadLastBlock(56); CorrectEndianess(data, data, 56); data[14] = countLo; data[15] = countHi; Transform(digest, data, key+4); unsigned i; for (i=0; i<4; i++) data[i] = key[8+i]; for (i=0; i<12; i++) data[i+4] = T[i] ^ key[8+i%4]; Transform(digest, data, key+4); CorrectEndianess(digest, digest, DIGESTSIZE); memcpy(hash, digest, size); Reinit(); // reinit for next use }
int IPCStream::Uninit( ) { return Reinit( ); }
explicit Percent(unsigned max_value, unsigned step = 5) { Reinit(max_value, step); }
bool wxRegExImpl::Compile(const wxString& expr, int flags) { Reinit(); #ifdef WX_NO_REGEX_ADVANCED # define FLAVORS wxRE_BASIC #else # define FLAVORS (wxRE_ADVANCED | wxRE_BASIC) wxASSERT_MSG( (flags & FLAVORS) != FLAVORS, wxT("incompatible flags in wxRegEx::Compile") ); #endif wxASSERT_MSG( !(flags & ~(FLAVORS | wxRE_ICASE | wxRE_NOSUB | wxRE_NEWLINE)), wxT("unrecognized flags in wxRegEx::Compile") ); // translate our flags to regcomp() ones int flagsRE = 0; if ( !(flags & wxRE_BASIC) ) { #ifndef WX_NO_REGEX_ADVANCED if (flags & wxRE_ADVANCED) flagsRE |= REG_ADVANCED; else #endif flagsRE |= REG_EXTENDED; } if ( flags & wxRE_ICASE ) flagsRE |= REG_ICASE; if ( flags & wxRE_NOSUB ) flagsRE |= REG_NOSUB; if ( flags & wxRE_NEWLINE ) flagsRE |= REG_NEWLINE; // compile it #ifdef WXREGEX_USING_BUILTIN bool conv = true; // FIXME-UTF8: use wc_str() after removing ANSI build int errorcode = wx_re_comp(&m_RegEx, expr.c_str(), expr.length(), flagsRE); #else // FIXME-UTF8: this is potentially broken, we shouldn't even try it // and should always use builtin regex library (or PCRE?) const wxWX2MBbuf conv = expr.mbc_str(); int errorcode = conv ? regcomp(&m_RegEx, conv, flagsRE) : REG_BADPAT; #endif if ( errorcode ) { wxLogError(_("Invalid regular expression '%s': %s"), expr.c_str(), GetErrorMsg(errorcode, !conv).c_str()); m_isCompiled = false; } else // ok { // don't allocate the matches array now, but do it later if necessary if ( flags & wxRE_NOSUB ) { // we don't need it at all m_nMatches = 0; } else { // we will alloc the array later (only if really needed) but count // the number of sub-expressions in the regex right now // there is always one for the whole expression m_nMatches = 1; // and some more for bracketed subexperessions for ( const wxChar *cptr = expr.c_str(); *cptr; cptr++ ) { if ( *cptr == wxT('\\') ) { // in basic RE syntax groups are inside \(...\) if ( *++cptr == wxT('(') && (flags & wxRE_BASIC) ) { m_nMatches++; } } else if ( *cptr == wxT('(') && !(flags & wxRE_BASIC) ) { // we know that the previous character is not an unquoted // backslash because it would have been eaten above, so we // have a bare '(' and this indicates a group start for the // extended syntax. '(?' is used for extensions by perl- // like REs (e.g. advanced), and is not valid for POSIX // extended, so ignore them always. if ( cptr[1] != wxT('?') ) m_nMatches++; } } } m_isCompiled = true; } return IsValid(); }
void MLIFont::ReloadFontInfo() { Reinit(); }
//ChooseScreen bool Menu::ChooseScreen (bool *pbQuit) { Err fErr (m_Err, L"ChooseScreen"); if (pbQuit == NULL) { return fErr.Set (sERR_ARGUMENTS); } if (m_pCurrentScreen == NULL) { return fErr.Set (L"The pointer for the current screen is invalid"); } unsigned int nSelected; if (!m_pCurrentScreen->GetSelectId (&nSelected)) { return false; } switch (nSelected) { case (eMainButtonStart): m_pCurrentScreen = &m_ScreenGame; break; case (eGameButtonPlay): if (!PrepareGameStart ()) { return false; } *pbQuit = false; break; case (eMainButtonQuit): m_bClose = true; break; case (eMainButtonSettings): m_pCurrentScreen = &m_ScreenSettings; break; case (eMainButtonProfiles): if (!ManageProfileScreens ()) { return false; } break; case (eMainButtonAbout): m_pCurrentScreen = &m_ScreenAbout; break; case (eGameButtonAbort): case (eAboutButtonAbort): case (eSettingsButtonAbort): m_pCurrentScreen = &m_ScreenMain; break; case (eSettingsButtonOk): case (eSettingsButtonAccept): { if (!ApplySettings () || !Reinit () || !m_pConfig->Save ()) { return false; } if (nSelected == eSettingsButtonOk) { m_pCurrentScreen = &m_ScreenMain; } break; } default: return fErr.Set (L"The given selectection id is unknown: " + NumToStr (nSelected)); } return true; }//ChooseScreen