1 /* RetroArch - A frontend for libretro. 2 * Copyright (C) 2011-2021 - Daniel De Matteis 3 * Copyright (C) 2019-2021 - James Leaver 4 * 5 * RetroArch is free software: you can redistribute it and/or modify it under the terms 6 * of the GNU General Public License as published by the Free Software Found- 7 * ation, either version 3 of the License, or (at your option) any later version. 8 * 9 * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 10 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 11 * PURPOSE. See the GNU General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public License along with RetroArch. 14 * If not, see <http://www.gnu.org/licenses/>. 15 */ 16 17 #ifndef _MENU_SCREENSAVER_H 18 #define _MENU_SCREENSAVER_H 19 20 #include <retro_common_api.h> 21 #include <libretro.h> 22 23 #include "../retroarch.h" 24 #include "../gfx/gfx_display.h" 25 #include "../gfx/gfx_animation.h" 26 27 RETRO_BEGIN_DECLS 28 29 /* Prevent direct access to menu_screensaver_t members */ 30 typedef struct menu_ss_handle menu_screensaver_t; 31 32 /* Specifies all available screensaver effects */ 33 enum menu_screensaver_effect 34 { 35 MENU_SCREENSAVER_BLANK = 0, 36 MENU_SCREENSAVER_SNOW, 37 MENU_SCREENSAVER_STARFIELD, 38 MENU_SCREENSAVER_VORTEX, 39 MENU_SCREENSAVER_LAST 40 }; 41 42 /******************/ 43 /* Initialisation */ 44 /******************/ 45 46 /* Creates a new, 'blank' screensaver object. Auxiliary 47 * internal structures will be initialised on the first 48 * call of menu_screensaver_iterate(). 49 * Returned object must be freed using menu_screensaver_free(). 50 * Returns NULL in the event of an error. */ 51 menu_screensaver_t *menu_screensaver_init(void); 52 53 /* Frees specified screensaver object */ 54 void menu_screensaver_free(menu_screensaver_t *screensaver); 55 56 /*********************/ 57 /* Context functions */ 58 /*********************/ 59 60 /* Called when the graphics context is destroyed 61 * or reset (a dedicated 'reset' function is 62 * unnecessary) */ 63 void menu_screensaver_context_destroy(menu_screensaver_t *screensaver); 64 65 /**********************/ 66 /* Run loop functions */ 67 /**********************/ 68 69 /* Processes screensaver animation logic 70 * Called every frame on the main thread 71 * (Note: particle_tint is in RGB24 format) */ 72 void menu_screensaver_iterate( 73 menu_screensaver_t *screensaver, 74 gfx_display_t *p_disp, gfx_animation_t *p_anim, 75 enum menu_screensaver_effect effect, float effect_speed, 76 uint32_t particle_tint, unsigned width, unsigned height, 77 const char *dir_assets); 78 79 /* Draws screensaver 80 * Called every frame (on the video thread, 81 * if threaded video is on) */ 82 void menu_screensaver_frame(menu_screensaver_t *screensaver, 83 video_frame_info_t *video_info, gfx_display_t *p_disp); 84 85 RETRO_END_DECLS 86 87 #endif 88