⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 msoftcon.cpp

📁 此程序可实现可视界面下的电梯模拟运行
💻 CPP
字号:
//msoftcon.cpp
//provides routines to access Windows console functions

#include "msoftcon.h"
#include <graphics.h>
HANDLE hConsole;         //console handle

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()
{
    set_cursor_pos(1, 25);
    for(int 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -