SDL_misc.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. /**
  19. * \file SDL_misc.h
  20. *
  21. * \brief Include file for SDL API functions that don't fit elsewhere.
  22. */
  23. #ifndef SDL_misc_h_
  24. #define SDL_misc_h_
  25. #include "SDL_stdinc.h"
  26. #include "begin_code.h"
  27. /* Set up for C function definitions, even when using C++ */
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. /**
  32. * Open a URL/URI in the browser or other appropriate external application.
  33. *
  34. * Open a URL in a separate, system-provided application. How this works will
  35. * vary wildly depending on the platform. This will likely launch what makes
  36. * sense to handle a specific URL's protocol (a web browser for `http://`,
  37. * etc), but it might also be able to launch file managers for directories and
  38. * other things.
  39. *
  40. * What happens when you open a URL varies wildly as well: your game window
  41. * may lose focus (and may or may not lose focus if your game was fullscreen
  42. * or grabbing input at the time). On mobile devices, your app will likely
  43. * move to the background or your process might be paused. Any given platform
  44. * may or may not handle a given URL.
  45. *
  46. * If this is unimplemented (or simply unavailable) for a platform, this will
  47. * fail with an error. A successful result does not mean the URL loaded, just
  48. * that we launched _something_ to handle it (or at least believe we did).
  49. *
  50. * All this to say: this function can be useful, but you should definitely
  51. * test it on every platform you target.
  52. *
  53. * \param url A valid URL/URI to open. Use `file:///full/path/to/file` for
  54. * local files, if supported.
  55. * \returns 0 on success, or -1 on error; call SDL_GetError() for more
  56. * information.
  57. *
  58. * \since This function is available in SDL 2.0.14 and newer
  59. */
  60. extern DECLSPEC int SDLCALL SDL_OpenURL(const char *url);
  61. /* Ends C function definitions when using C++ */
  62. #ifdef __cplusplus
  63. }
  64. #endif
  65. #include "close_code.h"
  66. #endif /* SDL_misc_h_ */
  67. /* vi: set ts=4 sw=4 expandtab: */