msoftcon.h

来自「此程序可实现可视界面下的电梯模拟运行」· C头文件 代码 · 共 54 行

H
54
字号
//msoftcon.h
//declarations for Lafore's console graphics functions
//uses Window's console functions

//#include <windows.h>     //for Windows console functions
#include <conio.h>       //for kbhit(), getche()
#include <graphics.h>
void init_graphics();
void set_cursor_pos(int x, int y);
void clear_screen();
void clear_line();


void set_cursor_pos(int x, int y)
{
   //COORD cursor_pos;              //origin in upper left corner
   //cursor_pos.X = x - 1;          //Windows starts at (0, 0)
   //cursor_pos.Y = y - 1;          //we start at (1, 1)
   //SetConsoleCursorPosition(hConsole, cursor_pos);
	gotoxy(x,y);
}

void clear_screen()
{
    int j;
    set_cursor_pos(1, 25);
    for(j=0; j<25; j++)
	putch('\n');
    set_cursor_pos(1, 1);
}

void init_graphics()
{
   //COORD console_size = {80, 25};
   //open i/o channel to console screen
   //hConsole = CreateFile("CONOUT$", GENERIC_WRITE | GENERIC_READ,
   //                FILE_SHARE_READ | FILE_SHARE_WRITE,
   //                0L, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0L);
   //set to 80x25 screen size
   //SetConsoleScreenBufferSize(hConsole, console_size);
   //set text to white on black
   //SetConsoleTextAttribute( hConsole, (WORD)((0 << 4) | 15) );

   clear_screen();
}

void clear_line()  //clear to end of line
{
    //.....1234567890123456789012345678901234567890
    //.....0........1.........2.........3.........4
    cputs("                                        ");
    cputs("                                        ");
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?