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
|
|
|
/// sfWindowSettings settings = {24, 8, 0};
|
|
|
|
/// sfVideoMode mode = {800, 600, 32};
|
|
|
|
/// sfRenderWindow* window;
|
|
|
|
/// sfImage* image;
|
|
|
|
/// sfSprite* sprite;
|
|
|
|
/// sfFont* font;
|
|
|
|
/// sfString* text;
|
|
|
|
/// sfMusic* music;
|
|
|
|
/// sfEvent event;
|
2009-01-29 00:18:34 +08:00
|
|
|
///
|
|
|
|
/// /* Create the main window */
|
2009-07-12 17:59:21 +08:00
|
|
|
/// window = sfRenderWindow_Create(mode, "SFML window", sfResize | sfClose, settings);
|
|
|
|
/// 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();
|
|
|
|
/// sfSprite_SetImage(sprite, image);
|
2009-01-29 00:18:34 +08:00
|
|
|
///
|
|
|
|
/// /* Create a graphical string to display */
|
2009-07-12 17:59:21 +08:00
|
|
|
/// font = sfFont_CreateFromFile("arial.ttf", 50, NULL);
|
|
|
|
/// if (!font)
|
2009-01-29 00:18:34 +08:00
|
|
|
/// return EXIT_FAILURE;
|
2009-07-12 17:59:21 +08:00
|
|
|
/// text = sfString_Create();
|
|
|
|
/// sfString_SetText(text, "Hello SFML");
|
|
|
|
/// sfString_SetFont(text, font);
|
|
|
|
/// sfString_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
|
|
|
|
////////////////////////////////////////////////////////////
|