@@ -283,9 +283,9 @@ uintptr_t get_random()
283283Buffer get_name (Buffer buf )
284284{
285285 int32_t size = _ffb_get_name ((int )buf .head , buf .size );
286- File name ;
287- name .size = size ;
288- name .head = buf .head ;
286+ File name = {
287+ .size = size ,
288+ .head = buf .head } ;
289289 return name ;
290290}
291291
@@ -301,6 +301,48 @@ void quit()
301301 _ffb_quit ();
302302}
303303
304+ // -- STATS -- //
305+
306+ /// @brief Add the given value to the progress for the badge.
307+ ///
308+ /// @details May be negative if you want to decrease the progress.
309+ /// If zero, does not change the progress.
310+ ///
311+ /// If the Peer is COMBINED, the progress is added to every peer
312+ /// and the returned value is the lowest progress.
313+ Progress add_progress (Peer p , Badge b , int16_t v )
314+ {
315+ uint32_t r = _ffb_add_progress (p , b , v );
316+ Progress progress = {
317+ .done = r >> 16 ,
318+ .goal = r };
319+ return progress ;
320+ }
321+
322+ /// @brief Get the progress of earning the badge.
323+ Progress get_progress (Peer p , Badge b )
324+ {
325+ return add_progress (p , b , 0 );
326+ }
327+
328+ /// @brief Add the given score to the board.
329+ ///
330+ /// @details May be negative if you want the lower scores
331+ /// to rank higher. Zero value is not added to the board.
332+ ///
333+ /// If the Peer is COMBINED, the score is added for every peer
334+ /// and the returned value is the lowest of their best scores.
335+ Score add_score (Peer p , Board b , Score v )
336+ {
337+ return _ffb_add_score (p , b , v );
338+ }
339+
340+ /// @brief Get the personal best of the player.
341+ Score get_score (Peer p , Board b )
342+ {
343+ return add_score (p , b , 0 );
344+ }
345+
304346// -- AUDIO -- //
305347
306348/// @brief Add sine AudioNode as a child node for the given node.
0 commit comments