Timeout::Timeout(int ms) : timer(service<TimeoutTag>(), boost::posix_time::milliseconds(ms)) { Goer goer = journey().goer(); timer.async_wait([goer](const Error& error) mutable { if (!error) goer.timedout(); }); }
int main(void) { t_data the; the.start = NULL; the.end = NULL; the = information(the); the.list = tab_to_list(the); if (the.start == NULL || the.end == NULL) error(); the = ft_link(the); journey(the); free(the.link); return (0); }
int main() { const std::string program_name{"Top Down V0.2"}; assert(program_name != ""); const float window_x{800.0f}; const float window_y{600.0f}; assert(window_x > 0.0f); assert(window_y > 0.0f); const sf::Vector2f window_sizes{window_x, window_y}; const float norm_radius{0.1f*window_y}; const int delaz{25}; assert(delaz > 0); const std::chrono::milliseconds delay(delaz); const sf::Color white{sf::Color(255, 255, 255)}; const sf::Color black{sf::Color(0, 0, 0)}; const sf::Color orange{sf::Color(255, 127, 0)}; const sf::Color purple{sf::Color(127, 0, 255)}; const sf::Color cyan{sf::Color(127, 255, 255)}; const sf::Color red{sf::Color(255, 0, 0)}; const sf::Color yellow{sf::Color(255, 255, 0)}; const sf::Color green{sf::Color(0, 255, 0)}; const sf::Color blue{sf::Color(0, 0, 255)}; const std::string nament_name{"Alesta"}; std::vector <float> attain_values{-1000.0f, 1000.0f}; const int steps{200}; float current_value{attain_values[0]}; float delta_value{start_delta_end(attain_values, steps)}; // std::cout << delta_value << ':' << delta_divider(delta_value) << '\n'; const float nament_size{15.0f}; const float valuent_size{25.0f}; //////////////////////////////////////// sf::RenderWindow window(sf::VideoMode(window_x, window_y), program_name, sf::Style::Default); const sf::Vector2f nament_posit{0.25f*window_sizes}; name_entity nament{nament_name, nament_size, nament_posit, yellow}; const sf::Vector2f valuent_posit{0.75f*window_sizes}; value_entity valuent{current_value, valuent_size, valuent_posit, cyan}; const sf::Vector2f circle_posit{0.5f*window_sizes}; circle_entity circlent{current_value, norm_radius, circle_posit}; while (window.isOpen()) { sf::Event event; window.clear(black); show_circle_ent(window, circlent); show_name_ent(window, nament); show_value_ent(window, valuent); window.display(); journey(attain_values, current_value, delta_value); revalue_circlent(circlent, current_value); revalue_valuent(valuent, current_value); std::this_thread::sleep_for(delay); if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)) { window.close(); return 1; } while (window.pollEvent(event)) { if (event.type == sf::Event::Closed) { window.close(); return 2; } } } return 0; }
void deferProceed(ProceedHandler proceed) { journey().deferProceed(proceed); }
void defer(Handler handler) { journey().defer(handler); }
void enableEvents() { journey().enableEvents(); }
void disableEvents() { journey().disableEvents(); }
void handleEvents() { journey().handleEvents(); }
void teleport(mt::IScheduler& scheduler) { journey().teleport(scheduler); }
int index() { return journey().index(); }
Waiter::Waiter() { proceed = journey().proceedHandler(); init0(); }