Archive

Archive for the ‘SFML’ Category

SFML camelCase

Just a quick heads up. SFML has undergone some name changes. Class members are now named in camelCase. This just means that the first word of each member’s name is no longer capitalised. For example

sf::Window::IsOpen();

has become

sf::Window::isOpen();

If with new versions of SFML, you’ve been getting lots of errors like

XXX is not a member of class YYY

then this is probably why! I know it might be a pain to refactor all your code, but unfortunately if you want to keep up to date with SFML (and you should :P ) then you have no choice.

Categories: Notice, SFML Tags: , , , ,

SFML 2.0 Release Candidate

Hi all! Sorry then new posts still haven’t come through. I am working on it, but things are still very very hectic. Anyway, some good news in the mean time! SFML 2.0 Release Candidate is out! So it’s just going through a last phase of testing and minor changes before release. That means two main things for us:

  • prebuilt binaries on the official site (I think I’ll still provide them until the final release is out)
  • few (if any) public interface changes, so no more problems with tutorials becoming outdated due to new function names, etc.

If you want to try it, head over to the SFML downloads page and get it right away.

ArrayWars

I’ve decided it’d be good to write a few very simple – but complete – games to show you. The first and simplest is essentially noughts and crosses, though I’ve gone ahead and called it ArrayWars. (If you’re wondering, my reasoning is that noughts and crosses is basically just a little struggle over an array of 9 squares…)

Anyway, the actual game is clearly quite simple here. However, I’m going to try and illustrate a couple of useful techniques that would be useful in a more general and more advanced setting. For example, it’s going to have customizable settings, as well as player stats. Both of these need to be saved and loaded from a file (I’ve found a library which makes this really simple, but more about that tomorrow…) Naturally, there’ll be a main menu, plus sub menus for the settings, the stats, creating a game and so on. This means we’ll need simple GUI elements: primarily buttons and text boxes.

Under the hood, there’ll also be application logging (for bugtesting and diagnostic purposes) and if I find the time I might make a simple in game console. If you’re interested, the code is already in a repository on GitHub. And, needless to say, the sound, windowing, graphics and input will all be handled by SFML!

Automatic SFML 2.0 Build – Unix

As you know, I’ve been providing prebuilt SFML 2.0 binaries for Windows (both MinGW and MSVC) for a while now (new ones will be out soon, by the way…)

I don’t really want to provide prebuilt binaries on Unix right now, but instead I’ve written a little script which will build them for you. All you do is run the script. Then it goes ahead and downloads the source, runs CMake and then builds and installs the binaries, header files, examples and documentation. You can go ahead and download the script, but read on a bit so you know what you’re doing. And of course, if you don’t trust me, you can always read through the script yourself :)

I’m sure it’s not very robust at the moment, so let me know if you have any issues with it. I’ll try to fix them as soon as possible. If you do come up against problems, you can probably just delete the directory it created and run it again. Oh, and you can run it a second time to check for source code updates and recompile.

Anyway, all you have to do is download the script, put it in the desired directory, e.g. ~/Development,  make it executable and run it (probably with no options, but see below for details).

chmod +x InstallSFML.sh
./InstallSFML.sh

Warning: If you install SFML to the default location of /usr/local, it will override any older versions (e.g. SFML 1.6) already installed in /usr. If you wish to continue using an already installed older version, read on to learn how to install SFML to an alternate location.

Usage Notes

There are just a few details of usage which I’d like to share. Firstly, as you probably know,  certain tools and libraries are required for the build. Namely, the script invokes CMake, make, git and doxygen. In fact, the script can have a go at installing these for you. Just run it with the -t switch. However, it handles this in a very primitive way. It installs them using apt-get so it’s specific to Ubuntu, Linux Mint and the like. Also, of course, the package names may change a little in the future (for example, git-core recently became simply git).

As for the libraries, you can try the -l switch. However, I’d say this is even less reliable. Again, it relies on apt-get and moreover it depends on the particular package names. However, I’ll try to keep these up to date so that it works on Ubuntu-like OSs at least. Anyway, if you have trouble with installation of packages or tools, let me know so I can look into it.

If you can’t get these features to work, don’t worry. The rest of the script should run fine, you’ll just need to ensure that the following tools are installed, along with the dependencies specified here.

  • CMake
  • GCC/Make
  • doxygen
  • git

There are just two last options. You can specify -D directory to have SFML installed into directory rather than the default location of /usr/local. And you can specify -S directory to have the SFML source downloaded into directory rather than a new subdirectory called SFML of the active directory. If you specify an existing directory (or if you use the defaults and there is an existing directory called SFML in the current active directory) then the script will check if it’s a Git repository. If so, it will update the repo and then build and install as normal; if it’s not a repo, it will give you the choice to cancel the operation or to delete the directory and re-clone the source from Git Hub.

Sign up now for new SFML Binaries!

Later on today, I’ll be sending out some updated SFML binaries for Windows. Not only that, there’s going to be a brand new script for installing SFML on Unix (in particular, Ubuntu/Linux Mint, but I’m sure a little modification will have it running elsewhere). If you want to be the first to get hold of all this, remember to subscribe by email if you haven’t yet. Otherwise, they’ll be added to the downloads page in a few days.

SFML Uploads

02.02.2012 2 comments

Just a quick link - http://www.sfmluploads.org/

It’s a great little community site where you can upload your SFML projects, and check out other people’s. Take a look when you have the chance. Remember, you can also find various SFML programs and classes in the sources section of the SFML Wiki.

Categories: Links and Libraries, SFML

sf::Window::IsOpen()

Previously, we always checked if our SFML window was open using sf::Window::IsOpened(), which returned bool. Well, the function has recently been renamed to IsOpen(), although it appears otherwise unchanged (externally at least). So bear in mind that if you’re using a very up to date SFML snapshot, you may need to use sf::Window::IsOpen() rather than the old sf::Window::IsOpened().

SFML 2.0 Builds

25.12.2011 2 comments

It’s like Christmas come early! Well on time anyway… I’ve finally been able to compile some more SFML binaries for Windows – for Visual C++ 2008, Visual C++ 2010 and MinGW. There’s also optional documentation, and all the official example programs, compiled with MinGW and linked to dynamic release SFML binaries.

The best bit is, it’s not a messy archive any more. It’s a full installer now, so everything should be much smoother for you. Just pick the components you want, and it’ll install them to program files, or wherever else you want them put. Just remember – you still have to add compiler and linker search directories in your IDE.

By default all the files will be installed to C:\Program Files\SFML (or C:\Program Files (x86)\SFML), but you can change this. You’ll still need to add compiler and linker search paths in your IDE of choice and to provide the appropriate DLLs in your project directory.

And remember, this program is provided for your convenience only. It comes with no warranty of any kind and I cannot be held responsible for its suitability for purpose, nor can I be held liable for any damages caused by it, even if I was advised of such. You get the idea…

Well, have fun with the binaries. Here’s the link:
http://bit.ly/rCDGTn
(There is, of course, an updated link on the Downloads page too.)

And, of course, HAPPY CHRISTMAS from SFML Coder!

Renewed SFML 2.0 Builds

Remember all that time ago when I promised regular SFML 2.0 builds to blog subscribers, plus occasional builds for everyone else, as well? I sent out an initial build, but that was it. Anyway, I’m going to try and get that underway again. So, all current email subscribers will be emailed it – drop me an email if you want to opt out. And if you’re not yet subscribed by email, but would like to get the new builds as soon as possible, then please do subscribe now. But don’t worry if you really don’t want to give your email; I’ll provide a link to the build on the downloads page shortly as well.

Initially, the binaries will just be for VC++ 2008, VC++ 2010 and MinGW as before. I do want to provide Unix binaries as well, but it’s a little tricky with dependencies and stuff so I’ve go to decide how best to go about it. Ultimately I think I’ll try and create a Debian package for users of Debian, Ubuntu and Mint; otherwise it’ll probably have to be binaries without dependencies provided (you’d have to go to your package manager and find them yourself). As for MacOS, I’d like to provide binaries there too, just for the sake of completeness, but it’s not an OS I have – or ever into to have – access to, so I’d have to look into cross compiling it from Linux or Windows.

So anyway, you can look forward to updated Windows binaries this afternoon, and I’ll let you know when I can get some build for other platforms. Just remember than while I will keep you up to date with posts and the downloads page, the quickest and easiest way to hear about updates (and new posts) is to subscribe. So go ahead and do it! You’ll get your binaries soon ;-)

PS: I’m providing these files for convenience (and to make the site more popular :D ), but it’s still a great learning experience to build them yourself at least once. So check out my building SFML tutorials, for Windows/MinGW, Windows/VC or Linux/GCC. Oh, and just so you know, they’ll be updated with some new information soon too!

Competition Time!

A reader suggested that I host a little competition during the leadup to Skyrim. Now, this isn’t actually a game I intend to be playing, but I’m told it’s a big thing… Anyway, it’s coming out on the 11th, so I’m going to have a little competition. Let’s see who can make the best game prototype by then! If you’re interested in competing, and indeed if you have any suggestions for changes to the competition, please do comment below.

It’s not a very long time, so I don’t expect much. Basically, what you should aim for is planning the game mechanics, the structure and – if relevant – the story. Then make a simple working prototype. Don’t worry and menus and options screens and what have you. Just focus on loading a sample level the character can run around in, or whatever is the equivalent prototype for the game you have in mind. Don’t worry too much about art, either. Just do something basic and functional ;) “Programmers’ art”, as it is called.

Unfortunately I won’t be able to compete this time. I’m very busy and won’t have to time to put anything together in 11 days. Come Christmas I intend to have a more drawn out competition, in which I shall definitely compete! So if you’re too busy, don’t feel bad and just running through some ideas for the Christmas competition.

Now, as for rules…

  1. The game must use the SFML library
  2. It can be written in any language SFML supports, though C/C++ is preferable
  3. You may use other low level libraries (such as Boost, RapidXml, etc.), but make sure they are cross platform. And use your discretion – don’t use a library which does everything for you. If you’re unsure about a library, just ask!
  4. There is no prize as such, other than a mention on the site. I can link to your site if you want, provided it appears relevant (at my sole discretion). And also I might get a few quotes from the winner by email about his/her project to share on the site.
  5. You have until midnight GMT on 11th November 2011.
  6. To submit your entry, post a comment on this post, with a brief description of your project, and a link to it. Either host on a file sharing site such as MegaUpload, or host the source on Github or Sourceforge if you know how. Provide compiled binaries if you want, but make sure to provide the source as well – Linux users like me may have difficulty playing a game compiled for Windows!
  7. Judging will be by public vote, but adjustments to results may be performed if deemed necessary (at my sole discretion).
  8. No negotiation will be entered into regarding judging.
  9. If for any reason the competition needs to be cancelled I reserve the right to do so at my sole discretion
  10. You retain the rights to your creation, but by submitting your entry you authorise me to use your game, its story and design, and its source files, media and other data for the purposes of publicising the competition, and also afterwards for the purpose of discussion in other posts.
Good luck!
Follow

Get every new post delivered to your Inbox.

Join 72 other followers