int main() { initscr(); cbreak(); nodelay(stdscr, TRUE); noecho(); curs_set(0); keypad(stdscr, TRUE); getmaxyx(stdscr, rows, cols); srand(time(NULL)); UFO_ART_SIZE = strlen(UFO_ART); AUP_ART_SIZE = strlen(AUP_ART); aup.lives = AUP_LIVES; aup.megakills = AUP_MEGAKILLS; populate(); while (1) { draw_all(); run_ufos(); run_aup(); run_shots(); draw_all(); update_state(); } return 0; }
void RatslamGraphics::end() { driver->setRenderTarget(rt, true, true, irr::video::SColor(255, 0, 0, 0)); draw_all(true, true, true, false); driver->setRenderTarget(0, true, true, irr::video::SColor(255, 0, 0, 0)); if (video_writer->isOpened()) { driver->setRenderTarget(rt, true, true, irr::video::SColor(255, 0, 0, 0)); draw_all(false, true, true, true); driver->setRenderTarget(0, true, true, irr::video::SColor(255, 0, 0, 0)); } driver->draw2DImage(rt, irr::core::rect<irr::s32>(0, 0, rt->getSize().Width, rt->getSize().Height), irr::core::rect<irr::s32>(0, 0, rt->getSize().Width, rt->getSize().Height)); // draw_all(true, true, true, true); driver->endScene(); if (video_writer->isOpened()) { unsigned char * image_ptr = image_buffer; unsigned char * texture_ptr = (unsigned char*)rt->lock(true); unsigned char * texture_ptr_end = texture_ptr + rt->getSize().getArea() * 4; while (texture_ptr < texture_ptr_end) { *(image_ptr++) = *(texture_ptr++); *(image_ptr++) = *(texture_ptr++); *(image_ptr++) = *(texture_ptr++); texture_ptr++; } rt->unlock(); *video_writer << cv::Mat(rt->getSize().Height, rt->getSize().Width, CV_8UC3, (void*) image_buffer); } }
RATSLAM_API RatslamGraphics::~RatslamGraphics() { begin(); driver->setRenderTarget(rt, true, true, irr::video::SColor(255, 0, 0, 0)); draw_all(true, true, true, true); driver->setRenderTarget(0, true, true, irr::video::SColor(255, 0, 0, 0)); driver->endScene(); irr::video::IImage * image = driver->createImageFromData(rt->getColorFormat(), rt->getSize(), rt->lock(true), true, false); driver->writeImageToFile(image, "screenshot.tga"); image->drop(); rt->unlock(); if (device) { device->drop(); device = NULL; } if (video_writer->isOpened() && video_writer) { delete video_writer; } }
int main(int argc, char *argv[]) { // to prevent gcc from complaining about unused variables (void) argc; (void) argv; if (init() == -1) return 0; while (!config.quit) { get_input(); // delta_time needs to be set right before calculating moves calc_fps(); process(); draw_all(); //usleep(5 * 1000); SDL_Delay(5); } clean_up(); return 0; }
static void expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer data) { state *st = (state *) data; if (!st->pin) move_clock (st); draw_all(st); }
void CompassWidget::redraw(void) { draw_all(bearing, heading, distance, accuracy); last_heading = heading; last_bearing = bearing; last_distance = distance; last_accuracy = accuracy; last_redraw = time(NULL); }
static void main_loop(void) { ALLEGRO_EVENT event; while (true) { if (al_is_event_queue_empty(event_queue)) draw_all(); al_wait_for_event(event_queue, &event); switch (event.type) { /* ALLEGRO_EVENT_JOYSTICK_AXIS - a joystick axis value changed. */ case ALLEGRO_EVENT_JOYSTICK_AXIS: if (event.joystick.stick < MAX_STICKS && event.joystick.axis < MAX_AXES) { joys[event.joystick.stick][event.joystick.axis] = event.joystick.pos; } break; /* ALLEGRO_EVENT_JOYSTICK_BUTTON_DOWN - a joystick button was pressed. */ case ALLEGRO_EVENT_JOYSTICK_BUTTON_DOWN: joys_buttons[event.joystick.button] = true; break; /* ALLEGRO_EVENT_JOYSTICK_BUTTON_UP - a joystick button was released. */ case ALLEGRO_EVENT_JOYSTICK_BUTTON_UP: joys_buttons[event.joystick.button] = false; break; case ALLEGRO_EVENT_KEY_DOWN: if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) return; break; /* ALLEGRO_EVENT_DISPLAY_CLOSE - the window close button was pressed. */ case ALLEGRO_EVENT_DISPLAY_CLOSE: return; case ALLEGRO_EVENT_JOYSTICK_CONFIGURATION: al_reconfigure_joysticks(); setup_joystick_values(al_get_joystick(0)); break; /* We received an event of some type we don't know about. * Just ignore it. */ default: break; } } }
void new_btn(char * str, char x, char y, char bg, char fg, void (*func)()) { int i; i = find_empty_index(); strcpy(btn_arr[i].str,str); btn_arr[i].x = x; btn_arr[i].y = y; btn_arr[i].bg = bg; btn_arr[i].fg = fg; btn_arr[i].func = func; draw_all(); }
/*----------------------------------------------------------------------------*/ void inf_loop () { for (;;) { draw_all (); if (!next_step ()) break; } return; }
int main( int argc, char **argv ) { if ( use_gui ) { printf("init_sdl()\n"); if ( init_sdl() ) return 1; printf("init_gl()\n"); init_gl(); } printf("init_fft()\n"); if ( init_fft() ) return 1; if ( use_serial ) { printf("init_serial()\n"); if ( init_serial() ) use_serial = FALSE; } init_lights(); init_table(); while ( !done ) { get_samples_do_fft(); detect_beats(); assign_lights(); assign_cells(); if ( use_gui ) { if (handle_sdl_events()) return 1; draw_all(); } if ( use_serial ) send_serial(); usleep(5000); } return 0; }
void modmore_redraw(void) { if(resize_for_menu_like() != 0) { return; } wresize(status_bar, 1, getmaxx(stdscr)); viewport_width = getmaxx(menu_win); viewport_height = getmaxy(menu_win); calc_vlines_wrapped(); goto_vline(curr_vline); draw_all(get_text_beginning()); was_redraw = 1; }
/*----------------------------------------------------------------------------*/ void num_loop (int num) { int n = 1; for (;;) { draw_all (); if (baby_is_game_end ()) { if (n == num) break; n++; baby_menu_newgame (/* TRUE */FALSE); } else baby_onestep_moves (-1, -1); } return; }
void DebugProcessor::draw() { if (my_debug_categories & DebugCategory::PHYSICS) { gather_physics(); } if (my_debug_categories & DebugCategory::BOUNDING_BOX) { gather_bounding_box(); } if (my_debug_categories & DebugCategory::AABB) { gather_aabb(); } if (my_debug_categories & DebugCategory::GEOMETRY_CACHE) { gather_geometry_cache(); } draw_all(); clear(); }
void CompassWidget::update(void) { if (abs(bearing - last_bearing) >= MIDI_UPDATE_BEARING_THRESHOLD || abs(heading - last_heading) >= MIDI_UPDATE_HEADING_THRESHOLD || abs(distance - last_distance) >= MIDI_UPDATE_DISTANCE_THRESHOLD || abs(accuracy - last_accuracy) >= MIDI_UPDATE_ACCURACY_THRESHOLD || ((time(NULL) - last_redraw >= MIDI_UPDATE_TIMEOUT) && (abs(bearing - last_bearing) > MINI_UPDATE_BEARING_THRESHOLD || abs(heading - last_heading) > MINI_UPDATE_HEADING_THRESHOLD || abs(distance - last_distance) > MINI_UPDATE_DISTANCE_THRESHOLD || abs(accuracy - last_accuracy) > MINI_UPDATE_ACCURACY_THRESHOLD) )) { // Draw over the old compass in white display->invert(true); draw_all(last_bearing, last_heading, last_distance, last_accuracy); display->invert(false); redraw(); } }
void DebugGraph::draw() { glPushMatrix(); glLoadIdentity(); double asp = (double)aspect_ratio; double orth = (double)orthoSize; double x_size = max_x - min_x; double y_size; if (calc_max_y) { y_size = x_size / asp; max_y = min_y + y_size; } else { y_size = max_y - min_y; } double x_orth_size = 2.0 * orth * asp; double y_orth_size = 2.0 * orth; glScaled(x_orth_size / x_size, y_orth_size / y_size, 1); glTranslated(-(max_x + min_x) / 2.0, -(max_y + min_y) / 2.0, 0); glBegin(GL_LINES); glColor3ub(192, 192, 192); glVertex2f(min_x, 0); glVertex2f(max_x, 0); glVertex2f(0, min_y); glVertex2f(0, max_y); glEnd(); draw_all(); glPopMatrix(); }
void update(int dummy) { int i, dir_diff, unclean; PLANE *pp, *p1, *p2; clck++; erase_all(); /* put some planes in the air */ do { unclean = 0; for (pp = ground.head; pp != NULL; pp = pp->next) { if (pp->new_altitude > 0) { delete(&ground, pp); append(&air, pp); unclean = 1; break; } } } while (unclean); /* do altitude change and basic movement */ for (pp = air.head; pp != NULL; pp = pp->next) { /* type 0 only move every other turn */ if (pp->plane_type == 0 && clck & 1) continue; pp->fuel--; if (pp->fuel < 0) loser(pp, "ran out of fuel."); pp->altitude += SGN(pp->new_altitude - pp->altitude); if (!pp->delayd) { dir_diff = pp->new_dir - pp->dir; /* * Allow for circle commands */ if (pp->new_dir >= 0 && pp->new_dir < MAXDIR) { if (dir_diff > MAXDIR/2) dir_diff -= MAXDIR; else if (dir_diff < -(MAXDIR/2)) dir_diff += MAXDIR; } if (dir_diff > 2) dir_diff = 2; else if (dir_diff < -2) dir_diff = -2; pp->dir += dir_diff; if (pp->dir >= MAXDIR) pp->dir -= MAXDIR; else if (pp->dir < 0) pp->dir += MAXDIR; } pp->xpos += displacement[pp->dir].dx; pp->ypos += displacement[pp->dir].dy; if (pp->delayd && pp->xpos == sp->beacon[pp->delayd_no].x && pp->ypos == sp->beacon[pp->delayd_no].y) { pp->delayd = 0; if (pp->status == S_UNMARKED) pp->status = S_MARKED; } switch (pp->dest_type) { case T_AIRPORT: if (pp->xpos == sp->airport[pp->dest_no].x && pp->ypos == sp->airport[pp->dest_no].y && pp->altitude == 0) { if (pp->dir != sp->airport[pp->dest_no].dir) loser(pp, "landed in the wrong direction."); else { pp->status = S_GONE; continue; } } break; case T_EXIT: if (pp->xpos == sp->exit[pp->dest_no].x && pp->ypos == sp->exit[pp->dest_no].y) { if (pp->altitude != 9) loser(pp, "exited at the wrong altitude."); else { pp->status = S_GONE; continue; } } break; default: loser(pp, "has a bizarre destination, get help!"); } if (pp->altitude > 9) /* "this is impossible" */ loser(pp, "exceeded flight ceiling."); if (pp->altitude <= 0) { for (i = 0; i < sp->num_airports; i++) if (pp->xpos == sp->airport[i].x && pp->ypos == sp->airport[i].y) { if (pp->dest_type == T_AIRPORT) loser(pp, "landed at the wrong airport."); else loser(pp, "landed instead of exited."); } loser(pp, "crashed on the ground."); } if (pp->xpos < 1 || pp->xpos >= sp->width - 1 || pp->ypos < 1 || pp->ypos >= sp->height - 1) { for (i = 0; i < sp->num_exits; i++) if (pp->xpos == sp->exit[i].x && pp->ypos == sp->exit[i].y) { if (pp->dest_type == T_EXIT) loser(pp, "exited via the wrong exit."); else loser(pp, "exited instead of landed."); } loser(pp, "illegally left the flight arena."); } } /* * Traverse the list once, deleting the planes that are gone. */ for (pp = air.head; pp != NULL; pp = p2) { p2 = pp->next; if (pp->status == S_GONE) { safe_planes++; delete(&air, pp); } } draw_all(); for (p1 = air.head; p1 != NULL; p1 = p1->next) for (p2 = p1->next; p2 != NULL; p2 = p2->next) if (too_close(p1, p2, 1)) { static char buf[80]; (void)snprintf(buf, sizeof buf, "collided with plane '%c'.", name(p2)); loser(p1, buf); } /* * Check every other update. Actually, only add on even updates. * Otherwise, prop jobs show up *on* entrance. Remember that * we don't update props on odd updates. */ if ((atcrandom() % sp->newplane_time) == 0) addplane(); }
void draw() { draw_all(game); // draw.c }
int game( int nlevel ){ LSDB lsdb; lsdb.lives = 3; lsdb.bombs = 0; lsdb.score = 0; lsdb.diamonds = 0; int die; gps player; int count = 0; int new_bomb = 0; int level = nlevel; int level_score = 0; int new_bomb_x, new_bomb_y; char map[MAP_HSIZE][MAP_WSIZE]; erase(); load_level( map, level, &player, &lsdb.diamonds ); draw_all( map, HZ, lsdb ); nodelay( stdscr, TRUE ); int run = 1; while( run ){ count++; die = 0; switch( tolower( getch() ) ){ case KEY_UP : if( move_player( map, &player, UP , &lsdb) == -1 ) die = 1; break; case KEY_DOWN : if( move_player( map, &player, DOWN , &lsdb) == -1 ) die = 1; break; case KEY_LEFT : if( move_player( map, &player, LEFT , &lsdb) == -1 ) die = 1; break; case KEY_RIGHT: if( move_player( map, &player, RIGHT, &lsdb) == -1 ) die = 1; break; case 'k' : die = 1; break; case 'h' : help() ; break; case 27 : run = false ; break; case 'q' : if(msgbox("Quit game == 'q' ? yes : no ")== 'q') run = false; break; case 'b' : if( lsdb.bombs ){ if( new_bomb == 0 ){ lsdb.bombs--; new_bomb = 1; new_bomb_y = player.y; new_bomb_x = player.x; } } break; case 't' : if( new_bomb ){ new_bomb = 0; die = 1; } else if( kaboom( map ) ) die = 1; break; default : break; } // switch( ch ) if( new_bomb ){ if( player.y != new_bomb_y || player.x != new_bomb_x ){ new_bomb = 0; map[new_bomb_y][new_bomb_x] = BOMB; } } if( count >= 4 ){ if( do_the_monster_dance( map, player ) ) die = 1; count = 0; } if( gravity( map, &new_bomb ) ) die = 1; if( die ){ kill_player(map, player ); lsdb.lives--; lsdb.bombs = 0; new_bomb = 0; if( lsdb.lives == 0 ){ if( msgbox( "continue == 'q' ? no : yes " ) != 'q' ) return level; else return 0 ; } lsdb.score = level_score; load_level( map, level, &player, &lsdb.diamonds ); } if( lsdb.diamonds <= 0 ){ level_score = lsdb.score; load_level( map, ++level, &player, &lsdb.diamonds ); } draw_all( map, HZ, lsdb ); } // while( run ) nodelay( stdscr, FALSE ); return 0; }
int main( int argc, char **argv ) { if ( use_gui ) { printf("init_sdl()\n"); if ( init_sdl() ) return 1; printf("init_gl()\n"); init_gl(); } printf("init_fft()\n"); init_fft(); #ifdef USE_FIFO printf("init_mpd()\n"); if ( init_mpd() ) return 1; #endif #ifdef USE_ALSA printf("init_alsa()\n"); if ( init_alsa() ) return 1; #endif if ( use_serial ) { printf("init_serial()\n"); if ( init_serial() ) use_serial = FALSE; } init_lights(); init_table(); pthread_t sample_thread; pthread_create(&sample_thread, NULL, &get_samples, NULL); while ( !done ) { // check to see if we have a new sample if (new_sample == 1) { // we are going to process this sample, it is no longer new pthread_mutex_lock(&sample_mutex); new_sample = 0; pthread_mutex_unlock(&sample_mutex); do_fft(); detect_beats(); assign_lights(); //assign_cells(); if ( use_gui ) { if (handle_sdl_events()) return 1; draw_all(); } if ( use_serial ) send_serial_fpga(); } usleep(5000); } return 0; }
/* This function must be first. Main function for mkkernel and kernel */ int main(int argc, char *argv[]){ if(argc == 0){ /* This is real kernel */ memory_end = (void *)0x1100800; head_task = 0; /* Setting entry point for system calls. START + 208 is end of huge string and begin of code of `main' function */ *(int *)START = (int)START + 208 + ((int)syscall - (int)main); int mouse = (SCREEN_HEIGHT / 2) * SCREEN_WIDTH + SCREEN_WIDTH / 2; /* Position of center of `X' */ /* Initialization of keyboard and mouse. I don't understand this code */ OUT(100, 209); while(IN(100) & 3){ IN(96); } OUT(96, 223); while(IN(100) & 3){ IN(96); } OUT(100, 168); while(IN(100) & 3){ IN(96); } OUT(96, 0); while(IN(100) & 3){ IN(96); } OUT(100, 212); while(IN(100) & 3){ IN(96); } OUT(96, 244); while((IN(100) & 3) == 0); IN(96); /* End of initialization */ { /* Starting initial `sh' process. I don't know why we cannot use normal string "sh" */ const char sh[] = {'s', 'h', 0}; syscall((int)sh, SYS_create_process); } draw_all(mouse); /* Initial screen update */ for(;;){ int in_100_returned; while(((in_100_returned = IN(100)) & 3) == 0); int in_96_returned = IN(96); if(in_100_returned & 32){ int moving = 0; /* `Are we moving some window?' In fact, this is boolean variable */ if(in_96_returned & 1){ /* Mouse is down, let's resort windows */ struct task_t *curr = 0; struct task_t *prev = 0; for(prev = 0, curr = head_task; curr != 0; prev = curr, curr = curr->next){ /* If mouse is inside curr */ if(mouse >= curr->begin && mouse < curr->begin + curr->size && (mouse - curr->begin) % SCREEN_WIDTH < curr->size % SCREEN_WIDTH){ moving = 1; if(prev != 0){ prev->next = curr->next; curr->next = head_task; head_task = curr; } break; } } } while((IN(100) & 3) == 0); { int offset = (signed char)IN(96); mouse += offset; if(moving){ head_task->begin += offset; } } while((IN(100) & 3) == 0); { int offset = (signed char)IN(96) * SCREEN_WIDTH; mouse -= offset; if(moving){ head_task->begin -= offset; } } draw_all(mouse); }else if((in_96_returned & 128) == 0){ /* Keyboard */ /* in_96_returned & 63 is hardware key code. For example, `q' has code 16, 'w' - 17, 'e' - 18 */ /* We look at keybord layout which is in the huge string */ (*head_task->handler)(head_task, msg_key, *(START + 131 + (in_96_returned & 63))); draw_all(mouse); } } }else{ /* This is `mkkernel' tool */ /* The first 0x1f0 bytes of kernel may be any symbols */ for(int i = 0; i != 0x1f0; ++i){ putchar(0); } /* * The huge string contents machine code and data. * The machine code uses hardware ports, for example 10h for graphical programming. * Also CPU is switched to 32-bit protected mode (lidt/lgdt/lmsw), but kernel and applications use same address space. * I don't fully understand this code. */ const char huge_string[] = /* START - 0x10 */ "\x00\x08\x10\x01\x00\x00\x00\x00\x59\x5a\x52\x51\xec\xc3\x55\xaa" /* START */ "\xeb\x2e\x48\x64\x72\x53\x00\x20\x59\x5a\x58\x50\x52\x51\xee\xc3" /* START + 0x10 */ "\x00\x00\x00\x80\x6b\x02\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00" /* START + 0x20 */ "\x00\x00\x00\x00\x00\x00\x0c\x00\x00\x00\x00\x00\xff\xff\xff\x00" /* START + 0x30 */ "\xb8\x01\x4f\xb9\x05\x41\x50\x51\xbf\x00\x10\x8e\xc7\xcd\x10\x5b" /* START + 0x40 */ "\x58\x40\xcd\x10\xb8\x30\x11\xb7\x06\xcd\x10\x2e\x89\x2e\x24\x00" /* START + 0x50 */ "\xfa\x2e\x0f\x01\x1e\x6b\x00\x2e\x0f\x01\x16\x12\x00\xb8\x01\x00" /* START + 0x60 */ "\x0f\x01\xf0\x66\xea\xc3\x02\x09\x00\x08\x00\x00\x00\x00\x00\x00" /* START + 0x70 */ "\x00\x00\x00\xff\xff\x00\x00\x00\x9a\xcf\x00\xff\xff\x00\x00\x00" /* START + 0x80 */ "\x92\xcf\x00" /* START + 0x83 */ " 1234567890-= qwertyuiop[]\n asdfghjkl; zxcvbnm,. " /* Keyboard layout */ /* START + 0xc3 */ "\x66\xb8\x10\x00\x8e\xd8\x8e\xd0\xbc\xf0\x01\x09\x00" /* START + 0xd0 */ ; /* We use putchar, because the huge string contents zeros */ for(int i = 0; i != 0x10 + 0xd0; ++i){ putchar(huge_string[i]); } /* We write our code to stdout */ for(int i = 0; i != 0xf30; ++i){ putchar(*(const char *)((int)main + (int)i)); } } return 0; }
/* Launch a dialog that asks OK/Cancel for a question, * pausing the game while it waits for input */ bool confirm(char *question) { int c; bool status=true; WINDOW *confirm; /* Cancel alarm */ alarm(0); game_pause(1); /* Only redraw the grid if the help isn't open */ if (!scrl_open) draw_grid(); redraw: confirm = newwin(row * 0.4, col * 0.7, row * 0.3, col * 0.15); /* Draw dialog */ wbkgd(confirm, COLOR_PAIR(C_DIALOG)); box(confirm, 0, 0); mvwaddstr(confirm, 0, col * 0.35 - 4, "Confirm"); mvwaddstr(confirm, 2, col * 0.35 - (strlen(question) / 2), question); /* Draw over top of everything */ overwrite(confirm, stats); /* Draw the options */ ungetch('h'); /* Handle input */ while ((c = getkey())) { switch (c) { case KEY_RESIZE: getmaxyx(stdscr, row, col); draw_all(); goto redraw; case KEY_LEFT: case KEY_RIGHT: case 'h': case 'l': case 'a': case 'd': case CTRL('f'): case CTRL('b'): wattrset(confirm, A_REVERSE); if (!status) { mvwaddstr(confirm, (row * 0.4) -3, col *0.35 - 9, " OK "); wattroff(confirm, A_REVERSE); mvwaddstr(confirm, (row * 0.4) -3, col *0.35, " Cancel "); } else { mvwaddstr(confirm, (row * 0.4) -3, col *0.35, " Cancel "); wattroff(confirm, A_REVERSE); mvwaddstr(confirm, (row * 0.4) -3, col *0.35 - 9, " OK "); } status = !status; wrefresh(confirm); break; /* Enter pressed */ case 10: werase(confirm); delwin(confirm); if (!scrl_open) { game_pause(0); } catch_alarm(0); fbar_time=0; return status; default: break; } } return 0; }
/* Launch a dialog that asks user for a string (e.g name) */ char *getstring(char *question) { int c, width, apos=0; WINDOW *dialog; char *answer; /* Cancel alarm */ alarm(0); game_pause(1); draw_grid(); scrl_open=1; answer = malloc(21); redraw: width = clamp(col*0.7, col*0.7, 60); dialog = newwin(8, width, row * 0.3, col*0.5 - width/2); /* Draw dialog */ wbkgd(dialog, COLOR_PAIR(C_DIALOG)); box(dialog, 0, 0); mvwaddstr(dialog, 2, width/2 - (strlen(question) / 2), question); /* Draw input box */ mvwhline(dialog, 4, 3, ACS_HLINE, width-7); mvwhline(dialog, 6, 3, ACS_HLINE, width-7); mvwaddch(dialog, 4, 3, ACS_ULCORNER); mvwaddch(dialog, 6, 3, ACS_LLCORNER); mvwaddch(dialog, 5, 3, ACS_VLINE); mvwaddch(dialog, 5, width-4, ACS_VLINE); mvwaddch(dialog, 4, width-4, ACS_URCORNER); mvwaddch(dialog, 6, width-4, ACS_LRCORNER); if (apos > 0) mvwaddstr(dialog, 5, 4, answer); wmove(dialog, 5, 4+apos); /* Draw over top of everything */ overwrite(dialog, stats); wrefresh(dialog); /* Handle input */ while ((c = getkey())) { switch (c) { case KEY_RESIZE: getmaxyx(stdscr, row, col); draw_all(); curs_set(1); goto redraw; /* Enter pressed */ case 10: werase(dialog); delwin(dialog); game_pause(0); catch_alarm(0); fbar_time=0; scrl_open=0; return answer; case KEY_BACKSPACE: case 127: /* Katch the Konsole backspace */ case 12: if (apos > 0) { mvwprintw(dialog, 5, 3+apos, " "); answer[--apos] = '\0'; wmove(dialog, 5, 4+apos); wrefresh(dialog); } break; default: if ((c >= 'A' && c<= 'Z') || (c>='a' && c<= 'z') || c==32 || c=='_' || (c>='1' && c<='9')) { if (apos>=20) break; answer[apos]=c; answer[++apos]='\0'; mvwaddch(dialog, 5, 3+apos, c); wmove(dialog, 5, 4+apos); wrefresh(dialog); } break; } } scrl_open=0; return NULL; }