Sam Gamgee

Members
  • Content count

    176
  • Joined

  • Last visited

Community Reputation

222 Neutral

About Sam Gamgee

  • Rank
    Member
  1. Is it possible to turn off echo with cin/cout?

    Isn't getch() a standard C command that should work on Linux? I know it's not C++, but it'll do what you want I should think.
  2. Pointers and Arrays

    Yup, as the above poster said, those 'for' statements should be something like so: for (int i=0; i < ITEMS; ++i){
  3. A novice Question

    Try this (using std::string): #include <iostream> #include <string> int main() { std::string name; std::cout << "What is your name?" << std::endl; std::cin >> name; std::cout << "Oh, I see. Your name is " << name << "." << std::endl; return 0; } As AP above mentioned, a 'char' only stores a single character. Using std::string will allow you to store an entire 'string' of characters.
  4. Gamepad support

    Search MSDN for the joyGetPosEx function. There are of course other ways of doing this (such as through DirectX I think), but this is pretty simple with this function I think...
  5. Creating Tile Maps

    I would say go for the option of asking the user what size map they want using a dialog box of some sorts before they start making a map. Then additionally if you wanted to, you could have an option to increase the size by simply tacking on n amount or rows and columns. I see this setup used a lot in RTS games myself, however I suppose it depends a lot on what you need done. For my own part, my tile engines in the past have always asked what the map size is and once it's set it can't be changed without redoing the entire map. This worked fine for my RTS and action/adventure games, but perhaps if I were creating a puzzle game of sorts, I would supply the user with some more powerful tools.
  6. WINMM.LIB

    Here's some instuctions on how to actually get it all working with express: http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/default.aspx . Hope that helps. Also, the 64 bit version probably didn't work for you as you don't have Windows 64 bit edition I'm guessing? -Walter
  7. Simple way to fix this should be to: load up your project settings, and go to C/C++ -> Code Generation Next change runtime library from Multi-threaded DLL to Multi-threaded and rebuild. That should sove your problem
  8. Perhaps I'm confused (it happens a lot:), but can't you just have all your objects inherit from a single base class "CObject" for example. Then you can store a single array/vector what have you of pointers to CObject. These pointers could of course then point to any derived class. [EDIT]This is actually very similar to what I've been doing for various buildings in my RTS game. So I have mills, lumber camps, town centers, etc all different classes however each of them are derived from CObject. This then contains virtual functions for things like "user click", "render", or "one second update", etc. You should probably be able to do the same for your ships... [/EDIT]
  9. Pointers help in c++

    If I understand what you're asking, you'll want to use a "pointer to a pointer" like so (untested and I'm tired, so please excuse any mistakes :) ): int main() { int a = 50, b =40; int *pointer1 = &a; int *pointer2 = &b; swap_pointers(&pointer1, &pointer2); cout << pointers... blah blah...... return 0; } void swap(int **pointer1, int **pointer2) { int *temp = *pointer1; *pointer1 = *pointer2; *pointer2 = temp; return; }
  10. Silly c++ problem

    int sprite_count = 10; cSprite **sprites; sprites = new *cSprite[sprite_count]; changed the CSprite *sprites to CSprite **sprites (pointer to a pointer).
  11. [web] Which design is better?

    I vote for design two.
  12. Inheritance Help

    Quote:That's not a good idea. Yes, quite right... I should have mentioned that, however I was in a hurry (Nova was on in like 5 minutes [smile] ). Sorry 'bout the ommission though.
  13. Inheritance Help

    Add a #include <string> to your header file and also use the syntax std::string instead of just "string" (unless you add a "using std" to your header file also).
  14. You can't use new in that manner. I suggest creating a 1D array of size x*y. Then to access a particular tile use the following: array[tileY*sizeX+tileX]; Or if you really want 2D arrays: tile** array; ... array = new tile*[x]; for(int i=0; i<x; ++i) array[i] = new tile[y]; ... tile t = array[x][y]; hope that helped. [Edited by - Sam Gamgee on January 10, 2006 2:22:11 PM]
  15. Recursion in class

    If I had to guess, I'd say that since "Recursion()" is inlined, the compiler is continually attempting to insert the code into itself (although I would have thought the compiler should flag this... what are you using to compile this?). Just a guess, sorry I can't offer more help than this...