![]() |
Need help with C++
How do you save your variables in a file in C++. Im talking it this year and me and a friend are doing a side project and we want the ability to save... We only need variables saved not anything else.
Thanks! Also if you can help me understand how you can run an image thing in C++ like a max picture that would help to |
Well, there's no way to just do something like
saveAllVariables() loadAllVariables() but you can just write them all out to a file one by one: ofstream ofs; ofs.open("out.txt", ios::out); if(!ofs){ //error stuff goes here } ofs << var1 << ' ' << var2 << ' ' << var3 << etc, etc; ofs.close(); and then to read it back in: ifstream ifs("out.txt"); if(!ifs) //error stuff ifs >> var1 >> var2 >> var3 >> etc,etc; Let me know if you need anything else. -Rob |
yes but rob, t-ton and I would like to know how to run 3d images and manipulate things in 3d like you can do in 3ds max. we are making an rpg.
Also what header files are needed to compile the above code? |
Quote:
Quote:
|
also is there any way to change the color of text in a dos window? We will look into openGL, have you uesd it before? if so any tips?
|
To use the above code you need iostream.h and fstream.h you may also needs stdlib.h, depending on what your compiler includes automatically, etc.
As for image stuff, C++ won't do it by itself, so you're going to need some kind of library. If you could give some more specifics as to what you're trying to do, I'd be more than happy to point you in the right direction. For starters, given that you seem to be creating a game, check out gamedev.net. They've got some really good tutorials/howtos, and their discussion boards are incredibly helpful. -Rob |
yea we are working on an rpg. T-ton and I want to use 3ds max and make the code let you run around and do stuff like in any other rpg like asheron's call or Star wars Galaxies and such.
but untill we can do that we were wondering if there is any way to use ... conio.h? ... or something to change the color of text like they do on some muds like achaea? |
Well your question isn't one that can elicit a simple response. Unfortunately. Game programming is a tricky matter, and can get confusing if you don't know what you are doing -- or if you do!
How do you change text color? Well, you first have to decide if you want your game to work in one specific venue (such as MS), or if you want cross-platform support. You'll need to get some libraries to work with -- DirectX for Windows, and various others for varying platforms (the CrystalSpace link I posted before is a multi platform game engine with blosoming support for 3ds max ... I have some experience with this, and can offer some advice if needed). From there, look into the API of the specific library you have. There are a variety of books detailing DirectX API structure, and game programming in general. As for 3ds max support, it all depends on the library you have. It will need to have functions to read in a 3ds file -- or you'll need to get a converter to change your 3ds file to another format (such as a quake file format), and the conversion might not be absolutely perfect (computers are funny like that). In doing a quick search on google, I came across this: Quote:
|
| All times are GMT -5. The time now is 14:06. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi