Converts the ncurses test from wchar_t to regular char.
This commit is contained in:
@@ -36,46 +36,46 @@ int set_double_border(WINDOW* screen) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
// setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
// char buffer[255] = {0};
|
char buffer[255] = {0};
|
||||||
// WINDOW* pWindow = nullptr;
|
WINDOW* pWindow = nullptr;
|
||||||
// // Load ncurses and initialize stdscr.
|
// Load ncurses and initialize stdscr.
|
||||||
// initscr();
|
initscr();
|
||||||
// pWindow = stdscr;
|
pWindow = stdscr;
|
||||||
// // Enable raw mode to give us direct access to extra keys.
|
// Enable raw mode to give us direct access to extra keys.
|
||||||
// raw();
|
raw();
|
||||||
// // Disable echoing characters as they are typed.
|
// Disable echoing characters as they are typed.
|
||||||
// noecho();
|
noecho();
|
||||||
// // Enable keypad characters. (function keys, arrow keys, and numpad keys.)
|
// Enable keypad characters. (function keys, arrow keys, and numpad keys.)
|
||||||
// keypad(pWindow, true);
|
keypad(pWindow, true);
|
||||||
// // Remove the delay when pressing esc.
|
// Remove the delay when pressing esc.
|
||||||
// set_escdelay(0);
|
set_escdelay(0);
|
||||||
|
|
||||||
// int key = KEY_RESIZE;
|
int key = KEY_RESIZE;
|
||||||
// while(key != KEY_ESCAPE) {
|
while(key != KEY_ESCAPE) {
|
||||||
// if (key == KEY_RESIZE) {
|
if (key == KEY_RESIZE) {
|
||||||
// // Clear the screen.
|
// Clear the screen.
|
||||||
// werase(pWindow);
|
werase(pWindow);
|
||||||
// // Draw a box around the window with default chars.
|
// Draw a box around the window with default chars.
|
||||||
// set_double_border(pWindow);
|
set_double_border(pWindow);
|
||||||
// // Display the event
|
// Display the event
|
||||||
// mvwaddwstr(pWindow, 2, 2, "Resized");
|
mvwaddstr(pWindow, 2, 2, "Resized");
|
||||||
// // Get the window width and height.
|
// Get the window width and height.
|
||||||
// int width;
|
int width;
|
||||||
// int height;
|
int height;
|
||||||
// getmaxyx(pWindow, height, width);
|
getmaxyx(pWindow, height, width);
|
||||||
// // Display the width and height.
|
// Display the width and height.
|
||||||
// swprintf(buffer, sizeof(buffer), "width: %i, height: %i", width, height);
|
snprintf(buffer, sizeof(buffer), "width: %i, height: %i", width, height);
|
||||||
// mvwaddwstr(pWindow, 1, 2, buffer);
|
mvwaddstr(pWindow, 1, 2, buffer);
|
||||||
// } else {
|
} else {
|
||||||
// // Display the keycode of the key that was pressed in hex and octal.
|
// Display the keycode of the key that was pressed in hex and octal.
|
||||||
// swprintf(buffer, sizeof(buffer), "0x%04X %04o pressed", key, key);
|
snprintf(buffer, sizeof(buffer), "0x%04X %04o pressed", key, key);
|
||||||
// mvwaddwstr(pWindow,2, 2, buffer);
|
mvwaddstr(pWindow,2, 2, buffer);
|
||||||
// }
|
}
|
||||||
// wrefresh(pWindow);
|
wrefresh(pWindow);
|
||||||
// key = wgetch(pWindow);
|
key = wgetch(pWindow);
|
||||||
// }
|
}
|
||||||
// endwin();
|
endwin();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user