void output_char(WINDOW* wnd, unsigned char c) { remove_cursor(wnd); switch(c){ case '\n': case 13: wnd->cursor_x = 0; wnd->cursor_y++; break; case '\b': if(wnd->cursor_x!=0){ wnd->cursor_x--; } else { if(wnd->cursor_y!=0){ wnd->cursor_x = wnd->width - 1; wnd->cursor_y--; } } break; default: poke_screen(wnd->x + wnd->cursor_x,wnd->y + wnd->cursor_y,(short unsigned int) c | (default_color << 8)); wnd->cursor_x++; if(wnd->cursor_x == wnd->width){ wnd->cursor_x = 0; wnd->cursor_y++; } break; } if(wnd->cursor_y == wnd->height) scroll_window(wnd); show_cursor(wnd); }
void output_char(WINDOW* wnd, unsigned char c) { remove_cursor(wnd); MEM_ADDR offset = (wnd->cursor_y + wnd->y) * (80 * 2) + (wnd->x + wnd->cursor_x) * 2; if (c == '\n') { move_cursor(wnd, 0, wnd->cursor_y + 1); } else { poke_w(0xb8000 + offset, c | 0x0f00); move_cursor(wnd, wnd->cursor_x + 1, wnd->cursor_y); } show_cursor(wnd); }
BOOL move_ghost(GHOST* ghost, int dx, int dy) { int old_x = ghost->x; int old_y = ghost->y; int new_x = old_x + dx; int new_y = old_y + dy; if (maze[new_y][new_x] != ' ') // Don't run into a wall return FALSE; move_cursor(pacman_wnd, old_x, old_y); remove_cursor(pacman_wnd); move_cursor(pacman_wnd, new_x, new_y); show_cursor(pacman_wnd); ghost->x = new_x; ghost->y = new_y; return TRUE; }
void output_char(WINDOW* wnd, unsigned char c) { volatile int flag; DISABLE_INTR(flag); remove_cursor(wnd); switch (c) { case '\n': case 13: wnd->cursor_x = 0; wnd->cursor_y++; break; case '\b': if (wnd->cursor_x != 0) { wnd->cursor_x--; } else { if (wnd->cursor_y != 0) { wnd->cursor_x = wnd->width - 1; wnd->cursor_y--; } } break; case 14: poke_screen(wnd->x + wnd->width, wnd->y + wnd->cursor_y, (short unsigned int) 0xB3 | (default_color << 8)); wnd->cursor_y++; break; default: poke_screen(wnd->x + wnd->cursor_x, wnd->y + wnd->cursor_y, (short unsigned int) c | (default_color << 8)); wnd->cursor_x++; // if (wnd->cursor_x == wnd->width) { // wnd->cursor_x = 0; // wnd->cursor_y++; // } break; } if (wnd->cursor_y == wnd->height) scroll_window(wnd); show_cursor(wnd); ENABLE_INTR(flag); }