I need to break this code into three pieces. Header file .h, implementation file .c and the main file.
Thank you.
//include directive
#include <stdio.h>
#include <SFML/Graphics.h>
int main(void)
{
// change the size of the window
sfVideoMode mode = {200, 300, 32};
sfRenderWindow* window;
sfCircleShape* circle;
sfSprite* sprite;
sfEvent event;
// allocates memory
window = sfRenderWindow_create(mode, "Olti Asllanaj", sfResize | sfClose, NULL);
if (!window)
return 1;
//create a circle to display
circle = sfCircleShape_create();
if(!circle)
return 1;
//changes the radius of the circle
sfCircleShape_setRadius(circle, 100);
//changes the color of the cicrcle
sfCircleShape_setFillColor(circle, sfRed);
// checks if the window is open
while (sfRenderWindow_isOpen(window))
{
while (sfRenderWindow_pollEvent(window, &event))
{
// close window: exit
if (event.type == sfEvtClosed)
sfRenderWindow_close(window);
}
// Clear screen and change the color of the window
sfRenderWindow_clear(window, sfBlack);
sfRenderWindow_drawCircleShape(window, circle, NULL);
//displaly window
sfRenderWindow_display(window);
}
//destroy the window and the circle
sfCircleShape_destroy(circle);
sfRenderWindow_destroy(window);
return 0;
}