GrAPiC
Graphics for Algo/Prog in C/C++

◆ menu_add()

void grapic::menu_add ( Menu &  m,
const std::string &  str 
)
inline

Add a line to the menu m with the text str.

Menu m;
bool stop=false;
winInit("Tutorials", 500, 500);
menu_add( m, "Question 1");
menu_add( m, "Question 2");
while( !stop )
{
menu_draw(m, 5,5, 100, 102);
switch(menu_select(m))
{
case 0 : draw1(); break;
case 1 : draw2(); break;
}
stop = winDisplay();
}
void menu_add(Menu &m, const std::string &str)
Add a line to the menu m with the text str.
Definition: Grapic.h:694
bool winDisplay()
Display the window. All drawing is hidden until this function is not called.
Definition: Grapic.h:300
void menu_draw(Menu &m, int xmin=5, int ymin=5, int xmax=-1, int ymax=-1)
Draw the menu on the screen. See menu_add for an example of usage.
Definition: Grapic.h:721
void winClear()
Clear the window with the default background color.
Definition: Grapic.h:262
void winQuit()
Quit and close all things.
Definition: Grapic.h:307
int menu_select(const Menu &m)
return the line selected in the menu. See menu_add for an example of usage.
Definition: Grapic.h:727
void winInit(const char *name, int w, int h, int posx=-1, int posy=-1)
Initialize the window with a size w,h and a position (posx,posy). If posx<0 or posy<0,...
Definition: Grapic.h:245