-
Notifications
You must be signed in to change notification settings - Fork 47
Hello World Program
Anthony edited this page Feb 19, 2019
·
6 revisions
#include <cppurses/cppurses.hpp>
using namespace cppurses;
int main() {
// Must create this object before any Widgets are created.
System sys;
// Create a text string with Attributes, has type Glyph_string.
Glyph_string greeting{"Hello, World!", Attribute::Underline};
// Create Textbox Widget with `greeting` as the initial text.
Textbox tb{greeting};
// Set the background and foreground colors of the Textbox.
tb.brush.set_background(Color::Dark_blue);
tb.brush.set_foreground(Color::Light_blue);
// Enable a border to be drawn around the Textbox.
tb.border.enable();
// Set the Textbox as the head(top-level) Widget, initialize the screen and
// start the user input event loop.
return sys.run(tb);
}
cmake_minimum_required(VERSION 3.2)
add_executable(main main.cpp)
# _If_ CPPurses is submodule in a directory named external/:
add_subdirectory(external/CPPurses)
target_link_libraries(main cppurses)
# _If_ CPPurses is installed on your system:
target_compile_features(main PRIVATE cxx_std_14)
target_compile_options(main PRIVATE -Wall -Wextra)
target_link_libraries(main cppurses ncurses pthread)