Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About darenking

  • Rank
  1. Thank you all. You're magic.
  2. One advantage is one fewer .h files. I've got all this working now so thanks all!!!
  3. So there is no way of doing it whereby it would be able to access them with m_Parent.m_Sprites rather than m_Parent->m_Sprites ?
  4. OK gang, I now have my World object with a nested class called WorldLoader. In the update method of World, I check to see if new data needs to be loaded (started a new level) and if so, create a new instance of WorldLoader and access its Load method: //in world.cpp... (simplified, I check for load failure and stuff) if ( ! m_Valid ) { m_Valid = true; WorldLoader worldLoader; worldLoader.Load(); } Question is, how does WorldLoader access the data members of World? It needs to load bitmaps into its vectors, for example. Here are some of the variables, objects and Allegro bitmaps that will need to be modified. They are all private, would rather not make them public as I don't want the object that creates World to be able to access them. These are part of World. WorldLoader is a private member of World too. private: int AmountOfHairyScaryMonsters; Maze m_Maze; vector<Actor*> m_Actors; vector<BITMAP*> m_Sprites; Camera m_Camera[9]; vector< vector<int> > m_Cycles; class WorldLoader { public: WorldLoader(); ~WorldLoader(); void Load(); }
  5. I've got it working anyway. You're my hero. Have rated you up to the max.
  6. I'm confused now. I said don't we need an include for bar.h and you said we do and you've put one in, but there isn't one there and anyway there isn't a bar.h so why did I say it? I think I shall have a lie down.
  7. Excellent but don't we need an include for bar.h in bar.cpp? (error in the example?)
  8. No but I've seen the Athlon Buddists in southern China. Boy do those women go!
  9. Howdy gang. I need to nest a class inside another class. I've seen some examples of it on the interweb but none which address my two main problems. The first is that my code is in separate files (.h and .cpp), whereas most examples don't address this. Second issue, my two classes are huge (my World object and a Loader object that sits along side it but I want to put inside it), so I would prefer to keep the code in two separate files. Any takers? [Edited by - darenking on August 31, 2005 7:36:56 AM]
  10. Much faster than a human could do it by hand, with coloured beads and pieces of cloth for example.
  11. Personally I'm only using these routines to create my character sprites at the start of each level, so even if it is horribly slow, I expect we're still talking about less than a second even if there were hundreds of sprites?
  12. Yes, that is well and truly cleared up. It's just the same as declaring anything else, such as a string or an int. I'm such a dullard. Off to snog a mallard.
  13. Anyway thanks very much for that mike, you totally saved my life. Have rated you up.
  14. Hi, Just a small thing. I'm using Allegro C++. I have a vector of bitmap pointers: vector<BITMAP*> m_Sprites; I just want to be able to change one of these sprites, let's say the third sprite, in a method. So I need to pass it, not by copy of course but by reference or whatever. I know I will be using something like this: m_Sprites[2]. But I don't know about the pointers and/or references. I sorta get the idea of them but can never do the syntax!
  15. Thanks for this Mike. There's a couple typos I picked out, inrColor should be intColor, and I assume realColor nc should be intColor nc? Both in this function: inrColor realColorToIntColor(realColor c) { realColor nc; // should this be intColor? nc.r = c.r*255; // cast??? nc.g = c.g*255; nc.b = c.b*255; nc.a = c.a*255; return nc; } If I make those changes I get a warning "converting to 'int' from 'float'". Shall I do a cast or something? Or does it signify a problem with the code?
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!