• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
mypel16000

SFML and Code::Blocks

8 posts in this topic

Hi, I need to use SFML with Code::BLocks. I have used it loads of times in the past and it has allways worked. This time though, even after following every step on 10+ tutorials I cannot get it to work. The problem is that the program starts and it works fine, until it gets to the first SFML command. Then it stops working. I have read about the MinGW being outdated and I have installed the latest versions, but it still will not work.

 

I doubt anyone could give me some steps to solve this problem, but if they could give me the CodeBlocks files with SFML already installed that would be great!

0

Share this post


Link to post
Share on other sites

It stops working, but what kind of error do you get? Try putting some breakpoints and follow the execution step by step, also it would help us helping you by providing the piece of code you're trying to run. Perhaps it's not related to Code::Blocks at all.

1

Share this post


Link to post
Share on other sites

I don't get an error. I don't get it when I run it and I don't get it when I debug. This must mean that all the libraries work properly. The problem is that I start running my code:

 

#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <iostream>

using namespace std;


int main()
{
    cout<< "Main Working"
    bool Running = true;
    while (Running)
    {
        cout << "Loop Working";
        sf::Window App(sf::VideoMode(800, 600, 32),"Hello");
        App.Display();
        cout << "Screen Working"
    }
}

 

As you can see I am just trying to simply open up a window. What I get is:

 

Main Working Loop Working

 

Then the program "blablabla.exe stopped responding" Just like other programs often crash. Only that it allways happen. At this stage i'm sure it probably isn't an error of the code.

-2

Share this post


Link to post
Share on other sites

I dont know much about SFML but you seem to just loop endlessly over the initialization part and never start working on the generated messages, no wonder Windows complains about that.

0

Share this post


Link to post
Share on other sites

I see two issues with the code you have posted:

 

The first being there are two semi-colon's missing after 2 of your 3 cout's (the first and the third, as underlined below):

#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <iostream>

using namespace std;


int main()
{
    cout<< "Main Working"
    bool Running = true;
    while (Running)
    {
        cout << "Loop Working";
        sf::Window App(sf::VideoMode(800, 600, 32),"Hello");
        App.Display();
        cout << "Screen Working"
    }
}

 

This causes your program to think that a certain line ends in a place different to where you want it to, which can lead to undesired effects (although, why your compiler isn't throwing up some sort of error puzzles me).

 

Secondly: sf::Window should only need to be created once, outside the (while) loop. When I tried the same as your code, in my IDE, I had a window being created and destroyed over and over, whilst the loop ran. This lead to an effect by which a window would open and close every couple of seconds (maybe this is something your compiler doesn't like and crashes the program for you, I'm not sure, please correct me if I am wrong).

 

Try it with these and get back to us, if anything, it might not fix the problem, but allow a new (debugger tracked one) to be picked up.

 

Regards,

 

Stitchs.

2

Share this post


Link to post
Share on other sites

You just don't realize it..... It's not about the code. I wrote that in 2 secs on game dev. I didn't copy it directly! I have fixed it already and it's an issue with the latest version of CodeBlocks.

-3

Share this post


Link to post
Share on other sites

No offense to you but, when you say:

 

[quote name='mypel16000' timestamp='1357467249' post='5018125']

The problem is that I start running my code: (insert code here)
[/quote]

 

You're kind of giving people misleading information as to how they can solve your problem. If you had posted a direct copy-paste of your code, myself, as well as other forum members, wouldn't need to waste time reading/responding to inaccurate data. We could get to the problem at hand. Now I realise a counter-argument might be that you said in your first post you're sure it's the fault of an outdated MinGW but, to follow up with what you provided might suggest to some that you are at a level of experience lower than you know you are.

 

So that the community could give more possible responses, could you tell us the versions of MinGW and SFML that you're using, have you tried to google information that includes these version numbers as your searches might be too general.

 

Regards,

 

Stitchs.

2

Share this post


Link to post
Share on other sites

I would copy and paste the direct contents of your code.  While it may not seem like your code has a problem it is very likely it can be.  It happens all the time to programmers.  We just know our code is right that nothing is wrong with it.  Then we show it to someone else and they see it within 10 seconds.  It can happen all the time in anything, not just programming.  It's one of those things that happens when you look at something for too long.  Sometimes you need a fresh set of eyes.

 

The chances of this being a Code::Blocks issue is very slim.  If it compiles and links just fine and starts up then I don't see it being a Code::Blocks issue.  I guess it is possible it could be something to do with the SFML files though first I'd want to see your code.

 

Next would be the project settings.  I can assume it could be a possibility that your project settings aren't exactly right, though with just a basic SFML app I would think if you have it linked properly and it compiles fine then that would be fine too.

 

Seriously just copy and paste your code and we will do everything we can to try to help.  We all make mistakes and we sometimes need fresh set of eyes to see the problem.  If you have by chance fixed the issue then post your solution here.  That way someone else who could be having the same problem could see and it could help someone else.

 

Without any of this information it's going to be nearly impossible to try to help you.  That code you posted above, even though you said it was not a direct copy and paste (not sure why you wouldn't though), we immediately saw something.

Edited by Chad Smith
1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0