first commit
This commit is contained in:
18
ncurses test/Makefile
Normal file
18
ncurses test/Makefile
Normal file
@@ -0,0 +1,18 @@
|
||||
# Compiler and flags
|
||||
CXX = g++
|
||||
CXXFLAGS = -Wall -Wextra -O2 -std=c++17
|
||||
|
||||
# Linker flags
|
||||
LDFLAGS = -lcurses
|
||||
|
||||
# Default target
|
||||
all: ncursestest
|
||||
|
||||
# Build rule
|
||||
ncursestest: ncursestest.cpp
|
||||
$(CXX) $(CXXFLAGS) ncursestest.cpp -o ncursestest $(LDFLAGS)
|
||||
|
||||
# Clean build artifacts
|
||||
clean:
|
||||
rm -f ncursestest
|
||||
|
||||
BIN
ncurses test/ncursestest
Executable file
BIN
ncurses test/ncursestest
Executable file
Binary file not shown.
37
ncurses test/ncursestest.cpp
Normal file
37
ncurses test/ncursestest.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <curses.h>
|
||||
#include <unistd.h>
|
||||
#include <cstring>
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
initscr();//creates stdscr. important step
|
||||
use_default_colors();//this apparently tells it to use default terminal colors whenever there is no color attribute applied
|
||||
|
||||
printw("Hello World\n");
|
||||
printw("Please enter a string: ");
|
||||
refresh();
|
||||
char *arr = new char[1024];
|
||||
getstr(arr);
|
||||
printw("Wow I didn't think you'd type in THAT. You entered: ");
|
||||
printw(arr);
|
||||
|
||||
start_color();
|
||||
init_pair(1,COLOR_RED, COLOR_BLUE);
|
||||
attron(COLOR_PAIR(1));
|
||||
printw("\nThe quick brown fox jumps over the lazy dog\n");
|
||||
attroff(COLOR_PAIR(1));
|
||||
|
||||
mvprintw(17, 7, "BRUUUUUUUUH");
|
||||
|
||||
move(12,13);
|
||||
attron(A_STANDOUT | A_UNDERLINE);
|
||||
mvprintw(15, 3, "");
|
||||
attroff(A_STANDOUT | A_UNDERLINE);
|
||||
mvaddch(4,3, '@');
|
||||
refresh();
|
||||
getch();
|
||||
endwin();
|
||||
}
|
||||
Reference in New Issue
Block a user