Cycles Standalone: Add a help message, which appears when pressing the "h" key.

This is very basic for now, but can be extended with more info (available devices for example) later.

Thanks to Bastien and Sergey for some help with the glRect coordinates stuff.
This commit is contained in:
Thomas Dinges 2014-01-24 12:57:19 +01:00
parent 456dc16e4a
commit 544b7e6be4
3 changed files with 36 additions and 1 deletions

@ -45,7 +45,7 @@ struct Options {
int width, height;
SceneParams scene_params;
SessionParams session_params;
bool quiet;
bool quiet, show_help;
} options;
static void session_print(const string& str)
@ -167,6 +167,9 @@ static void display_info(Progress& progress)
latency, sample, total_time, sample_time, status.c_str());
view_display_info(str.c_str());
if(options.show_help)
view_display_help();
}
static void display()
@ -189,6 +192,8 @@ static void keyboard(unsigned char key)
{
if(key == 'r')
options.session->reset(session_buffer_params(), options.session_params.samples);
else if(key == 'h')
options.show_help = !(options.show_help);
else if(key == 27) // escape
options.session->progress.set_cancel("Canceled");
}

@ -74,6 +74,35 @@ void view_display_info(const char *info)
glColor3f(1.0f, 1.0f, 1.0f);
}
void view_display_help()
{
const int w = V.width / 1.15;
const int h = V.height / 1.15;
const int x1 = (V.width - w) / 2;
const int x2 = x1 + w;
const int y1 = (V.height - h) / 2;
const int y2 = y1 + h;
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(0.4f, 0.4f, 0.4f, 0.8f);
glRectf(x1, y1, x2, y2);
glDisable(GL_BLEND);
glColor3f(0.8f, 0.8f, 0.8f);
view_display_text(x1+20, y2-20, "Cycles Renderer");
view_display_text(x1+20, y2-40, "(C) 2011-2014 Blender Foundation");
view_display_text(x1+20, y2-80, "Help:");
view_display_text(x1+20, y2-100, "h: Toggle this help message");
view_display_text(x1+20, y2-120, "r: Restart the render");
view_display_text(x1+20, y2-140, "q: Quit the program");
glColor3f(1.0f, 1.0f, 1.0f);
}
static void view_display()
{
if(V.first_display) {

@ -34,6 +34,7 @@ void view_main_loop(const char *title, int width, int height,
ViewKeyboardFunc keyboard);
void view_display_info(const char *info);
void view_display_help();
void view_redraw();
CCL_NAMESPACE_END