void WndInvokePopUp( a_window *wnd, gui_point *point, gui_menu_struct *menu ) { int dummy; if( _Isnt( wnd, WSW_ALLOW_POPUP ) ) return; WndMenuItem( wnd, MENU_INITIALIZE, WndMenuRow, WndMenuPiece ); if( menu != NULL && wnd->num_popups == 1 ) { if( menu->style & GUI_GRAYED ) { Ring(); } else { WndMenuItem( wnd, wnd->popupmenu[ 0 ].id, WndMenuRow, WndMenuPiece ); } } else if( wnd->num_popups != 0 ) { if( menu == NULL ) { WndCreateFloatingPopup( wnd, point, wnd->num_popups, wnd->popupmenu, &wnd->last_popup ); } else if( menu->style & GUI_GRAYED ) { Ring(); } else if( menu->child == NULL ) { WndMenuItem( wnd, menu->id, WndMenuRow, WndMenuPiece ); } else { WndCreateFloatingPopup( wnd, point, menu->num_child_menus, menu->child, &dummy ); } } }
void Smooth::QuickUpdate() { for (int x=0;x<sizex;x++) { for (int y=0;y<sizey;y++) { double ring_total=0.0; double disk_total=0.0; for (int x1=0;x1<sizex;x1++) { int deltax=TorusDifference(x,x1,sizex); if (deltax>outer+smoothing/2) continue; for (int y1=0;y1<sizey;y1++) { int deltay=TorusDifference(y,y1,sizey); if (deltay>outer+smoothing/2) continue; double radius=std::sqrt(deltax*deltax+deltay*deltay); double fieldv=(*field)[x1][y1]; ring_total+=fieldv*Ring(radius); disk_total+=fieldv*Disk(radius); } } (*fieldNew)[x][y]=transition(disk_total/normalisation_disk,ring_total/normalisation_ring); } } std::vector<std::vector<density> > * fieldTemp; fieldTemp=field; field=fieldNew; fieldNew=fieldTemp; frame++; }
void Smooth::SeedRing() { for (int x=0;x<sizex;x++) { for (int y=0;y<sizey;y++) { (*field)[x][y]=Ring(Radius(0,0,x,y)); } } }
STATIC int sasmDetailLine( a_window *wnd, int row, bool multi_level ) /*******************************************************************/ { wnd=wnd; multi_level=multi_level; Ring(); return( row ); }
filling Smooth::FillingRing(int x, int y) const { double total=0.0; for (int x1=0;x1<sizex;x1++) { for (int y1=0;y1<sizey;y1++) { total+=(*field)[x1][y1]*Ring(Radius(x,y,x1,y1)); } }; return total/normalisation_ring; }
double Smooth::NormalisationRing() const { double total=0.0; for (int x=0;x<sizex;x++) { for (int y=0;y<sizey;y++) { total+=Ring(Radius(0,0,x,y)); } }; return total; }
RingBox::RingBox(const vector<Point2f> ¢ers, const vector<float> &radii, const vector<Rect> &roi) { int boxSize = centers.size(); rings.resize(boxSize); for (int i = 0; i < boxSize; ++i) { rings[i] = Ring(centers[i], radii[i], roi[i]); } }
static void NotFound( a_window *wnd, regexp *rx, char *msg ) { Ring(); WndNextRow( wnd, WND_NO_ROW, WND_RESTORE_ROW ); WndStatusText( msg ); WndFreeRX( rx ); WndDoingSearch = FALSE; WndRepaint( wnd ); }
Ring ICharacter::unequipRing2() { Ring returnRing = ring2; updateStats(-ring2.getStrength(), -ring2.getDexterity(), -ring2.getConstitution(), -ring2.getIntelligence(), -ring2.getWisdom(), -ring2.getCharisma()); this -> ring2 = Ring(0, 0, 0, 0, 0, 0); return returnRing; }
static void WPBackOut( a_window * wnd ) /*************************************/ { sio_data * curr_sio; curr_sio = WndExtra( wnd ); if( curr_sio->level_open == 0 ) { Ring(); return; } WPZoomIn( wnd, curr_sio->level_open-1 ); }
//================================================================================================ //------+++--> Called When Main Window Receives WM_TIMER - Sound the Alarm if Clock has Run Out...: void OnTimerTimer(HWND hwnd) //-------------------------------------------+++--> { DWORD tick; int idx; if(!m_timers) return; tick=GetTickCount()/1000; for(idx=0; idx<m_timers; ) { DWORD elapsed = tick-m_timer[idx].tickonstart; if(elapsed >= m_timer[idx].seconds){ int id=m_timer[idx].id; StopTimer(id); Ring(hwnd,id); }else ++idx; } }
void RingBox::update(const cv::Mat &inp) { vector<vector<Point> > contours_ring; Mat initial_ring_mask = inp.clone(); vector<Vec4i> hierarchy_ring; vector<Point2f> centre; vector<Rect> initial_roi; vector<float> radius; //imshow("Initial mask", initial_ring_mask); findContours(initial_ring_mask, contours_ring, hierarchy_ring, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE, Point(0, 0)); unsigned int No_of_ring = contours_ring.size(); vector<bool> markedRing(No_of_ring, true); for (int i = 0; i < No_of_ring; ++i) { if (contours_ring[i].size() < 35) { markedRing[i] = false; } } unsigned int count = 0; for (int i = 0; i < No_of_ring; ++i) { if (markedRing[i]) { ContourFeature cFeat(contours_ring[i]); centre.push_back(cFeat.getCentre()); //centre.y += 10; initial_roi.push_back(boundingRect(contours_ring[i])); // This is a OpenCV function radius.push_back(sqrt(pow(boundingRect(contours_ring[i]).width, 2.0) + pow(boundingRect(contours_ring[i]).height, 2.0)) / 2); ++count; } } assert(count == 6); int boxSize = centre.size(); rings.resize(boxSize); for (int i = 0; i < boxSize; ++i) { rings[i] = Ring(centre[i], radius[i], initial_roi[i]); } }
void Wormhole3ContinuousOutputs::update() { for (auto ri = begin(mRings); ri != end(mRings);) { if (!ri->Active) { ri = mRings.erase(ri); } else { ri->Step(mParamRingSpeed*mReceived.z); ++ri; } } if (getElapsedFrames() % mParamSpawnTime == 0) { auto r = mReceived.x; auto b = mReceived.y; mRings.push_back(Ring(Color(r, 1, b), vec2(mReceived.x, mReceived.y))); } mData->bufferData(mRings.size()*sizeof(Ring), mRings.data(), GL_DYNAMIC_DRAW); }
STATIC int simageDetailLine( a_window *wnd, int row, bool multi_level ) /*********************************************************************/ { sio_data *curr_sio; image_info *image; curr_sio = WndExtra( wnd ); image = SImageGetImage( wnd, row ); if( image == NULL ) { if( !multi_level ) { Ring(); } return( row ); } if( image->exe_not_found ) { if( !multi_level ) { ErrorMsg( LIT( Exe_Not_Found ), image->name ); } return( row ); } if( image->dip_handle == NO_MOD ) { if( !multi_level ) { ErrorMsg( LIT( No_Symbol_Info ), image->name ); } return( row ); } if( image->exe_changed ) { if( !multi_level ) { ErrorMsg( LIT( Exe_Has_Changed ), image->name ); image->exe_changed = false; } } curr_sio->level_open++; curr_sio->curr_image = image; gatherSort( curr_sio ); return( 0 ); }
void Wormhole3ContinuousOutputs::setup() { setupParams(); mReceived = vec3(1); mCamera.setPerspective(60.0f, getWindowAspectRatio(), 0.1f, 10.f); mCamera.lookAt(vec3(0, kEyeDepth, 0), vec3(), vec3(0, 1, 0)); mShader = gl::GlslProg::create(loadAsset("shaders/wormhole.vert"), loadAsset("shaders/wormhole.frag")); auto mesh = gl::VboMesh::create(geom::Torus().center(vec3()).radius(0.5f, 0.49f).subdivisionsAxis(64).subdivisionsHeight(4)); geom::BufferLayout attribs; attribs.append(geom::CUSTOM_0, 4, sizeof(Ring), offsetof(Ring, Tint), 1); attribs.append(geom::CUSTOM_1, 3, sizeof(Ring), offsetof(Ring, Position), 1); attribs.append(geom::CUSTOM_2, 2, sizeof(Ring), offsetof(Ring, Size), 1); mRings.push_back(Ring(Color(1, 0, 0), vec2(mReceived.x, mReceived.y))); mData = gl::Vbo::create(GL_ARRAY_BUFFER, mRings, GL_DYNAMIC_DRAW); mesh->appendVbo(attribs, mData); mDraw = gl::Batch::create(mesh, mShader, { {geom::CUSTOM_0, "i_Tint"},{ geom::CUSTOM_1, "i_Position" },{ geom::CUSTOM_2, "i_Size" } }); setupListener(); }
STATIC bool sampleSetLine( a_window *wnd, int row, int piece, wnd_line_piece *line ) /************************************************************/ { sio_data *curr_sio; clicks_t bar_range; gui_ord catcher_extent; gui_ord slacker; int wnd_rows; if( piece >= PIECE_LAST ) { return( false ); } curr_sio = WndExtra( wnd ); wnd_rows = SampleNumRows( wnd ); if( row > wnd_rows-1 ) { Ring(); return( false ); } catcher_extent = 0; if( sampNewRow ) { catcher_extent = BAR_TAIL_POINT - (WndMaxCharX( wnd ) / 2); catcher_extent = WPPixelTruncWidth( catcher_extent ); bar_range = catcher_extent * dispCount; if( curr_sio->total_samples == 0 ) { curr_sio->total_samples = 1; } if( localTicks == 0 ) { localTicks = 1; } if( maxTime == 0 ) { maxTime = 1; } slacker = WPPixelWidth( wnd ); if( !absGraphBar ) { bar2Extent = 0; } else { if( !barMaxTime || relGraphBar ) { bar2Extent = bar_range / curr_sio->total_samples; } else { bar2Extent = bar_range / maxTime; } if( bar2Extent < slacker && bar_range != 0 ) { bar2Extent = slacker; } } if( !relGraphBar ) { barExtent = 0; } else { if( barMaxTime ) { barExtent = bar_range / maxTime; } else { barExtent = bar_range / localTicks; } if( barExtent < slacker && bar_range != 0 ) { barExtent = slacker; } } barExtent = WPPixelTruncWidth( barExtent ); bar2Extent = WPPixelTruncWidth( bar2Extent ); if( barExtent < bar2Extent ) { barExtent = bar2Extent; } } if( piece == PIECE_MOUSE_CATCHER ) { line->indent = 0; line->text = LIT( Empty_Str ); line->extent = catcher_extent - barExtent; line->tabstop = false; line->master_tabstop = true; } else if( piece == PIECE_BAR ) { line->extent = barExtent; line->indent = BAR_TAIL_POINT - barExtent; if( WPPixelTruncWidth( WndMaxCharX( wnd ) / 2 ) == 0 ) { line->indent -= WndMaxCharX( wnd ) / 2; } if( barExtent || bar2Extent ) { barData.bar_style = GUI_BAR_SHADOW; barData.bar_colour = WPA_REL_BAR; barData.bar_colour2 = WPA_ABS_BAR; barData.bar_size2 = bar2Extent; barData.bar_group = true; barData.bar_selected = false; line->draw_bar = true; line->text = (char *)&barData; } else { line->text = LIT( Empty_Str ); } line->tabstop = false; line->master_tabstop = true; } else if( piece == PIECE_SEPARATOR ) { line->indent = SEPARATOR_POINT; line->vertical_line = true; line->text = LIT( Empty_Str ); line->attr = WPA_PLAIN; line->tabstop = false; line->master_tabstop = true; } else if( piece == PIECE_DETAIL_NAME ) { line->indent = SEPARATOR_POINT + WndMaxCharX( wnd ); line->text = dispName; if( dispHighLight ) { line->attr = WPA_STANDOUT; } else { line->attr = WPA_PLAIN; } line->tabstop = true; line->master_tabstop = true; } else { return( false ); } return( true ); }
static void WPZoomIn( a_window *wnd, int row ) /********************************************/ { sio_data *curr_sio; int detail_rows; int top_line; int old_level; int curr_line; bool multi_level; curr_sio = WndExtra( wnd ); if( row >= curr_sio->level_open && row < STATUS_ROW ) { Ring(); return; } if( row < curr_sio->level_open ) { curr_sio->level_open = row; WndSetTop( wnd, 0 ); gatherSort( curr_sio ); if( curr_sio->level_open == LEVEL_ROUTINE ) { curr_line = srtnOpenDetail( curr_sio, false ); } else { curr_line = WPGetRow( curr_sio ); } } else { row = row - STATUS_ROW - 1; curr_line = row; detail_rows = SampleNumRows( wnd ); if( detail_rows < row+1 ) { Ring(); return; } multi_level = false; for( ;; ) { old_level = curr_sio->level_open; curr_line = overviewDetailRtns[curr_sio->level_open]( wnd, row, multi_level ); if( old_level == curr_sio->level_open ) break; detail_rows = SampleNumRows( wnd ); if( detail_rows != 1 ) break; row = 0; multi_level = true; } } curr_sio->curr_proc_row = -WND_MAX_ROW; curr_sio->curr_display_row = -WND_MAX_ROW; detail_rows = SampleNumRows( wnd ); top_line = WndTop( wnd ); row = curr_line - top_line; if( row >= WndRows( wnd ) ) { top_line = curr_line - WndRows( wnd ) / 2; } if( row < 0 ) { top_line = curr_line; } if( detail_rows-top_line < WndRows( wnd ) ) { top_line = detail_rows - WndRows( wnd ); if( top_line < 0 ) { top_line = 0; } } WndSetTop( wnd, top_line ); WndNewCurrent( wnd, curr_line, PIECE_DETAIL_NAME ); WndDirty( wnd ); if( curr_sio->level_open < LEVEL_SOURCE && curr_sio->asm_file != NULL ) { WPAsmClose( curr_sio->asm_file ); curr_sio->asm_file = NULL; } if( curr_sio->level_open < LEVEL_ROUTINE && curr_sio->src_file != NULL ) { WPSourceClose( curr_sio->src_file ); curr_sio->src_file = NULL; } }
void Ring::resetAll() { for(int i=0;i<MAXRINGS;++i) rings[i] = Ring(); }