Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

Game From Scratch C++ Edition Part 1


This part is sadly rather dull, there will be absolutely no coding but it is a necessary evil. In this part we are going to configure your development environment to work with SFML. If you already know all about how to set Visual Studio up, or are working in a different IDE, feel free to skip to the next part.



One thing to be aware of before we start. You will find these instructions vary from what you see in many other tutorials and there is one very good reason for that. Most tutorials configure your IDE settings globally, so the settings you change will effect every project you ever create. Myself, I configure on the project level whenever possible. This has the downside of requiring you to do this configurations again and again ever time you create a new project. However, what it does allow is for anyone that downloads the project to automatically have the correct settings. Also, it seems cleaner to me to only link to libraries when you actually need them. As an upside to this, if you download the project from here, you don’t actually need to do any of this work! ( That said, you should still learn how! )



Alright, assuming you downloaded all the requisite files listed at the end of the last post, lets get started. Warning, this is going to appear longer and a lot more daunting than it really is. I just went into a ton of detail because a small error in this step can lead to a very difficult to discover problem.



First off, fire up Microsoft Visual C++ Express 2010.


Selected the File –> New –> New Project… menu.



The following dialog will appear:






Select “Win32 Console Application”. Fill in the name, in this case Pang ( which will automatically name the Solution the same thing ) and select a Location to save your project in. You can optionally uncheck “Create directory for solution”, which I always do when creating a single project solution file. If you don’t you will end up with a directory structure like C:\Pang\Pang. In the end it doesn’t matter which you choose. Now click the OK button.



Now another dialog will pop-up:






Simply click the Next button ( or Finish ). If you click Next it will lead you to this dialog:





For now, you can leave everything exactly as it is and just click Finish.



There are a few things to be aware of here. First is the Application Type: which you basically choose at the first step when you selected to create a Console Application. Ignore it for now. Next are the additional options. If you leave “Empty project” unchecked, which we are going to do, it simply creates a default cpp ( pang.cpp in this case ) with the programs main() defined. Finally the Precompiled header checkbox is quite important, as this causes a file called StdAfx.cpp/StdAfx.h to be created which is the Microsoft way of supporting precompiled headers. We will cover precompiled headers later on, so for now leave it checked. Click the Finish button.



Once that is completed, Visual C++ will set up your project like this:





Now that this is created, we need to set up SFML to work with your newly created Project.




Before we continue there is one more thing to be aware off, Visual Studio created two things here, a Solution and a Project. When working inside the IDE, there is always one solution, but within a solution you can have multiple projects. Recognizing the difference between a project and a solution is very important. In the Solution Explorer, this will illustrate the difference:






The vast majority of configurations changes we make will be on the project level. When I say “Right Click on the Project” this is where I mean for you to click.



Alright, now open up the file we downloaded in the last part. If you do not have a good zip program, or aren’t using Vista/Windows 7 where it is built in, I recommend downloading 7zip. From inside the archive copy the folder SFML-1.6 and paste it in your newly created solution directory. In the end, your directory should look something like this:





Now we need to configure Visual C++ to know where SFML-1.6 is.



Right click on the Project in Solution Explorer and choose “Properties”



In the left hand column, expand Configuration Properties –> C/C++ –> General and on the right in “Additional Include Directories” add “SFML-1.6/Include/” ( without quotes! ). It should look like this:




Now in the same Property Pages dialog, on the left hand side expand

Configuration Properties –> Linker –> General and in “Additional Library Directories” type “SFML-1.6/lib/” (again, no quotes!). Once completed, it should look like this:





Finally, in the same Property Pages dialog, on the left hand side expand

Configuration Properties –> Linker –> Input in the field “Additional Dependencies” at the end of the field before “(%AdditionalDependencies)”



Again, no quotes!.



In my case ( which should be pretty standard for a new install ), the entire value after editing is:





Without any spaces or newlines of course. Once completed, it should look like this:





Finally, we are done with settings, click Apply then OK to close the dialog.

Your project is now 99% configured, only one step remains. When need to compile your project so that it will create the proper debug directories. In Visual C++, simply click this button image_thumb23 or press F5.



Assuming everything went according to plan, you should now see:





If you don’t, something is configured wrong. Retrace these steps and if the error keeps occurring, paste it into the commends of this page and I will see if I can resolve it.



Now I swear we only have one step remaining! In the previous part I got you to download a file called This file contains SFML binaries compiled to work with Visual C++ 2010. Open up the archive and copy the files:

  • sfml-audio-d.dll
  • sfml-graphics-d.dll
  • sfml-main-d.lib
  • sfml-network-d.dll
  • sfml-system-d.dll
  • sfml-window-d.dll

( basically all files ending with –d.dll ) into the debug folder that was generated in your project directory. Your debug folder should now look something like this:





Now, we are done!



If you couldn’t follow along to that, or you get errors, you can download a fully configured solution here. Just download, unzip and double click pang.sln.



Alright, now that we have everything configured and working… on to the next section to write some code!


Back to Introduction Forward to Part 2

blog comments powered by Disqus

Month List

Popular Comments

Unreal Engine 4.13 Preview Release
Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

25. August 2016


Epic have just released another preview release of Unreal Engine, this time 4.13.  Being a preview this release is not meant for production use, so expect the occasional bug and glitch.  This preview release consists entirely of bug fixes, there are no no features.  There is no forum post about the release this time due to the recent security breach of their forums.  The release was instead announced on the Unreal Engine blog, release notes copied below.



4.13 Preview 3 is now available for download on the launcher! As a reminder, the Preview releases are an early look at what is to come and are not yet production-ready. Here's what you can expect in this release:

  • UE-34697 - Samples Trigger Fails for Strategy Game on Android
  • UE-34785 - Successive launches via the Project Launcher yield "LogStats:Warning: MetaData mismatch..." in the console
  • UE-34788 - Launching from Project Launcher consecutively without closing previous launch's command window will crash the game
  • UE-34627 - Crash using Camera Rig Rail when deleting a point moving another
  • UE-34804 - Editor crashes when attempting to change units in project settings
  • UE-34758 - SplineComponent debug render is sometimes not in sync with the current spline points
  • UE-34733 - Crash when closing the timeline tab inside UMG editor and reopening UMG editor
  • UE-34702 - [CrashReport] UE4Editor_CoreUObject!UClass::GetDefaultObject() [class.h:2194]
  • UE-33301 - The cap of a sliced procedural mesh is not affected by lighting
  • UE-30405 - Accessing vertex data from CPU side code can cause crashes on merged skeletal meshes.
  • UE-34701 - Prevent preview scene assets being loaded in-game
  • UE-34776 - Ensure when automapping a rig to a skeletal mesh with matching bone names
  • UE-34015 - Rename OrientationDriver to PoseDriver before release
  • UE-34832 - Debris particles constantly firing in ending sequence of Infiltrator Demo
  • UE-34715 - XB1 fails to compile due to FXAudioDeviceProperties symbols undefined
  • UE-34680 - CLONE - Client stops working and crashes if headphones are unplugged on Windows 10
  • UE-34101 - Stat Soundcues not working
  • UE-34951 - Zero-volume vorbis decoded sounds are too expensive
  • UE-34689 - LOD's pop in after LOD actors is visible in viewport
  • UE-34807 - Force View is enabled after Generating Proxy Meshes
  • UE-34739 - [CrashReport] UE4Editor_Engine!FInitBodiesHelper<0>::CreateShapes_PhysX_AssumesLocked() [bodyinstance.cpp:1282]
  • UE-34348 - Crash opening levels with landscape in them via the command console in standalone game
  • UE-34794 - PS4 packaging failing with GLEO errors in 4.13 for project that worked previously
  • UE-34843 - KiteDemo Standalone crashes on launch
  • UE-34513 - Editor crashes while switching to paint mode if material has a grass output and landscape visibility mask
  • UE-34877 - [CrashReport] UE4Editor_Engine!UMaterialInstance::SetParentInternal() [materialinstance.cpp:2141]
  • UE-33593 - Vulkan projects crash on device
  • UE-34257 - Cannot package project with landscape to mobile
  • UE-32323 - App does not resume after locking and unlocking on iOS
  • UE-34639 - Steam libraries are not being packaged with ShooterGame on Mac
  • UE-34450 - Linux: crashes during crash handling
  • UE-34857 - Mac/iOS: Movies with spaces in name won't play
  • UE-34721 - Blank Blueprints project with Starter Content crashes when PIE Standalone Game or Mobile Preview
  • UE-34852 - Give a better error message if OBB would need Zip64 format
  • UE-34719 - CIS Failure Package UnrealMatch3 IOS
  • UE-19996 - [Linux] Setting fullscreen game resolution below set window resolution does not stretch the game across the window
  • UE-28322 - Converting BSP to static mesh on Linux causes the editor to crash
  • UE-34849 - Force OBB to never use Zip64 format
  • UE-34841 - Possible to read past end of central directory in OBB (NumEntries may be 65535)
  • UE-34699 - Need way to insert newlines in UPL
  • UE-34773 - iOS - Packaged .ipa will not deploy to device via iTunes
  • UE-34735 - Regression: Xbox One ESRAM usage has been disabled, causing severe perf degradation
  • UE-34590 - AtmosphericFog for translucent material is not working correctly with 4.12
  • UE-34514 - Game crashes when opening TM-ShaderModels while running -featureleveles2 -OpenGL
  • UE-34241 - Crash with mesh particles
  • UE-33077 - Editor crashed when exiting PIE session in test map involving FDebugCanvasDrawer::DrawRenderThread
  • UE-34688 - Mac compilation error with ClearBufferData
  • UE-34917 - Screen Percentage post process volume causes black screen flickers during transition in Standalone Game
  • UE-34712 - Media Shaders won't compile in ES2 with integer modulo operations
  • UE-34658 - Text overflows on Material_Properties sample 1.6
  • UE-34667 - Buggy gets stuck on medium speed bumps in Vehicle Advance template
  • UE-34653 - ContentExamples: Landscape examples are solid black in editor viewport
  • UE-34139 - Tutorial Asset outdated in all BP templates causing highlighting to fail
  • UE-34910 - ContentExamples: Parameter is misspelled in Example 1.3 on MorphTargets map
  • UE-34419 - Duplicate mappings on the flying template for the game pad
  • UE-34660 - Navmesh map's floor display banners obscured by navmesh while PIE
  • UE-34846 - SideScrollerCharacter.uasset has been saved with empty engine version
  • UE-34848 - Ledge_17 location is different in Blueprint and code Side Scroller 2D templates
  • UE-34950 - ContentExamples PostProcessing map demo 1.13 post process volume screen percentage is not low enough
  • UE-34907 - Misspelling in Blueprint_Splines level of Content Examples
  • UE-34911 - Misspelling in Cloth level of Content Examples
  • UE-34611 - Crash when trying to edit a key value via the context menu for FVector2D
  • UE-34823 - FBX imported from maya have incorrect tangents
  • UE-34459 - Exported Sequence camera has incorrect tangents
  • UE-34970 - VR Template has FinishCurrentFrame set, which will degrade performance unnecessarily

GameDev News

blog comments powered by Disqus

Month List

Popular Comments