int main_loop() { int running = 1; while(running) { // update_allwin(); usleep(100); if(kbhit()) { running = on_keypress(); } } cleanup_allwin(); return 0; }
void Edit::draw() { if(is_visible()) // is it visible? { if(is_active()) // is it disabled? {} double x = get_position().x; double y = get_position().y; double angle = get_angle(); double scale_x = get_scale().x; double scale_y = get_scale().y; int width = get_width(); int height = get_height(); int red = get_color().x; int green = get_color().y; int blue = get_color().z; int alpha = get_color().w; void * font = (get_label() ? get_label()->get_font()->get_data() : nullptr); Vector4 text_color = get_text_color(); // Draw edit Renderer::draw_edit(get_text(), x, y, width, height, angle, scale_x, scale_y, red, green, blue, alpha, multilined, cursor, cursor_x, cursor_y); // Draw text if(!label->get_string().empty()) { label->draw(); label->set_position(x, y + cursor_y); label->set_scale(0.5, 0.5); label->set_color(text_color); } // if mouse over edit, change mouse to I-beam // edit is pressed, set cursor at position_pressed on_hover(); on_mousepress(); on_keypress(); on_backspace(); on_enter(); } }