SFML

Langkah-langkah Membuat Program SFML

Berikut ini Meerupakan langkah-langkah Program Pembuatan Program SFML Grafik

    1. Pastikan udah ada software visual studio  
    2. Instal SFML dari link ini https://www.sfml-dev.org/download/sfml/2.0/ . setalah selasai extrac sfml . 
    3. Saat instalan selesai, buat folder  yang sama tempat Anda menginstal Visual Studio dan beri nama SFML. Juga buat folder lain R01TI/123456/SFML/ External Library/SFML.
    4. Salinlah  folder SFML yang kalian (bukan folde zip ) Download di folder D:/ R01TI/123456/SFML/ External Library/SFML.
    5. Buka Visual Studio, Buat New Project > Visual C++ > Win32 Console Application, Location Folder Di D:/ R01TI/123456/SFML/>OK.
    6. Selanjutnya menunjukkan  Pengaturan Aplikasi. Centang kotak untuk aplikasi Console application > OK
    7.  Add New Item di Project anda lalu klik kanan Project anda di Solution Explorer > References > Configuration Properties > VC++ Directories > Configuration disebelah kiri atas ganti menjadi All Configurations > Edit Include Directories > $(SolutionDir)/../External Libraries/SFML/include > OK lalu Edit Library Directories > $(SolutionDir)/../External Libraries/SFML/lib > OK.
    8. Masih di References, Klik Linker > Input > Edit Additional Dependencies > Tambahkan

sfml-audio-d.lib

sfml-graphics-d.lib

sfml-main-d.lib

sfml-network-d.lib

sfml-system-d.lib

sfml-window-d.lib
lalu klik APPLY lalu  OK

            9.Lalu Buka Folder D:/ R01TI/123456/SFML/External Library/SFML/bin >> Copy Semua File ke D:/                                          R01TI/123456/SFML/Project_Anda/Nama_Folder_Project. untuk info lengkapnya bisa dibuka cara konfigurasi SFML  dan disini 

          10. Buka Main.cpp > Ketikkan

 

#include <iostream>
#include <SFML\Graphics.hpp>
int main()
{
//view window
sf::RenderWindow window(sf::VideoMode(640,480), "Awesome object");

sf::Font font;
    if (!font.loadFromFile("res/fonts/FontFile.ttf"))
    {
        std::cout << "Error loading file" << std::endl;

        system ("pause");
    }
//drawing circle
sf::CircleShape circle(65);

circle.setRadius(75);
circle.setPointCount(200);
circle.setPosition(sf::Vector2f( 25,100));

   //sistem dalam color (R,G.B)
circle.setFillColor(sf::Color(200,200,200));
//circle.setOutlineColor(sf::Color(0,0,100));
//circle.setOutlineThickness(-10);



//object rectangle
sf::RectangleShape rectangle(sf::Vector2f(100,75));
//rectangle.setTexture(&texture);
rectangle.setSize(sf::Vector2f(300,100));
rectangle.setPosition(sf::Vector2f(200,300));

sf::CircleShape square(65);

square.setRadius(100);
square.setPointCount(4);
square.setPosition(sf::Vector2f( 200,100));
square.setFillColor(sf::Color(200,200,200));

while (window.isOpen())
{
sf::Event event;

// handle all event
while( window.pollEvent( event ))
{
switch (event.type)
{
case sf::Event::Closed:
window.close();
break;
}
}
// update
window.clear();
// draw object here
window.draw(circle);
window.draw(rectangle);
window.draw(square);
window.display();
}

return EXIT_SUCCESS;
}

 

 

Berikut outputnya :  sfml

 

Berikut video cara install SFML pada Vs.studio

Tolong Bagikan:
Pin Share

Leave a Comment

Your email address will not be published. Required fields are marked *

Translate »
Social media & sharing icons powered by UltimatelySocial

Enjoy this blog? Please spread the word :)

Scroll to Top