|
Dragonfly with Visual Studio v14 (2015) |
Home | Engine | Games | Tutorial | Docs | Book | Notes |
This is a setup guide for configuring Microsoft Visual Studio to use and develop Dragonfly. This setup guide is good as of SFML version 2.5 and Microsoft Visual Studio version 14 (2015).
Open Visual Studio.
Create a new Win32 Project
From the menu:
"File" → "New" → "Project"Select:
"Templates" → "Visual C++" → "Win32"
"Win32 Project"Uncheck:
"Create directory for solution"
Fill out information:
Name: "saucer-shoot"
Location: "Wherever you want"
Click "OK" and then Click "Next"
Select:
"Windows application"Note, if needed in the future, there are directions for Changing a Windows App to a Console App in Visual Studio
"Empty project"
Another note, to keep the console window open after the program
ends, run with ctrl-F5 (instead of just F5). Other suggestions are
available how-to-keep-the-console-window-open-in-visual-c++.
Click "Finish"
Set the compiler/linker settings for SFML:
Menu (or press Alt-F7):
"Project" → "(Project name) Properties"Select:
"Configuration Properties"Set Configuration in the top drop-down to:
"All Configurations"
Select:
"VC++ Directories"Click top line, then dropdown arrow. Use file browser to add:
"Include Directories" → (Dropdown arrow) → "Edit"
(Directory where extracted SFML)\includee.g.,
..\..\SFML-2.5\include
If linking in Dragonfly (versus developing Dragonfly), on the next line, also add:
(Directory where extracted dragonfly)\includee.g.,
..\..\dragonfly\include
Click "OK"
Select:
"Library Directories" → (Dropdown arrow) → "Edit"Click top line, then dropdown arrow. Use file browser to add:
(Directory where extracted SFML)\libe.g.,
..\..\SFML-2.5\lib
If linking in Dragonfly (versus developing Dragonfly), on the next line, also add:
(Directory where extracted dragonfly library)e.g.,
..\..\dragonfly\lib
Click "OK"
Select:
"Linker" → "Input" → "Additional Dependencies" → (Dropdown arrow) → "Edit"Add:
sfml-system-d.lib
sfml-window-d.lib
sfml-graphics-d.lib
sfml-main-d.lib
sfml-audio-d.lib
sfml-network-d.lib
Winmm.lib
Ws2_32.lib
Note! Changing to "Release" requires different SFML libraries for
linking.
See: SFML
and Visual studio for details.
If linking in Dragonfly (versus developing Dragonfly), also add:
libdragonfly-win32-debug.lib(Adjust the name to the version of the library appropriate for the build). Click "OK"
Create program to build. Menu:
"View" → "Solution Explorer"Select:
(Right click Project name) → "Add" → "New Item"
"Installed" → "Visual C++"Fill out information:
"C++ File (.cpp)"
Name: "game.cpp"Click "Add"
Do ONE of the below options:
// // game.cpp // // Engine includes. #include "GameManager.h" #include "LogManager.h" int main(int argc, char *argv[]) { // Start up game manager. df::GameManager &game_manager = df::GameManager::getInstance(); if (game_manager.startUp()) { df::LogManager &log_manager = df::LogManager::getInstance(); log_manager.writeLog("Error starting game manager!"); game_manager.shutDown(); return 0; } // Show splash screen. df::splash(); // Shut everything down. game_manager.shutDown(); }
#include <SFML/Graphics.hpp> int main() { sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!"); sf::CircleShape shape(100.f); shape.setFillColor(sf::Color::Green); while (window.isOpen()) { sf::Event event; while (window.pollEvent(event)) { if (event.type == sf::Event::Closed) window.close(); } window.clear(); window.draw(shape); window.display(); } return 0; }
Build (press F7)
Warnings about "PDB" files not found can be ignored
If linking in Dragonfly (versus developing Dragonfly), copy
"df-font.ttf" to the directory with the .exe just built
(e.g., (Project name)\Debug
)
Ensure access to SFML DLLs. To do this, do ONE of the below options:
Copy all DLL files:
(Directory where extracted SFML)\bin\*.dllto the directory with the .exe just built (e.g.,
saucer-shoot\Debug
).
Go to project properties (press Alt+F7):
"Configuration Properties" → "Debugging"Add:
"Environment" → (Dropdown arrow) → "Edit"
PATH=%PATH%;(Directory where extracted SFML)\bin;e.g.,
PATH=%PATH%;..\..\SFML-2.5\bin;
Click "OK"
(Optional) Change the working directory when running:
Go to project properties (press Alt+F7):
"Configuration Properties" → "Debugging"Use file browser to select the directory where the application .exe is (e.g.,
"Working Directory" → (Dropdown arrow) → "Browse"
$(ProjectDir)\Debug
)Click "OK"
Run (press F5).
Home | Engine | Games | Tutorial | Docs | Book | Notes |