Jump to content
  • Advertisement

Legend097

Member
  • Content Count

    25
  • Joined

  • Last visited

Community Reputation

122 Neutral

About Legend097

  • Rank
    Member
  1. Legend097

    OpenGL iDE

    I don't know which version of Dev-C++ you're talking about but the Dev-C++ 5 Beta I downloaded has no such examples. Next time you try and "help out" a n00b like me either get your information straight or don't hide behind an "Anonymous Poster" identity. ;)
  2. Legend097

    OpenGL iDE

    I know Visual C++ has a built-in compiler and library like Dev-C++, but does it support OpenGL right of out the box?
  3. Legend097

    OpenGL iDE

    Well, I've given up on trying to get OpenGL to work with Dev-C++, so does anyone else know a fully-OpenGL functional IDE (no configuration or anything, just download and install). Also, is there anything else that you guys would recommend I use if I plan to start developing in OpenGL?
  4. Legend097

    DirectX or OpenGL

    Sorry, that was my post. I didn't realize I wasn't logged in.
  5. Legend097

    DirectX or OpenGL

    I have reached the dilemma that you vets probably hear from n00bs like me all the time: DirectX or OpenGL. I've done a little research, and from what I've read and heard from people, OpenGL is very good if your looking to port to other OSs, but DirectX has a lot more resources and is easier to write on an MS platform. Also, I've never heard of a AAA title made using OpenGL, so if I'm looking to get into the industry one day, would DirectX be a better choice?
  6. Legend097

    OpenGL Error

    I am looking into learning a bit of OpenGL, so I downloaded a couple of the lessons from the NeHe OpenGL tutorials. When I tried to compile the code I specifically downloaded for Dev-C++, I got the error "No such file or directory." and it said the error was on line 12 which said #include <gl\glaux.h> or the header file for the Glaux library. I was under the impression I didn't need to do anything to my computer but update my NVidia driver. Do I need to download something else?
  7. Quote:Original post by Legend097 I have just been using C++ for the last few days as I've been working on a very basic text-adventure game. You can contact me via email at Slayer@talk-linux.com or AIM TheSlayer097. I would be very happy to join your group, but I think that its more of the blind leading the blind unless we have some experience programmers to give us some tips now and them and help us along. Okay, I finally got MSN working. You can IM me at Legend@chaos.talk-linux.com. What's your email address KingRage?
  8. I have just been using C++ for the last few days as I've been working on a very basic text-adventure game. You can contact me via email at Slayer@talk-linux.com or AIM TheSlayer097. I would be very happy to join your group, but I think that its more of the blind leading the blind unless we have some experience programmers to give us some tips now and them and help us along.
  9. Legend097

    Nested If Statements

    Quote:Original post by Luctus Heh, your programming style reminds me of myself when I first wanted to write a text-based adventure game many years ago. Anyway, your usage of nesting functions worries me. You're always passing on control to another (or the same) function after you finished execution of a function. This will in practice work exactly as you intended...however, after playing the game for a long while, you'll see that you get a "stack overflow" error. You see, whenever you call a function, the program needs to store the address in memory it should return to after it finished running the code in your function. The program places this address on the "stack", now this stack-space is (of course) limited and if you fill it up you'll get this "stack overflow" error. Now, the reason why you're filling up the stack, imagine this scenario: main() calls mainmenu(). Store return address to main() on stack. player selects "new game". Store return address to mainmenu() on stack newgame() calls crashsite(). Store return address to newgame() on stack. crashsite() calls crashsite_menu(). Store return address to crashsite() on stack. All code paths in crashsite_menu() leads to another call to crashsite(), which means that you've entered an infinite loop where every iteration results in storing the return address of crashsite_menu() on the stack...which fill effectively fill up your stack after a while. If you're planning on continuing on this game, I suggest you rethink your design now before you inevitably run out of stack and got a couple of thousand lines of code to change in order to make it work.. Thanks for the feedback. How do you suggest I optimize this code. I've written a little bit more, another 8 functions worth, but its still under 700 lines so I don't mind changing it :)
  10. Legend097

    Nested If Statements

    Oh, yeah. Well, I guess its plain to see I'm still a newb :) Thanks for your help, I'll have to code more carefully next time.
  11. Legend097

    Nested If Statements

    Here's the exact code, not the simplified version I posted before: #include <iostream> #include <stdlib.h> #include <string.h> using namespace std; // Menu Screens void mainmenu(void); void newgame(void); void loadgame(void); void helpfiles(void); void credits(void); // In-Game Locations void crashsite(void); void crashsite_menu(void); void clearing(void); void clearing_menu(void); // Possible Location Exits char north[] = "north"; char south[] = "south"; char west[] = "west"; char east[] = "east"; char up[] = "up"; char down[] = "down"; char in[] = "in"; char out[] = "out"; // Object Variables char dir[128]; char item[128]; char item_name[128]; // In-Game Keywords char look[] = "look"; char examine[] = "examine"; char take[] = "take"; char drop[] = "drop"; char eat[] = "eat"; void wrapPrint(char* str, int maxwidth) { // seps holds the character which denotes the separation of two words (a space) char seps[] = " "; char* token; int currentpos = 0; // loop while there are still words to print token = strtok(str, seps); while(token) { // if a word is too big if(currentpos + strlen(token) > maxwidth) { cout << endl; currentpos = strlen(token); } else { cout << " "; currentpos += strlen(token) + 1; } cout << token; token = strtok(NULL, seps); } cout << flush; } void mainmenu(void) { int action; cout << endl; cout << "*****************************************" << endl; cout << "* *" << endl; cout << "* A W A K E N E D *" << endl; cout << "* *" << endl; cout << "*****************************************" << endl; cout << endl; cout << "1. New Game" << endl; cout << "2. Load Game" << endl; cout << "3. Help File" << endl; cout << "4. Credits" << endl; cout << endl; cout << "> "; cin >> action; cout << endl; cout << endl; switch(action) { case 1: newgame(); break; case 2: loadgame(); break; case 3: helpfiles(); break; case 4: credits(); break; default: cout << "Please enter the designated number of the menu you wish to access."; cout << endl; cout << endl; mainmenu(); break; } } void newgame(void) { char intro1[] = "It is an age when mankind has overcome its confinement of one planet, and has colonized hundreds of worlds across the galaxy. However, much still remains to be explored, and intelligent life in the universe has still yet to be discovered.\n"; wrapPrint(intro1,78); cout << endl; char intro2[] = "You are among a small team of researchers dispatched to chart new planets, safe lightspeed routes, and any life you may encounter on your journey. You are only one of thousands of other teams, just a drop in the bucket, and conveniently go unnoticed when you are forced to crashland on an uncharted planet after a mysterious engine failure.\n"; wrapPrint(intro2,78); cout << endl; char intro3[] = "You, a lone mercenary, are the team's sole hope of survival. Equipped with a machine gun, a shotgun, and a spare pistol, along with some extra ammo and enough rations for your team for 10 days, you must seek out shelter and extra food if you and your team are to survive.\n"; wrapPrint(intro3,78); cout << endl; char intro4[] = "Still, other dangers lie before you. Who knows what unthinkable horrors reside in the dense brush of this strange planet....\n"; wrapPrint(intro4,78); cout << endl; cout << endl; system("PAUSE"); cout << endl; cout << endl; cout << endl; crashsite(); } void crashsite(void) { cout << "THE CRASHSITE" << endl; cout << "-------------" << endl; char desc[] = "You are awakened by the deafening sound of silence. After hearing shrill screams in your last moments of consciousness, the sudden soundlessness is unnerving. It's very quiet. But all the time you can hear some eerie, raspy breathing. The sound wasn't coming from you are any of the other survivors; it is more *around you* than anything. It seemed like the entire world surrounding you is alive with excitement and vigor. You don't have a good feeling about this place, and you have long since learned to trust your intuition.\n"; wrapPrint(desc,78); cout << endl; char desccont[] = "You slowly and carefully check for any survivors among the crisp carcasses of burnt researchers. Twelve others have survived. You collect all usable supplies from the site, and decide that you should get moving. You aren't safe just standing around here waiting for something to attack you. Besides, there's nothing left here for you anyway.\n"; wrapPrint(desccont,78); cout << endl; crashsite_menu(); } void crashsite_menu(void) { cout << "> "; scanf("%s",dir); if(!strcmp(dir,north)) { cout << endl; cout << "You cannot go in that direction.\n"; cout << endl; crashsite_menu(); } else if(!strcmp(dir,south)) { cout << endl; cout << "You cannot go in that direction.\n"; cout << endl; crashsite_menu(); } else if(!strcmp(dir,west)) { cout << endl; cout << "You cannot go in that direction.\n"; cout << endl; crashsite_menu(); } else if(!strcmp(dir,east)) { cout << endl; cout << "You cannot go in that direction.\n"; cout << endl; crashsite_menu(); } else if(!strcmp(dir,look)) { cout << endl; cout << "You look around and see nothing of interest.\n"; cout << endl; crashsite_menu(); } else if(!strcmp(dir,examine)) { cout << endl; cout << "What would you like to examine?\n"; scanf("%s",item); if(!strcmp(item,item_name)) { cout << endl; cout << "Item description.\n"; cout << endl; crashsite_menu; } else { cout << endl; cout << "You don't see that.\n"; cout << endl; crashsite_menu; } } else if(!strcmp(dir,take)) { cout << endl; cout << "What would you like to take?\n"; scanf("%s",item); if(!strcmp(item,item_name)) { cout << endl; cout << "Taken.\n"; cout << endl; crashsite_menu; } else { cout << endl; cout << "You don't see that.\n"; cout << endl; crashsite_menu; } } else if(!strcmp(dir,drop)) { cout << endl; cout << "What would you like to drop?\n"; scanf("%s",item); if(!strcmp(item,item_name)) { cout << endl; cout << "Dropped.\n"; cout << endl; crashsite_menu; } else { cout << endl; cout << "You aren't carrying that.\n"; cout << endl; crashsite_menu; } } else if(!strcmp(dir,eat)) { cout << endl; cout << "What would you like to examine?\n"; scanf("%s",item); if(!strcmp(item,item_name)) { cout << endl; cout << "Hmmm. Oddly satisfying.\n"; cout << endl; crashsite_menu; } else { cout << endl; cout << "That isn't edible.\n"; cout << endl; crashsite_menu; } } else { cout << "That is not a valid command. See \"Help Files\" for more information.\n"; cout << endl; crashsite_menu(); } } void clearing(void) { cout << "THE CLEARING" << endl; cout << "------------" << endl; char desc[] = "You find yourself standing in the middle of a clearing. This area was obviously cleared deliberately, as nothing *natural* could have stripped those long, venomous-looking plants bare like that and thrown them aside with such intent.\n"; wrapPrint(desc,78); cout << endl; clearing_menu(); } void clearing_menu(void) { cout << "> "; scanf("%s",dir); if(!strcmp(dir,look)) { cout << endl; cout << "You see long, venomous-looking plants here.\n"; cout << endl; clearing_menu(); } else { cout << endl; cout << "That is not a valid command. See \"Help Files\" for more information.\n"; cout << endl; clearing_menu(); } } void loadgame(void) { cout << "Loading Saved Game..."; } void helpfiles(void) { cout << "Accessing Help File..."; } void credits(void) { cout << "Credits..."; } int main(void) { mainmenu(); cout << endl; system("PAUSE"); return 0; } Here's the warning message I'm getting: [Warning] statement is a reference, not call, to function `crashsite_menu()'
  12. Legend097

    Nested If Statements

    I didn't get any errors, only a warning saying that usr_menu() was a referrer and did not call a function. Then when I ran it it won't call the function, it just ends the program. And sorry about not using the source tag, I wasn't sure what it was until I just looked it up in the FAQ.
  13. Legend097

    Nested If Statements

    C++
  14. Legend097

    Nested If Statements

    For some reason Dev-C++ won't let me call functions within nested if statements. When I try and compile, it compiles correctly, but a warning comes up that I am just referring to the function, not calling it. Here's what I'm trying to do: if(!strcmp(usrinp,exam)) { cout << endl; cout << "What would you like to examine?\n"; scanf("%s",item); if(!strcmp(item,item_name)) { cout << endl; cout << item_desc << endl; usr_menu(); } else { cout << endl; cout << "You don't see that anywhere."; usr_menu(); } } else { cout << "That is not a valid command.\n"; usr_menu(); } What I am basically trying to do is to allow the person playing my text adventure to type the word "examine", the program asks them what they would like to examine, they type in the object, and the program checks whether or not the object is in their location (or room). If it is, it displays the object's description, and if its not, it displays the error message. It then returns back to the usr_menu() or: > where they can input another command. Why isn't this code working? Is there an easier way of doing this? Thanks for your help.
  15. I don't know if this is possible, but is there a way to start the console in full screen like you would start a window for a game?
  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!