I am using the ncurses library to write a console application. I have a function that is suppose to write to a window buffer and then refresh the window. In my test function I then call the window function and something happens, since the program moves to the next line (getch() which just waits for a character from me), but nothing is displayed.
Here is my function:
void UI::drawAudience(int audience1, int audience2)
{
string bar1 = "", bar2 = "";
for (int i; i < BAR_SIZE; i++)
{
bar1 += (i <= audience1) ? ' ' : '+';
if (i <= audience2)
bar2 += '+';
}
string audienceName = "Audience Name";
//mvwprintw(audience, 0, 11 - audienceName.size() / 2, "%s", audienceName.c_str());
//mvwprintw(audience, 1, 0, "%s|%s", bar1.c_str(), bar2.c_str());
wprintw(audience, "Test");
wrefresh(audience);
}
Here is my test code:
#include "Tests.h"
#include <string>
using namespace std;
void test()
{
int y = 1;
UI testUI;
initscr();
cbreak();
WINDOW* windowTest = newwin(1, 23, 3, 0);
wprintw(windowTest, "This is a new window");
wrefresh(windowTest);
getch();
clear();
delwin(windowTest);
testUI.drawAudience(4,5);
getch();
endwin();
}