Exemplo n.º 1
0
/**
 * @brief Opens a dialogue window with an ok button, a message and an image.
 *
 *    @param caption Window title.
 *    @param img Path of the image file (*.png) to display.
 *    @param fmt Printf style message to display.
 */
void dialogue_msgImg( const char* caption, const char *img, const char *fmt, ... )
{
   char msg[4096];
   va_list ap;

   if (fmt == NULL) return;
   else { /* get the message */
      va_start(ap, fmt);
      vsnprintf(msg, 4096, fmt, ap);
      va_end(ap);
   }

   dialogue_msgImgRaw( caption, msg, img, -1, -1 );
}
Exemplo n.º 2
0
/**
 * @brief Creates a window with an ok button, text and an image.
 *
 * @usage tk.msg( "Title", "This is a message.", "character.png" )
 *
 *    @luaparam title Title of the window.
 *    @luaparam message Message to display in the window.
 *    @luaparam image Image file (*.png) to display in the window.
 *    @luaparam width (opt) width of the image to display; defaults to 256.
 *    @luaparam height (opt) height of the image to display; defaults to 256.
 * @luafunc msg( title, message, image )
 */
static int tk_msgImg( lua_State *L )
{
   const char *title, *str, *img;
   int width, height;
   NLUA_MIN_ARGS(3);

   // Get fixed arguments : title, string to display and image filename
   title = luaL_checkstring(L,1);
   str   = luaL_checkstring(L,2);
   img   = luaL_checkstring(L,3);

   // Get optional arguments : width and height
   width  = 256;
   height = 256;

   dialogue_msgImgRaw( title, str, img, width, height );
   return 0;
}