73 lines
2.0 KiB
C
73 lines
2.0 KiB
C
//
|
|
// Created by zhang on 2024/12/8.
|
|
//
|
|
#include <stdio.h>
|
|
#include <stdbool.h>
|
|
#include <windows.h>
|
|
#include "./include/function.h"
|
|
#include "./include/ui.h"
|
|
#include "./include/myerror.h"
|
|
#include "./include/extern.h"
|
|
#include "./include/curses.h"
|
|
#define WELCOME_UI 1
|
|
#define LOGIN_UI 2
|
|
#define SIGNIN_UI 3
|
|
void myexit() {
|
|
endwin();
|
|
exit(0);
|
|
}
|
|
|
|
//void test() {
|
|
// // 初始化 ncurses
|
|
// initscr();
|
|
// cbreak(); // 禁用行缓冲
|
|
// noecho(); // 不显示输入字符
|
|
// curs_set(0); // 隐藏光标
|
|
//
|
|
// // 启用所有鼠标事件
|
|
// mousemask(ALL_MOUSE_EVENTS, NULL);
|
|
//
|
|
// // 创建一个新的窗口
|
|
// WINDOW *win = newwin(10, 30, 5, 5);
|
|
// box(win, 0, 0); // 为窗口添加边框
|
|
// mvwprintw(win, 1, 1, "Click inside this window.");
|
|
// keypad(win,TRUE);
|
|
// wrefresh(win); // 刷新窗口以显示内容
|
|
//
|
|
// MEVENT event; // 用于存储鼠标事件
|
|
//
|
|
// while (1) {
|
|
// int ch = wgetch(win); // 从指定窗口获取输入
|
|
//
|
|
// if (ch == KEY_MOUSE) {
|
|
// if (nc_getmouse(&event) == OK) {
|
|
// // 打印鼠标事件的信息
|
|
// mvwprintw(win, 3, 1, "Mouse at (%d, %d), button %d", event.x, event.y, event.bstate);
|
|
// wrefresh(win); // 刷新窗口以显示鼠标点击位置
|
|
// }
|
|
// } else {
|
|
// mvwprintw(win, 4, 1, "You pressed a key: %c", ch);
|
|
// wrefresh(win); // 刷新窗口以显示按键信息
|
|
// break; // 按键退出循环
|
|
// }
|
|
// }
|
|
//
|
|
// // 等待用户按键后退出
|
|
// getch();
|
|
//
|
|
// // 清理和结束程序
|
|
// endwin();
|
|
// return;
|
|
//}
|
|
|
|
int main() {
|
|
int code=Welcome_ui();
|
|
while(1){
|
|
switch(code){
|
|
case WELCOME_UI:code=Welcome_ui();break;
|
|
case LOGIN_UI:code=Login_ui();break;
|
|
case SIGNIN_UI:code=Signin_ui();break;
|
|
case 0:myexit();
|
|
}
|
|
}
|
|
} |