mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Initial commit
This commit is contained in:
commit
6f2b57168d
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
# git ls-files --others --exclude-from=.git/info/exclude
|
||||
# Lines that start with '#' are comments.
|
||||
# For a project mostly in C, the following would be a good set of
|
||||
# exclude patterns (uncomment them if you want to use them):
|
||||
# *.[oa]
|
||||
# *~
|
||||
profanity
|
84
profanity.c
Normal file
84
profanity.c
Normal file
@ -0,0 +1,84 @@
|
||||
#include <ncurses.h>
|
||||
#include <string.h>
|
||||
|
||||
void init()
|
||||
{
|
||||
initscr();
|
||||
raw();
|
||||
keypad(stdscr, TRUE);
|
||||
start_color();
|
||||
|
||||
init_color(COLOR_WHITE, 1000, 1000, 1000);
|
||||
init_pair(1, COLOR_WHITE, COLOR_BLACK);
|
||||
init_pair(2, COLOR_GREEN, COLOR_BLACK);
|
||||
|
||||
init_color(COLOR_BLUE, 0, 0, 250);
|
||||
init_pair(3, COLOR_WHITE, COLOR_BLUE);
|
||||
|
||||
attron(A_BOLD);
|
||||
attron(COLOR_PAIR(1));
|
||||
}
|
||||
|
||||
void print_title()
|
||||
{
|
||||
int rows, cols;
|
||||
char *title = "PROFANITY";
|
||||
|
||||
getmaxyx(stdscr, rows, cols);
|
||||
|
||||
attron(COLOR_PAIR(3));
|
||||
mvprintw(1, (cols - strlen(title))/2, title);
|
||||
attroff(COLOR_PAIR(3));
|
||||
}
|
||||
|
||||
void close()
|
||||
{
|
||||
int rows, cols;
|
||||
char *exit_msg = "< HIT ANY KEY TO EXIT >";
|
||||
|
||||
getmaxyx(stdscr, rows, cols);
|
||||
|
||||
attron(A_BLINK);
|
||||
curs_set(0);
|
||||
mvprintw(rows-10, (cols - strlen(exit_msg))/2, exit_msg);
|
||||
|
||||
refresh();
|
||||
getch();
|
||||
endwin();
|
||||
}
|
||||
|
||||
void get_name(char *name)
|
||||
{
|
||||
}
|
||||
|
||||
void show_name(char *name)
|
||||
{
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int ypos = 2;
|
||||
int xpos = 2;
|
||||
int ch;
|
||||
char *name;
|
||||
|
||||
init();
|
||||
|
||||
print_title();
|
||||
ypos += 2;
|
||||
mvprintw(ypos, xpos, "Enter your name: ");
|
||||
echo();
|
||||
getstr(name);
|
||||
noecho();
|
||||
|
||||
ypos += 2;
|
||||
mvprintw(ypos, xpos, "Shit, ");
|
||||
attron(COLOR_PAIR(2));
|
||||
printw("%s", name);
|
||||
attroff(COLOR_PAIR(2));
|
||||
|
||||
printw("\n");
|
||||
close();
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user