linux curses图形库中光标移动程序实例
来源:互联网 发布:淘宝连衣裙店铺 编辑:程序博客网 时间:2024/05/17 20:24
//此程序可实现移动光标功能
#include <curses.h>
#include <stdio.h>
#include<stdlib.h>
#define StartX 1
#define StartY 1
void initial();
main()
{
int x = StartX;
int y = StartY;
int ch;
initial();
box(stdscr,'|','-');
attron(A_REVERSE);
mvaddstr(0,20,"curses program");
attroff(A_REVERSE);
move(x,y);
do{
ch = getch();
switch(ch)
{
case KEY_UP:
--y;
break;
case KEY_DOWN:
++y;
break;
case KEY_RIGHT:
++x;
break;
case KEY_LEFT:
--x;
break;
case ' ':
++y;
x=0;
break;
case '/t':
x+=7;
break;
case KEY_BACKSPACE:
mvaddch(y,--x,' ');
break;
case 27:
endwin();
exit(1);
default:
addch(ch);
x++;
break;
}
move(y,x);
}while(1);
}
void initial()
{
initscr();
cbreak();
nonl();
noecho();
intrflush(stdscr,false);
keypad(stdscr,true);
refresh();
}
#include <curses.h>
#include <stdio.h>
#include<stdlib.h>
#define StartX 1
#define StartY 1
void initial();
main()
{
int x = StartX;
int y = StartY;
int ch;
initial();
box(stdscr,'|','-');
attron(A_REVERSE);
mvaddstr(0,20,"curses program");
attroff(A_REVERSE);
move(x,y);
do{
ch = getch();
switch(ch)
{
case KEY_UP:
--y;
break;
case KEY_DOWN:
++y;
break;
case KEY_RIGHT:
++x;
break;
case KEY_LEFT:
--x;
break;
case ' ':
++y;
x=0;
break;
case '/t':
x+=7;
break;
case KEY_BACKSPACE:
mvaddch(y,--x,' ');
break;
case 27:
endwin();
exit(1);
default:
addch(ch);
x++;
break;
}
move(y,x);
}while(1);
}
void initial()
{
initscr();
cbreak();
nonl();
noecho();
intrflush(stdscr,false);
keypad(stdscr,true);
refresh();
}
阅读全文
0 0
- linux curses图形库中光标移动程序实例
- Linux终端图形库Curses简介和实例分析
- Linux终端图形库 Curses简介和实例分析
- Linux终端图形库 Curses简介和实例分析
- Linux/Unix终端图形库curses简介
- linux下的图形编程库curses
- curses库(LINUX/UNIX图形函数库)
- Linux下curses光标控制
- linux中curses库编程
- linux bash中快速移动光标
- Linux vi中移动光标命令
- Linux vi 中移动光标 命令
- linux中curses
- 2 curses库IO处理--光标操作
- Linux下图形函数库---curses.h
- Linux下图形函数库2---curses.h
- linux 移动光标快捷键
- 在C#程序中使控件跟随光标移动
- LoadRunner11安装+破解 笔记
- 日期转换
- myeclipse 2016 检出maven项目 部署启动项目
- hbase shell命令注意事项
- ESXI5.5虚拟机还原快照数据恢复处理办法
- linux curses图形库中光标移动程序实例
- Table表格导出为Excel、csv、txt、sql、json、xml、Word格式
- Elastic-Job-Lite 分析( 作业配置)
- 移动前端开发之viewport的深入理解
- HDU 1221 Rectangle and Circle(判定圆与矩形是否相交)
- 2017-09-08 LeetCode_009 Palindrome Number
- vue-cli#2.0项目结构分析
- iOS JS 交互之利用系统JSContext实现 JS调用oc方法
- The way to minimize the C++ binary file compiled by arm g++