Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 04 Jul 2012
Offline Last Active Jul 25 2012 02:12 AM

Topics I've Started

SFML issue with AMD Graphics cards?

24 July 2012 - 03:48 AM

Hey guys do you know of any issue SFML has with AMD graphics cards?

I started learning the SFML library first, but was put off when it refused to show anything past the console window. I tried some work arounds concerning placing a DLL in my .exe directory.. BAM blue screen of death.

My computer has an AMD HD6970 graphics card. I tried it on my friends computer and it worked fine without any workarounds or anything. His graphics card is different to mine so I am assuming that is the problem.

I moved to SDL and was having fun with that when I saw a whole lot of SFML recommendations. So I decided I'd give it a go again. Same problem as before.

Does anyone know how to avoid this problem?

Managing headers correctly within Vis C++ express

23 July 2012 - 07:50 PM

Hey everyone,

I have been following LazyFoo's tutorial series lately to learn a bit about using the SDL library within Visual C++ 2010 Express.

After completing his series, I went on to try and create an application that generates statistics for a character dependent on player input. Eg elf and human races will have different dexterity modifiers etc... Weapon attack will modify your atk modifier etc...

I am having a little linker trouble however. I have split my files up into .h and .cpp files so as to organise everything better. Here are my .h files:

This header is for general includes such as the SDL lib and the std includes
note: I have swapped the > symbols on these includes to " for the purpose of showing my code as the < symbols make whatever is inside them not show up here.
[source lang="cpp"]#ifndef GENHEADERS_H#define GENHEADERS_H//General header includes for the STD lib//As well as other useful utilities//SDL includes#include "SDL.h"#include "SDL_thread.h"#include "SDL_image.h"#include "SDL_mixer.h"//basic utility includes#include "string"#include "cmath"#include "fstream"using namespace std;#endif[/source]

This header is for storing my global variables. I have included the General header file here so as I can create SDL defined variables such as SDL_Surface.
[source lang="cpp"]#ifndef GLOBALS_H#define GLOBALS_H#include "GenHeaders.h"bool quit = false;//This manages the game loopSDL_Surface *screen;//The screen surface(duh)SDL_Event event;//The event structure//SDL surfacesSDL_Surface* background;SDL_Surface* playerDetailsBG;//Screen State Variablesenum Screen { playerScreen, detailsScreen };Screen currentScreen = playerScreen;#endif[/source]

My constants header file is the same story as the globals, except that it holds onto my constants for me
[source lang="cpp"]#ifndef GENHEADERS_H#define GENHEADERS_H//General header includes for the STD lib//As well as other useful utilities//SDL includes#include <SDL.h>#include <SDL_thread.h>#include <SDL_image.h>#include <SDL_mixer.h>//basic utility includes#include <string>#include <cmath>#include <fstream>using namespace std;#endif[/source]

I have a general utilities header to hold global functions such as blitting one surface to another.
[source lang="cpp"]#ifndef UTILITIES_H#define UTILITIES_H#include "GenHeaders.h"//General utility FunctionsSDL_Surface *load_image( string fileName );//load an imagevoid apply_surface( int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* clip = NULL );#endif[/source]

I also have created a header to hold my classes. As you can see I am working on creating a button.
[source lang="cpp"]#ifndef ACORNAPI_H#define ACORNAPI_H#include "AcnButton.h"#endif[/source]

Here is my button header file. This is where the problems arise as the compiler complains that my global variables are already defined in AcnButton.obj

[source lang="cpp"]#ifndef ACNBUTTON_H#define ACNBUTTON_H#include "GenHeaders.h"#include "utilities.h"#include "globals.h"///////////////class AcnButton///////////////{private: SDL_Rect button;//The range of the background SDL_Surface *buttonGraphic;//The button graphicpublic: AcnButton( int x, int y, int w, int h );//Constructor ~AcnButton();//Destructor bool onButton();//Returns true when the given coordinates are within the button void showButton( SDL_Surface *thisSurface );//applies the button to the given surface};#endif[/source]

And my main header.
[source lang="cpp"]#ifndef MAIN_H#define MAIN_H#include "AcornAPI.h"#include "GenHeaders.h"#include "utilities.h"#include "globals.h"#include "Constants.h"bool initialise();//initialise anything that needs to bevoid clean_up();//Frees anything that needs to bevoid HandleWindowEvents ();//Handle Window Eventsvoid LoadFiles ();//Load the required Source Filesvoid ShowBackground();//Show Background Imagevoid ShowDetails();#endif[/source]

And my error when I try to compile is:
[source lang="cpp"]1>------ Build started: Project: Acorn, Configuration: Debug Win32 ------1> AcnButton.cpp1> Generating Code...1> Compiling...1> main.cpp1> Generating Code...1>main.obj : error LNK2005: "struct SDL_Surface * background" (?background@@3PAUSDL_Surface@@A) already defined in AcnButton.obj1>main.obj : error LNK2005: "struct SDL_Surface * playerDetailsBG" (?playerDetailsBG@@3PAUSDL_Surface@@A) already defined in AcnButton.obj1>main.obj : error LNK2005: "struct SDL_Surface * screen" (?screen@@3PAUSDL_Surface@@A) already defined in AcnButton.obj1>main.obj : error LNK2005: "union SDL_Event event" (?event@@3TSDL_Event@@A) already defined in AcnButton.obj1>main.obj : error LNK2005: "bool quit" (?quit@@3_NA) already defined in AcnButton.obj1>main.obj : error LNK2005: "enum Screen currentScreen" (?currentScreen@@3W4Screen@@A) already defined in AcnButton.obj1>C:\Users\Me\Documents\Vis C++ Express 2010\Acorn\Debug\Acorn.exe : fatal error LNK1169: one or more multiply defined symbols found========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========[/source]

Now I am assuming it is an error in the header files. Somehow the globals.h is getting included more than once. I have added #ifndef #define #endif to the headers to try and prevent this however.

Does anyone know what I'm missing here?
Perhaps t isn't a problem with the headers, but a problem with the .cpp files?

Please let me know if the headers are fine so as I may pinpoint the source of the issue.

Thank you!

Looking for some direction

04 July 2012 - 07:16 AM

Hey everyone! I came here seeking some direction as I am currently, for lack of a better word, lost.

I am enthusiastic about game programming, as I'm sure is obvious by the fact that I am actually on these forums. I am also prepared to dedicate a good deal of time to learning how to program games. I am lacking direction however as I know essentially what I wish to achieve, but I would like recommendations for the particular areas of game development that I am interested in.

What I have done thus far regarding game development:
-I have a bit of experience in programming games using javascript(Or as many prefer, UnityScript) and C# within the Unity3D game engine. All of this was learnt via experimentation, asking questions on unity answers and documentation consultation. The games I were programming however were not very well optimised. I feel that this stage really started my deep interest in game programming.

-I decided I'd like to harness the power of the UnrealEngine3 and attempt to program in that environment. It was then that I realised that essentially I knew nothing much about programming. I found some documentation gems, but even then it wasn't enough for me to acquire knowledge. I was basically stuck. In Unity3D it was so easy to pull generic functionality out of a huge list of pre-made functions(The Unity3D API) and there was so much documentation that I never was stuck for too long a period of time.

-It was at this point that I decided to learn how to make a game without using a pre-made engine itself. The point was not to ditch using an engine, but to enable me to later down the track actually be able to make more use of one(Namely Unreal Engine 3). So I decided to learn C++. I read a book called Beginning C++Through Game Programming, Third Edition by Michael Dawson. This went very well. I learnt a lot from the book and really enjoyed reading it.

-It was now time for me to try my hand at something outside of DOS however. I had my mind set on creating a 2D game, namely an rpg like that of the early final fantasy or pokemon games. This is where I hit a snag. I was using Visual C++ Express as my compiler and began reading Beginning Game Programming by Jonathan S. Harbour. I wasn't entirely sure I was going down the right path using DirectX for a 2D game. Upon further research I discovered that DirectX is essentially Microsoft exclusive. I wanted to learn how to develop games for Windows, yes, but I also wanted to develop applications for smartphones or games that are supported across a range of platforms. I also wasnt sure if DirectX is exactly what I was looking for in terms of creating a 2D game.

So I decided that I'd seek direction from a community of experienced game programmers.

What I want to do
At the moment I wish to focus primarily on 2D game development, so any recommendations, pipeline examples, words of wisdom, experienced advice are all welcome!
I am using Visual Studio C++ as my current compiler, but am willing to switch over

Eventually I want to be able to program 2D games for PCs but also for smart devices such as android and iphone. I am considering OpenGL as a possible API to learn.
I also want to be able to program 3D games (Probably through an engine such as UDK, but perhaps eventually through my own 3D engine).