/*! * Draws all the elements * for one bar */ void AgentSelectorRenderer::drawIPABar(int agent, IPAStim *stim) { // Convert those percentages to pixels int amount_x = (float)kIpaBarWidth * ((float)stim->getAmount()/100.0); int effect_x = (float)kIpaBarWidth * ((float)stim->getEffect()/100.0); int dependency_x = (float)kIpaBarWidth * ((float)stim->getDependency()/100.0); IPAStim::IPAType type = stim->getType(); // Draw a bar between the current level and the dependency marker // x needs to be leftmost... int left, width; boxify(left, width, amount_x, dependency_x); if(width > 0) { g_Screen.drawRect(getIpaBarLeftForAgent(agent) + left, getIpaBarTop(agent, type), width, kIpaBarHeight, colourForIpaType(type)); } // NB: this bar stops rendering when it's neck-a-neck with 'amount' if(amount_x != effect_x) { boxify(left, width, effect_x, dependency_x); if(width > 0) { g_Screen.drawRect(getIpaBarLeftForAgent(agent) + left, getIpaBarTop(agent, type), width, kIpaBarHeight, dim_colour(type)); } } // Draw a vertical white line to mark the dependency level g_Screen.drawVLine(getIpaBarLeftForAgent(agent) + dependency_x, getIpaBarTop(agent, type), kIpaBarHeight, 12); }
BOOST_FORCEINLINE result_type operator()(A0 const& l, A0 const & u, A1 const &n, A2 const &) const { return boost::proto:: make_expr < nt2::tag::logspace_ , container::domain > ( boxify(of_size(1,n)) , boxify(nt2::details::logspace<A0>(l,u,n)) , meta::as_<A0>() ); }
BOOST_FORCEINLINE result_type operator()(A0 const& i, A1 const& j, FS const& fs, T const& ) const { return boost::proto ::make_expr < nt2::tag::deltac_ , container::domain > ( boxify(fs) , boxify(constant_t(i, j)) , target_t() ); }
BOOST_FORCEINLINE result_type operator()(A0 const& l, A0 const& s, A0 const& u) const { std::size_t n = (s) ?((u>l)? ((u-l+s)/s) : 0) : u; return boost::proto::make_expr< nt2::tag::colon_ , container::domain > ( boxify(of_size(1,n)) , boxify(nt2::details::colon<A0>(l,s)) , meta::as_<A0>() ); }
BOOST_FORCEINLINE result_type operator()(A0 const& a0, A1 const& a1) const { _2D sizee; sizee[0] = a0; sizee[1] = a0; return boost::proto::make_expr<nt2::tag::chow_, container::domain> ( boost::cref(a0), boost::cref(a1), A1(0), boxify(sizee)); }
BOOST_FORCEINLINE result_type operator()(A0 const& a0, A1 const& order ) const { size_t along = nt2::firstnonsingleton(a0)-1; size_t o = order; ext_t sizee = nt2::extent(a0); if (sizee[along]) sizee[along]--; return boost::proto::make_expr<nt2::tag::diff_, container::domain> (boost::cref(a0),along,o,boxify(sizee)); }
BOOST_FORCEINLINE result_type operator()(A0 const& a0) const { _2D sizee; sizee[0] = a0; sizee[1] = a0; return boost::proto:: make_expr<nt2::tag::chebvand_, container::domain> ( boost::cref(a0) , boost::cref(a0) , meta::as_<double>() , boxify(sizee) ); }
BOOST_FORCEINLINE result_type operator()(A0 const& a0, A1 const& a1) const { _2D sizee; sizee[0] = sizee[1] = a0; value_t d = value_t(0.01); return boost::proto:: make_expr<nt2::tag::dorr_, container::domain> ( boost::cref(a0) , d , boxify(sizee) ); }
static void process_events() { SDL_Event event; SDL_LockMutex(event_lock); while (SDL_PollEvent(&event)) { if (event.type == SDL_WINDOWEVENT) { if (event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) { SDL_GetWindowSize(screen,&win_w,&win_h); SDL_Rect newsize = boxify(); SDL_RenderSetViewport(renderer, &newsize); } } else if (event.type == SDL_QUIT) { end_emulation(); pending_sdl_thread_exit = true; #ifdef RUN_TESTS end_testing = true; #endif } } SDL_UnlockMutex(event_lock); }
BOOST_FORCEINLINE result_type operator()(A0 const& l, A1 const& u) const { relative_t that = {l,u}; return boost::proto:: make_expr<tag::relative_colon_, container::domain>(boxify(that)); }