2009-01-29 00:18:34 +08:00
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
/// \mainpage
|
|
|
|
///
|
|
|
|
/// \section welcome Welcome
|
|
|
|
/// Welcome to the official SFML documentation for C. Here you will find a detailed
|
|
|
|
/// view of all the SFML <a href="./globals_func.htm">functions</a>, as well as source
|
|
|
|
/// <a href="./files.htm">files</a>. <br/>
|
|
|
|
/// If you are looking for tutorials, you can visit the official website
|
|
|
|
/// at <a href="http://www.sfml-dev.org/tutorials/">www.sfml-dev.org</a>.
|
|
|
|
///
|
|
|
|
/// \section example Short example
|
|
|
|
/// Here is a short example, to show you how simple it is to use SFML in C :
|
|
|
|
///
|
|
|
|
/// \code
|
|
|
|
///
|
|
|
|
/// #include <SFML/Audio.h>
|
|
|
|
/// #include <SFML/Graphics.h>
|
|
|
|
///
|
|
|
|
/// int main()
|
|
|
|
/// {
|
2009-07-12 17:59:21 +08:00
|
|
|
/// sfVideoMode mode = {800, 600, 32};
|
|
|
|
/// sfRenderWindow* window;
|
|
|
|
/// sfImage* image;
|
|
|
|
/// sfSprite* sprite;
|
|
|
|
/// sfFont* font;
|
2010-08-09 23:56:42 +08:00
|
|
|
/// sfText* text;
|
2009-07-12 17:59:21 +08:00
|
|
|
/// sfMusic* music;
|
|
|
|
/// sfEvent event;
|
2009-01-29 00:18:34 +08:00
|
|
|
///
|
|
|
|
/// /* Create the main window */
|
2009-11-03 23:13:11 +08:00
|
|
|
/// window = sfRenderWindow_Create(mode, "SFML window", sfResize | sfClose, NULL);
|
2009-07-12 17:59:21 +08:00
|
|
|
/// if (!window)
|
2009-01-29 00:18:34 +08:00
|
|
|
/// return EXIT_FAILURE;
|
|
|
|
///
|
|
|
|
/// /* Load a sprite to display */
|
2009-07-12 17:59:21 +08:00
|
|
|
/// image = sfImage_CreateFromFile("cute_image.jpg");
|
|
|
|
/// if (!image)
|
2009-01-29 00:18:34 +08:00
|
|
|
/// return EXIT_FAILURE;
|
2009-07-12 17:59:21 +08:00
|
|
|
/// sprite = sfSprite_Create();
|
2010-08-09 23:56:42 +08:00
|
|
|
/// sfSprite_SetImage(sprite, image, sfTrue);
|
2009-01-29 00:18:34 +08:00
|
|
|
///
|
|
|
|
/// /* Create a graphical string to display */
|
2010-08-09 23:56:42 +08:00
|
|
|
/// font = sfFont_CreateFromFile("arial.ttf");
|
2009-07-12 17:59:21 +08:00
|
|
|
/// if (!font)
|
2009-01-29 00:18:34 +08:00
|
|
|
/// return EXIT_FAILURE;
|
2009-07-12 17:59:21 +08:00
|
|
|
/// text = sfString_Create();
|
2010-08-09 23:56:42 +08:00
|
|
|
/// sfText_SetString(text, "Hello SFML");
|
|
|
|
/// sfText_SetFont(text, font);
|
|
|
|
/// sfText_SetSize(text, 50);
|
2009-01-29 00:18:34 +08:00
|
|
|
///
|
|
|
|
/// /* Load a music to play */
|
2009-07-12 17:59:21 +08:00
|
|
|
/// music = sfMusic_CreateFromFile("nice_music.ogg");
|
|
|
|
/// if (!music)
|
2009-01-29 00:18:34 +08:00
|
|
|
/// return EXIT_FAILURE;
|
|
|
|
///
|
|
|
|
/// /* Play the music */
|
2009-07-12 17:59:21 +08:00
|
|
|
/// sfMusic_Play(music);
|
2009-01-29 00:18:34 +08:00
|
|
|
///
|
|
|
|
/// /* Start the game loop */
|
2009-07-12 17:59:21 +08:00
|
|
|
/// while (sfRenderWindow_IsOpened(window))
|
2009-01-29 00:18:34 +08:00
|
|
|
/// {
|
|
|
|
/// /* Process events */
|
2009-07-12 17:59:21 +08:00
|
|
|
/// while (sfRenderWindow_GetEvent(window, &event))
|
2009-01-29 00:18:34 +08:00
|
|
|
/// {
|
|
|
|
/// /* Close window : exit */
|
2009-07-12 17:59:21 +08:00
|
|
|
/// if (event.Type == sfEvtClosed)
|
|
|
|
/// sfRenderWindow_Close(window);
|
2009-01-29 00:18:34 +08:00
|
|
|
/// }
|
|
|
|
///
|
|
|
|
/// /* Clear the screen */
|
2009-07-12 17:59:21 +08:00
|
|
|
/// sfRenderWindow_Clear(window, sfBlack);
|
2009-01-29 00:18:34 +08:00
|
|
|
///
|
|
|
|
/// /* Draw the sprite */
|
2009-07-12 17:59:21 +08:00
|
|
|
/// sfRenderWindow_DrawSprite(window, sprite);
|
2009-01-29 00:18:34 +08:00
|
|
|
///
|
|
|
|
/// /* Draw the string */
|
2009-07-12 17:59:21 +08:00
|
|
|
/// sfRenderWindow_DrawString(window, text);
|
2009-01-29 00:18:34 +08:00
|
|
|
///
|
|
|
|
/// /* Update the window */
|
2009-07-12 17:59:21 +08:00
|
|
|
/// sfRenderWindow_Display(window);
|
2009-01-29 00:18:34 +08:00
|
|
|
/// }
|
|
|
|
///
|
|
|
|
/// /* Cleanup resources */
|
2009-07-12 17:59:21 +08:00
|
|
|
/// sfMusic_Destroy(music);
|
|
|
|
/// sfString_Destroy(text);
|
|
|
|
/// sfFont_Destroy(font);
|
|
|
|
/// sfSprite_Destroy(sprite);
|
|
|
|
/// sfImage_Destroy(image);
|
|
|
|
/// sfRenderWindow_Destroy(window);
|
2009-01-29 00:18:34 +08:00
|
|
|
///
|
|
|
|
/// return EXIT_SUCCESS;
|
|
|
|
/// }
|
|
|
|
/// \endcode
|
|
|
|
////////////////////////////////////////////////////////////
|