void Editor::draw_object_with_numbers_at (const GraIt& i, const int nr, const int max, const int px, const int py) { std::ostringstream s; s << nr << "/" << max; Help::draw_shadow_centered_text(map_frames, font_med, s.str().c_str(), i->get_x() - px + i->get_xl()/2, i->get_y() - py, color[COL_TEXT], color[COL_API_SHADOW]); }
// Wird je nach Torus-Einstellung mehrmals von find_check aufgerufen, where_xy. void Editor::find_check_at( Selection& s, GraLi& l, GraIt g, Editor::FindBy findby, const int whx, const int why ) { if (findby == Editor::FIND_BY_TRANSP) { const int col = g->get_pixel(whx - g->get_x(), why - g->get_y()); if (col != color[COL_TRANSPARENT] && col != color[COL_PINK]) { s.o = g; s.l = &l; } } else { if (whx - g->get_x() >= g->get_selbox_x() && whx - g->get_x() < g->get_selbox_x() + g->get_selbox_xl() && why - g->get_y() >= g->get_selbox_y() && why - g->get_y() < g->get_selbox_y() + g->get_selbox_yl()) { s.o = g; s.l = &l; } } }
void Editor::draw() { // Draw the map // If drawing takes very long, wait until after dragging. if (draw_required && (draw_dragging || ( !hardware.key_hold(KEY_UP) && !hardware.key_hold(KEY_RIGHT) && !hardware.key_hold(KEY_DOWN) && !hardware.key_hold(KEY_LEFT) && !hardware.get_mlh() ))) { draw_required = false; int clock = Help::timer_ticks; // clear_screen_rectangle() is not enough to prevent drag remainders map.clear_to_color(color[COL_PINK]); for (int type = Object::TERRAIN; type != Object::MAX; ++type) for (GraIt i = object[Object::perm(type)].begin(); i != object[Object::perm(type)].end(); ++i) i->draw_with_trigger_area(); clock = Help::timer_ticks - clock; if (clock < Help::timer_ticks_per_second / 5) draw_dragging = true; else draw_dragging = false; } draw_selection_borders(); // Write numbers onto hatches and goals GraIt i; unsigned n; for (n = 0, i = object[Object::GOAL] .begin(); i != object[Object::GOAL] .end(); ++i) draw_object_with_numbers(i, ++n, object[Object::GOAL] .size()); for (n = 0, i = object[Object::HATCH].begin(); i != object[Object::HATCH].end(); ++i) draw_object_with_numbers(i, ++n, object[Object::HATCH].size()); if (browser_bitmap) { // the browser is so large that it covers the status bar bar.hide(); } else { bar.show(); bar.set_down(false); // it's managed by Api::Manager and thus calced update_bar_text(); } Api::Manager::draw(); // Mouse cursor on top // The mouse positioning code is here as well, as Editor::calc_self() // is skipped whenever a sub-window is open. mouse_cursor.set_x(hardware.get_mx()-mouse_cursor_offset); mouse_cursor.set_y(hardware.get_my()-mouse_cursor_offset); mouse_cursor.draw(); pre_screen->clear_to_color(bg_color); // Draw everything to pre_screen map .draw(*pre_screen); map_frames.draw(*pre_screen); Api::Manager::draw_to_pre_screen(); blit_to_screen(pre_screen->get_al_bitmap()); }