• 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
xzbobzx

How do I set up SDL in visual C++ 2010 express?

22 posts in this topic

I've searched for tutorials but couldn't find any good ones, so I decided to ask here, how do I set up SDL in Visual C++ 2010 express?
1

Share this post


Link to post
Share on other sites
LazyFoo's SDL tutorials: http://lazyfoo.net/SDL_tutorials/index.php

The explanations are very clear and easy to follow. Start with Lesson 1 and you are good to go. If you do not understand any of the steps, just post again to ask.
2

Share this post


Link to post
Share on other sites
[quote name='fisyher' timestamp='1303910640' post='4803534']
LazyFoo's SDL tutorials: [url="http://lazyfoo.net/SDL_tutorials/index.php"]http://lazyfoo.net/S...rials/index.php[/url]

The explanations are very clear and easy to follow. Start with Lesson 1 and you are good to go. If you do not understand any of the steps, just post again to ask.
[/quote]

Wow, that guy sure ain't lazy. o.o
Thanks.
0

Share this post


Link to post
Share on other sites
So I tried lesson 1, all compiles fine.
But when I run the program it's just a black screen without any picture on it, what have I done wrong?
0

Share this post


Link to post
Share on other sites
make sure the file hello.bmp exists and is located at the right path.
0

Share this post


Link to post
Share on other sites
have you written the code or did you just copy it? It is easy to miss a line. The full source can be downloaded at the bottom of the page. If that source don't work you have probably not set up SDL properly.
0

Share this post


Link to post
Share on other sites
When I think about it, a blank window sounds more like an error in the code than SDL being not properly set up.
Try add the following code after hello = SDL_LoadBMP( "hello.bmp" ); :
[code] if (!hello)
{
printf("SDL_LoadBMP failed: %s\n", SDL_GetError());
}[/code]
0

Share this post


Link to post
Share on other sites
SDL_LoadBMP failed: Couldn't open hello.bmp

That's what I got in stdout.
0

Share this post


Link to post
Share on other sites
So the problem is that it could not open hello.bmp, most likely because it didn't found it. I don't know what visual c++ use for current directory when running your program. Maybe the file should be located at he project root. If you replace the filename ("hello.bmp") with the full path to the file ("C:\\...\hello.bmp") it should work.
0

Share this post


Link to post
Share on other sites
I clicked the properties on hello.bmp, and it said;
Item Type: Does not participate in build
0

Share this post


Link to post
Share on other sites
I think that just means that visual c++ will not try to compile that file.
0

Share this post


Link to post
Share on other sites
[quote name='xzbobzx' timestamp='1304432952' post='4805957']
I clicked the properties on hello.bmp, and it said;
Item Type: Does not participate in build
[/quote]
BMP files are binary data, binary data and other data files are never compiled they are just that data.

Make sure that your runtime directory is setup properly in the solution file, by default when launching the exe from the IDE it doesn't start in the same directory as to which it builds, it starts in the solution directory.

1. Right click your project and open properties on it.
2. Go to the debugging item in the tree view
3. Set the working directory to the one where the bmp is located
0

Share this post


Link to post
Share on other sites
If you haven't already, change the path back to just "hello.bmp" (that is, don't use the full path).

Then, check and see what the working directory is set to, as NightCreature83 described. I'm not looking at Visual Studio right now, but the path might be expressed in terms of a macro; if you're not sure how to interpret the path, you could post it here.

Or, you could just try putting the file in a few different directories until you find one that works. A good place to start would probably be the project directory itself (the directory where your source code and so on is).
0

Share this post


Link to post
Share on other sites
By default, when you run your program from within the IDE, the working directory is set to "$(ProjectDir)", which is the directory containing the project file and source files. However, if you were to run your program from outside the IDE, then the working directory is the directory of the executable. You can change the working directory of a program by going to the project properties (alt+f7), and changing the "Working Directory" field under "Debugging->General".
1

Share this post


Link to post
Share on other sites
I also get this sometimes:
LINK : [external drive]\SDL_Tutorial\Debug\SDL_Tutorial.exe not found or not built by the last incremental link; performing full link
[external drive] being, of course, my external drive. :|
0

Share this post


Link to post
Share on other sites
[quote name='fastcall22' timestamp='1304441195' post='4806013']
By default, when you run your program from within the IDE, the working directory is set to "$(ProjectDir)", which is the directory containing the project file and source files. However, if you were to run your program from outside the IDE, then the working directory is the directory of the executable. You can change the working directory of a program by going to the project properties (alt+f7), and changing the "Working Directory" field under "Debugging->General".
[/quote]

Ah, ok, so it should work if I placed the 'hello.bmp' in the folder containing the .exe?

Edit: it worked.
0

Share this post


Link to post
Share on other sites
[quote name='xzbobzx' timestamp='1304441579' post='4806015']
I also get this sometimes:
LINK : [external drive]\SDL_Tutorial\Debug\SDL_Tutorial.exe not found or not built by the last incremental link; performing full link
[external drive] being, of course, my external drive. :|
[/quote]
That's unrelated. I'd try the previous suggestions (e.g. check to see what the current working directory is) and see if that gets you anywhere.
0

Share this post


Link to post
Share on other sites
[quote name='xzbobzx' timestamp='1304441926' post='4806018']
[quote name='fastcall22' timestamp='1304441195' post='4806013']
By default, when you run your program from within the IDE, the working directory is set to "$(ProjectDir)", which is the directory containing the project file and source files. However, if you were to run your program from outside the IDE, then the working directory is the directory of the executable. You can change the working directory of a program by going to the project properties (alt+f7), and changing the "Working Directory" field under "Debugging->General".
[/quote]

Ah, ok, so it should work if I placed the 'hello.bmp' in the folder containing the .exe?

Edit: it worked.
[/quote]
Are you running the application from the IDE, or from the desktop?

The typical setup for development (I think) would be to run the application from the IDE, leave the working directory set to the project directory, and store your game data in the project directory. (One advantage of this approach is that you won't have to duplicate the data for each build configuration.)
0

Share this post


Link to post
Share on other sites
[quote name='xzbobzx' timestamp='1304441579' post='4806015']
I also get this sometimes:
LINK : [external drive]\SDL_Tutorial\Debug\SDL_Tutorial.exe not found or not built by the last incremental link; performing full link
[external drive] being, of course, my external drive. :|
[/quote]

This is just a warning spit out by the linker telling you that the link process has to be done again from scratch, even though the linker found previous output data, nothing to worry about for small projects.
0

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