Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 23 Jan 2012
Offline Last Active Jan 31 2014 03:32 AM

Topics I've Started

Using objects in std::vectors

14 October 2013 - 03:20 AM

I am working on a text-based rpg, using C++ and I have some trouble with std::vectors. I've created a vector in my namespace called "Initialize" , in its header. In "Initialize.cpp" I add objects of the type "Items" to the vector using push_back.

I want to know how I can access the objects in my vector I've created in my namespace "Initialize" from my Item-class.



GetItemName(Diablo::Initialize::existingItems[1]) //GetItemName returns the name of the object it receives.
                                                  // This doesn't work since I have to include "Initialize.h"
                                                  // which gives linker-errors.

The problem is that if I include "Initialize.h" to be able to access the vector defined in "Initialize.h", i'll get linker-errors since the the vector will be defined both in my "Initialize.h" and in my "Items.cpp".


How can I declare my vector so that I can easily access from other classes etc.?


01 April 2013 - 03:16 PM

Hi all!
I've been studying C++ for a while now and I want to start with 2d-programming and then work my way towards 3d-programming (heard opengl is a good way to start). I have some background in C# and XNA where I have programmed couple of small games such as Asteroids, Pac-man and a 2d-platformer. I've heard alot about SDL and SFML but can't really decide which one to choose. The main goal is to learn more C++ through game-programming.

Any recommendations from you guys? Would appreciate if you could share your own personal experience and perhaps some good tutorials etc.

Sorry for my english btw, it's not my native language :)

Can't type "}" in Visual C++ 2010

01 July 2012 - 09:16 AM

Basically what the title says. I can't typ the "}" curly bracket. The "{" works fine, nothing wrong the the keyboard button either since I can typ it here obviously :P

Tried googling it with no result. Using swedish keyboard btw but that shouldn't matter.

Litterature recommendation for programming/game development

27 June 2012 - 10:03 AM

I recently started programming and have got a bit familiar with C++. I am also new to this community but i'm here to stay :P I was wondering if the programmers out there could recommend me decent litterature about programming (C++, engines/libraries, AI etc.). I have decided to spend about 14 months teaching myself programming/game development before attending a game developing school.

And if you have time I wouldn't mind a guideline (like which books I should pick up after learning my computer language).