void HurtRingView::Draw(){ SPADES_MARK_FUNCTION(); Vector3 playerFront; World *w = client->GetWorld(); if(!w){ ClearAll(); return; } Player *p = w->GetLocalPlayer(); if(p == NULL || !p->IsAlive()){ ClearAll(); return; } playerFront = p->GetFront2D(); float hurtRingSize = renderer->ScreenHeight() * .3f; float cx = renderer->ScreenWidth() * .5f; float cy = renderer->ScreenHeight() * .5f; static const float coords[][2]={ {-1,-1},{1,-1},{-1,1} }; std::list<Item>::iterator it; for(it = items.begin(); it != items.end(); it++){ Item& item = *it; float fade = item.fade * 2.f; if(fade > 1.f)fade = 1.f; Vector4 color = {1,1,1,fade}; renderer->SetColor(color); Vector3 dir = -item.dir; float c = dir.x * playerFront.x + dir.y * playerFront.y; float s = dir.y * playerFront.x - dir.x * playerFront.y; Vector2 verts[3]; for(int i = 0; i < 3; i++){ verts[i] = MakeVector2(coords[i][0] * c - coords[i][1] * s, coords[i][0] * s + coords[i][1] * c); verts[i] = verts[i] * hurtRingSize + MakeVector2(cx, cy); } renderer->DrawImage(image, verts[0], verts[1], verts[2], AABB2(0, 0, image->GetWidth(), image->GetHeight())); } }
//--------------------------------------------------------------------------- //遞迴刪除資料 Item* ClearAll(Item *node) { if (node != NULL) { node->itmLeft = ClearAll(node->itmLeft); node->itmRight = ClearAll(node->itmRight); Item *itm = node; node = NULL; free(itm); iTotalNum--; } return node; }
bool SvnCommand::Execute(const wxString& command, const wxString& workingDirectory, SvnCommandHandler *handler) { // Dont run 2 commands at the same time if(m_process) { if(handler) { //handler->GetPlugin()->GetShell()->AppendText(svnANOTHER_PROCESS_RUNNING); delete handler; } return false; } ClearAll(); // Wrap the command in the OS Shell wxString cmdShell (command); WrapInShell(cmdShell); m_process = CreateAsyncProcess(this, command, workingDirectory); if ( !m_process ) { return false; } m_workingDirectory = workingDirectory.c_str(); m_command = command.c_str(); m_handler = handler; return true; }
void SubversionView::OnSolutionClosed(wxCommandEvent& event) { event.Skip(); m_textCtrlRootDir->SetValue(wxT("")); ClearAll(); m_plugin->GetConsole()->Clear(); }
/* init Dlg */ void ExcDlgPowerTotal::InitDlg(void) { int i = 0; //unsigned char str[1] = { 'L' }; unsigned char buff[32] = {0}; ClearAll(); SetMemAera(16, 0, GPS_16X32_8BIT, DISPLAY, false); SetRectangle(0, 18, 160, 2, false); SetRectangle(0, 142, 160, 2, false); SetRectangle(138, 147, 16, 8, false); SetRectangle(136, 149, 2, 4, false); //DISPLAY_8x16_SR(64, 2, false); DISPLAY_16x16_DIANNENGLIANG(55, 25, false); DISPLAY_ZHENGXIANGYOUGONG(0, 45, false); DISPLAY_ZHENGXIANGWUGONG(0, 63, false); DISPLAY_FANXIANGYOUGONG(0, 81, false); DISPLAY_FANXIANGWUGONG(0, 99, false); DISPLAY_8x16_KWH(120, 45, false); DISPLAY_8x16_KVARH(120, 63, false); DISPLAY_8x16_KWH(120, 81, false); DISPLAY_8x16_KVARH(120, 99, false); DISPLAY_8x16_000000000210(0, 144, false); DisplayTime(120, 2); return; }
bool SvnCommand::Execute(const wxString &command, const wxString &workingDirectory, SvnCommandHandler *handler, Subversion2 *plugin) { // Dont run 2 commands at the same time if(m_process) { if(handler) { //handler->GetPlugin()->GetShell()->AppendText(svnANOTHER_PROCESS_RUNNING); delete handler; } return false; } ClearAll(); // Wrap the command in the OS Shell wxString cmdShell (command); WrapInShell(cmdShell); // Apply the environment variables before executing the command wxStringMap_t om; om.insert( std::make_pair("LC_ALL", "C")); bool useOverrideMap = m_plugin->GetSettings().GetFlags() & SvnUsePosixLocale; EnvSetter env(m_plugin->GetManager()->GetEnv(), useOverrideMap ? &om : NULL); m_process = CreateAsyncProcess(this, command, IProcessCreateDefault, workingDirectory); if ( !m_process ) { return false; } m_workingDirectory = workingDirectory.c_str(); m_command = command.c_str(); m_handler = handler; return true; }
// DisplayAndClear - will display results after this many milliseconds. should be called regularly void AP_PerfMon::DisplayAndClear(uint32_t display_after_seconds) { if( (AP_HAL::micros() - allStartTime) > (uint32_t)(display_after_seconds * 1000000) ) { DisplayResults(); ClearAll(); } }
void wxFileCtrl::ChangeToReportMode() { ClearAll(); SetSingleStyle( wxLC_REPORT ); // do this since WIN32 does mm/dd/yy UNIX does mm/dd/yyyy // don't hardcode since mm/dd is dd/mm elsewhere int w, h; wxDateTime dt(22, wxDateTime::Dec, 2002, 22, 22, 22); wxString txt = dt.FormatDate() + wxT("22") + dt.Format(wxT("%I:%M:%S %p")); GetTextExtent(txt, &w, &h); InsertColumn( 0, _("Name"), wxLIST_FORMAT_LEFT, w ); InsertColumn( 1, _("Size"), wxLIST_FORMAT_LEFT, w/2 ); InsertColumn( 2, _("Type"), wxLIST_FORMAT_LEFT, w/2 ); InsertColumn( 3, _("Modified"), wxLIST_FORMAT_LEFT, w ); #if defined(__UNIX__) GetTextExtent(wxT("Permissions 2"), &w, &h); InsertColumn( 4, _("Permissions"), wxLIST_FORMAT_LEFT, w ); #elif defined(__WIN32__) GetTextExtent(wxT("Attributes 2"), &w, &h); InsertColumn( 4, _("Attributes"), wxLIST_FORMAT_LEFT, w ); #endif UpdateFiles(); }
void Scenery::Generate(int nb, int h) { int nbboxes = nb; Box * boxes = new Box [nbboxes]; int boxh = h; srand(time(NULL)); ClearAll(); for (int i=0; i<nbboxes; i++) { do { XB(i) = random(fWidth-boxh); YB(i) = random(fHeight-boxh); } while ( (XB(i)<40 && YB(i)<40) ); XE(i) = XB(i)+boxh; YE(i) = YB(i)+boxh; } #ifndef wrap Line(0,0,fWidth-1,0, kColor); Line(0,0,0,fHeight-1, kColor); Line(fWidth-1,0,fWidth-1,fHeight-1, kColor); Line(fWidth-1,fHeight-1,0,fHeight-1, kColor); #endif for (int i1=0; i1<nbboxes; i1++) { Fill4(XB(i1), YB(i1), XE(i1), YB(i1), XE(i1), YE(i1), XB(i1), YE(i1), kColor); } if (boxes != NULL) delete boxes; }
CODBCContextRegistry::~CODBCContextRegistry(void) throw() { try { ClearAll(); } NCBI_CATCH_ALL_X( 1, NCBI_CURRENT_FUNCTION ) }
/******************************************** Constructor Inits all of the cell variables (properties) Calls ClearAll which clears all cell properties *********************************************/ CUGCell::CUGCell() { m_useThemes = true; m_extraMem = NULL; m_cellInitialState = NULL; ClearAll(); }
//---------------------------------------------------------------------------- void Triangulation::DoExample1 () { // Polygon with one hole. The top and bottom vertices of the outer // polygon are on the line containing the left edge of the inner polygon. // This example tests how the collinearity detection works when // identifying ears. ClearAll(); mExample = 1; mPositions.resize(7); mPositions[0][0] = 64.0f; mPositions[0][1] = 128.0f; mPositions[1][0] = 128.0f; mPositions[1][1] = 64.0f; mPositions[2][0] = 192.0f; mPositions[2][1] = 128.0f; mPositions[3][0] = 128.0f; mPositions[3][1] = 192.0f; mPositions[4][0] = 160.0f; mPositions[4][1] = 128.0f; mPositions[5][0] = 128.0f; mPositions[5][1] = 96.0f; mPositions[6][0] = 128.0f; mPositions[6][1] = 160.0f; mOuter.resize(4); mOuter[0] = 0; mOuter[1] = 1; mOuter[2] = 2; mOuter[3] = 3; mFillSeeds.push_back(Vector2f(66.0f, 128.0f)); mInner0.resize(3); mInner0[0] = 4; mInner0[1] = 5; mInner0[2] = 6; TriangulateEC<float>(mPositions, mType, mEpsilon, mOuter, mInner0, mTriangles); }
/* TextEditor::loadEntry * Reads the contents of [entry] into the text area, returns false * if the given entry is invalid *******************************************************************/ bool TextEditor::loadEntry(ArchiveEntry* entry) { // Clear current text ClearAll(); // Check that the entry exists if (!entry) { Global::error = "Invalid archive entry given"; return false; } // Check that the entry has any data, if not do nothing if (entry->getSize() == 0 || !entry->getData()) return true; // Get character entry data //string text = wxString::From8BitData((const char*)entry->getData(), entry->getSize()); string text = wxString::FromUTF8((const char*)entry->getData(), entry->getSize()); // If opening as UTF8 failed for some reason, try again as 8-bit data if (text.length() == 0) text = wxString::From8BitData((const char*)entry->getData(), entry->getSize()); // Load text into editor SetText(text); // Update line numbers margin width string numlines = S_FMT("0%d", GetNumberOfLines()); SetMarginWidth(0, TextWidth(wxSTC_STYLE_LINENUMBER, numlines)); return true; }
bool NFCElementInfoModule::Clear() { ClearAll(); mbLoaded = false; return true; }
nsresult LookupCache::Reset() { LOG(("LookupCache resetting")); nsCOMPtr<nsIFile> storeFile; nsCOMPtr<nsIFile> prefixsetFile; nsresult rv = mStoreDirectory->Clone(getter_AddRefs(storeFile)); NS_ENSURE_SUCCESS(rv, rv); rv = mStoreDirectory->Clone(getter_AddRefs(prefixsetFile)); NS_ENSURE_SUCCESS(rv, rv); rv = storeFile->AppendNative(mTableName + NS_LITERAL_CSTRING(CACHE_SUFFIX)); NS_ENSURE_SUCCESS(rv, rv); rv = prefixsetFile->AppendNative(mTableName + NS_LITERAL_CSTRING(PREFIXSET_SUFFIX)); NS_ENSURE_SUCCESS(rv, rv); rv = storeFile->Remove(false); NS_ENSURE_SUCCESS(rv, rv); rv = prefixsetFile->Remove(false); NS_ENSURE_SUCCESS(rv, rv); ClearAll(); return NS_OK; }
/* init Dlg */ void ExcDlgWelcome::InitDlg(void) { int i = 0; //unsigned char str[1] = { 'L' }; unsigned char buff[32] = {0}; ClearAll(); //logo //SetMemAera(144, 0, LOONGSON_LOGO16X16_8BIT, DISPLAY, false); SetMemAera(10, 40, LOONGSON_LOGO32X32_8BIT, DISPLAY, false); SetMemAera(16, 0, GPS_16X32_8BIT, DISPLAY, false); SetRectangle(0, 18, 160, 2, false); SetRectangle(0, 142, 160, 2, false); SetRectangle(138, 147, 16, 8, false); SetRectangle(136, 149, 2, 4, false); //DISPLAY_8x16_SR(64, 2, false); #if 0 // title m_AmrDisplay.ZKDisplayConvert((char *)"L" , ASCII12, buff); SetZIFUAera(50, 10, ASCII12, buff, DISPLAY, false); #else DISPLAY_16x16_BEIJINGSHENZHOULONGXIN(50, 40, false); DISPLAY_8x16_000000000210(0, 144, false); DISPLAY_16x16_DIANLIZHUANBIANXITONG(25, 76, false); DisplayTime(120, 2); #endif return; }
bool Edit::LoadFile (const wxString &filename) { // load file in edit and clear undo if (!filename.empty()) m_filename = filename; // wxFile file (m_filename); // if (!file.IsOpened()) return false; ClearAll (); // long lng = file.Length (); // if (lng > 0) { // wxString buf; // wxChar *buff = buf.GetWriteBuf (lng); // file.Read (buff, lng); // buf.UngetWriteBuf (); // InsertText (0, buf); // } // file.Close(); wxStyledTextCtrl::LoadFile(m_filename); EmptyUndoBuffer(); // determine lexer language wxFileName fname (m_filename); InitializePrefs (DeterminePrefs (fname.GetFullName())); return true; }
ParticleManager::~ParticleManager() { ClearAll(); ClearInUse(); while (!_unused.empty()) { delete _unused.top(); _unused.pop(); } /* for (auto it = _inUse.begin(); it != _inUse.end(); ++it) { for (auto it2 = it->begin(); it2 != it->end(); ++it2) { for (auto it3 = it2->begin(); it3 != it2->end(); ++it3) { delete *it3; } } } for (auto it = _effects.begin(); it != _effects.end(); ++it) { for (auto it2 = it->begin(); it2 != it->end(); ++it2) { delete *it2; } } */ }
/*************************************************** SelectMode function is called to set new multiselection mode, this mode can be one of following: UG_MULTISELECT_OFF (0) - sindle selection mode UG_MULTISELECT_CELL(1) - cell multiselection mode enabled UG_MULTISELECT_ROW (2) - row multiselection mode enabled The SelectMode can be called directly or as a result of a call to the CUGCtrl::SetMultiSelectMode. Params: mode - indicates the new selection mode to set. Returns: UG_SUCCESS, this function will never fail. *****************************************************/ int CUGMultiSelect::SelectMode(int mode) { ClearAll(); m_mode = mode; return UG_SUCCESS; }
void wxBitmapDataObject::SetBitmap( const wxBitmap &bitmap ) { ClearAll(); wxBitmapDataObjectBase::SetBitmap(bitmap); DoConvertToPng(); }
void DataTransfer::Disconnect() { SetMode(Mode::Protected); if (PrefProtected()) { ClearAll(); } }
LogStream::LogStream(){ mLogTree = new XmlTree(); mOptionsTree = new XmlTree(); bDefaultAutoPrint = false; bCurrentEntryLocked = false; for(int i=0;i<LOGSTREAM_MAXINDENT;i++) mSpaces[i] = ' '; mSpaces[LOGSTREAM_MAXINDENT] = 0; ClearAll(); }
void idBoundsTrack::Test() { ClearAll(); idRandom r; for( int i = 0 ; i < 1800 ; i++ ) { idBounds b; for( int j = 0 ; j < 3 ; j++ ) { b[0][j] = r.RandomInt( 20000 ) - 10000; b[1][j] = b[0][j] + r.RandomInt( 1000 ); } SetIndex( i, b ); } const idBounds testBounds( idVec3( -1000, 2000, -3000 ), idVec3( 1500, 4500, -500 ) ); SetIndex( 1800, testBounds ); SetIndex( 0, testBounds ); const shortBounds_t shortTestBounds( testBounds ); int intersectedIndexes1[ MAX_BOUNDS_TRACK_INDEXES ]; const int numHits1 = FindBoundsIntersectionsTEST( shortTestBounds, boundsList, maxIndex, intersectedIndexes1 ); int intersectedIndexes2[ MAX_BOUNDS_TRACK_INDEXES ]; const int numHits2 = FindBoundsIntersectionsSimSIMD( shortTestBounds, boundsList, maxIndex, intersectedIndexes2 ); idLib::Printf( "%i intersections\n", numHits1 ); if( numHits1 != numHits2 ) { idLib::Printf( "different results\n" ); } else { for( int i = 0 ; i < numHits1 ; i++ ) { if( intersectedIndexes1[i] != intersectedIndexes2[i] ) { idLib::Printf( "different results\n" ); break; } } } // run again for debugging failure FindBoundsIntersectionsTEST( shortTestBounds, boundsList, maxIndex, intersectedIndexes1 ); FindBoundsIntersectionsSimSIMD( shortTestBounds, boundsList, maxIndex, intersectedIndexes2 ); // timing const int64 start = Sys_Microseconds(); for( int i = 0 ; i < 40 ; i++ ) { FindBoundsIntersectionsSimSIMD( shortTestBounds, boundsList, maxIndex, intersectedIndexes2 ); } const int64 stop = Sys_Microseconds(); idLib::Printf( "%" PRId64 " microseconds for 40 itterations\n", stop - start ); }
void MainWindow::onFileSelected(QString szArchiveFile) { ClearAll(); std::wstring szFile = szArchiveFile.toStdWString(); CMemoryMappedFile File; if (File.Create(szFile.c_str()) == false) { ui->statusBar->showMessage("Failure opening file"); return; } CIffContainer Iff; CIffHeader *pHead = Iff.ParseIffFile(File); if (pHead == nullptr) { ui->statusBar->showMessage("No supported header"); return; } setWindowTitle(m_szBaseTitle + " - " + szArchiveFile); QString szMsg; szMsg.append("File size: ").append(QString::number(File.GetSize())) .append(" File type: ").append(IdToString(pHead->m_iTypeID)); ui->statusBar->showMessage(szMsg); // file head-chunk QString szIdString; szIdString = IdToString(pHead->m_iFileID); szIdString += "="; szIdString += IdToString(pHead->m_iTypeID); QTreeWidgetItem *pTopItem = new QTreeWidgetItem((QTreeWidgetItem*)0); pTopItem->setText(0, IdToString(pHead->m_iTypeID)); //pTopItem->setText(0, szIdString); pTopItem->setText(1, QString::number(pHead->m_iOffset)); pTopItem->setText(2, QString::number(pHead->m_iDataSize)); ui->treeWidget->addTopLevelItem(pTopItem); m_FormToItem.insert(pHead, pTopItem); CIffHeader *pComposite = pHead->m_pComposite; while (pComposite != nullptr) { HeaderToDisplay(pComposite); pComposite = pComposite->m_pComposite; } ChunksToDisplay(pHead, pTopItem); ui->treeWidget->expandAll(); ui->treeWidget->resizeColumnToContents(0); //ui->treeWidget->sortByColumn(1); }
void OutputCtrl::Clear() { SetReadOnly( false ); ClearAll(); SetReadOnly( true ); m_Selected = -1; ClearErrors(); }
//------------------------------------------------------------------------- void tEditLoginPass::OnShowEditLogin(bool Visible, bool Modal) { if(!Visible && !Modal) { ClearAll(); } this->setVisible(Visible); this->setModal(Modal); }
void TriangulationECWindow::FourBoxesThreeNested(int i0, int i1, int i2) { ClearAll(); mExample = 5; mPositions.resize(16); mPositions[0] = { 64.0f, 16.0f }; mPositions[1] = { 448.0f, 16.0f }; mPositions[2] = { 448.0f, 496.0f }; mPositions[3] = { 64.0f, 496.0f }; mPositions[4] = { 320.0f, 32.0f }; mPositions[5] = { 320.0f, 240.0f }; mPositions[6] = { 384.0f, 240.0f }; mPositions[7] = { 384.0f, 32.0f }; mPositions[8] = { 320.0f, 272.0f }; mPositions[9] = { 320.0f, 480.0f }; mPositions[10] = { 384.0f, 480.0f }; mPositions[11] = { 384.0f, 272.0f }; mPositions[12] = { 128.0f, 272.0f }; mPositions[13] = { 128.0f, 480.0f }; mPositions[14] = { 192.0f, 480.0f }; mPositions[15] = { 192.0f, 272.0f }; mOuter.resize(4); mOuter[0] = 0; mOuter[1] = 1; mOuter[2] = 2; mOuter[3] = 3; mFillSeeds.push_back(Vector2<float>{ 128.0f, 32.0f }); mInner0.resize(4); mInner0[0] = 4; mInner0[1] = 5; mInner0[2] = 6; mInner0[3] = 7; mInner1.resize(4); mInner1[0] = 8; mInner1[1] = 9; mInner1[2] = 10; mInner1[3] = 11; mInner2.resize(4); mInner2[0] = 12; mInner2[1] = 13; mInner2[2] = 14; mInner2[3] = 15; Triangulator::Polygon outer = { (int)mOuter.size(), &mOuter[0] }; std::vector<Triangulator::Polygon> inners(3); inners[i0] = { (int)mInner0.size(), &mInner0[0] }; inners[i1] = { (int)mInner1.size(), &mInner1[0] }; inners[i2] = { (int)mInner2.size(), &mInner2[0] }; Triangulator triangulator((int)mPositions.size(), &mPositions[0]); triangulator(outer, inners); mTriangles = triangulator.GetTriangles(); }
void NoteData::CopyAll( const NoteData* pFrom ) { Config(*pFrom); ClearAll(); for( int c=0; c<m_iNumTracks; c++ ) m_TapNotes[c] = pFrom->m_TapNotes[c]; m_HoldNotes = pFrom->m_HoldNotes; m_AttackMap = pFrom->m_AttackMap; }
nsHttpAuthCache::~nsHttpAuthCache() { if (mDB) ClearAll(); nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService(); if (obsSvc) { obsSvc->RemoveObserver(mObserver, "webapps-clear-data"); mObserver->mOwner = nullptr; } }
/* ============================================================== BitArray::Init Initializes the bit array for a given number of entries. \param numBits [in] max number of entries in the array \return true if success ============================================================== */ bool BitArray::Init( UINT numBits ) { mSize = BitsToUInts( numBits ); // Get ram for n bits. free_array( mBits ); mBits = c_cast(UINT*)mxAlloc( sizeof(UINT) * mSize ); // Set all bits to 0. ClearAll(); return true; }