/** * @brief Creates a window with an ok button. * * @usage tk.msg( "Title", "This is a message." ) * * @luaparam title Title of the window. * @luaparam message Message to display in the window. * @luafunc msg( title, message ) */ static int tk_msg( lua_State *L ) { const char *title, *str; NLUA_MIN_ARGS(2); title = luaL_checkstring(L,1); str = luaL_checkstring(L,2); dialogue_msgRaw( title, str ); return 0; }
/** * @brief Opens a dialogue window with an ok button and a message. * * @param caption Window title. * @param fmt Printf style message to display. */ void dialogue_msg( const char* caption, 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_msgRaw( caption, msg ); }
/** * @brief Sets the default gameplay options. */ static void opt_gameplayDefaults( unsigned int wid, char *str ) { (void) str; /* Ask user. */ if (!dialogue_YesNoRaw( "Restore Defaults", "Are you sure you want to restore default gameplay settings?" )) return; /* Restore. */ conf_setGameplayDefaults(); opt_gameplayUpdate( wid, NULL ); /* Alert user it worked. */ dialogue_msgRaw( "Defaults Restored", "Gameplay settings restored to defaults."); }
/** * @brief Restores the key defaults. */ static void opt_keyDefaults( unsigned int wid, char *str ) { (void) str; /* Ask user if he wants to. */ if (!dialogue_YesNoRaw( "Restore Defaults", "Are you sure you want to restore default keybindings?" )) return; /* Restore defaults. */ input_setDefault(); /* Regenerate list widget. */ window_destroyWidget( wid, "lstKeybinds" ); menuKeybinds_genList( wid ); /* Alert user it worked. */ dialogue_msgRaw( "Defaults Restored", "Keybindings restored to defaults."); }
/** * @brief Sets the audio defaults. */ static void opt_audioDefaults( unsigned int wid, char *str ) { (void) str; /* Ask user. */ if (!dialogue_YesNoRaw( "Restore Defaults", "Are you sure you want to restore default audio settings?" )) return; /* Set defaults. */ conf_setAudioDefaults(); /* Have sound levels affect. */ sound_volume(conf.sound); music_volume(conf.music); /* Update widgets. */ opt_audioUpdate( wid, NULL ); /* Alert user it worked. */ dialogue_msgRaw( "Defaults Restored", "Audio settings restored to defaults."); }