Jump to content
  • Advertisement

Rog

Member
  • Content Count

    20
  • Joined

  • Last visited

Community Reputation

122 Neutral

About Rog

  • Rank
    Member
  1. Rog

    fread problems

    I see that you have gotten an answer as far as how to convert the text to int. It occurrs to me that a few words about the why and how of file IO as it applies to game development is in order... Disk files are frequently used in games to store state or configuration information. When designing the part of the game where information is saved to disk you would need to choose between binary and text file type. If you choose binary you would create one or more file layouts (using struct) and use fread and fwrite for IO. On the other hand if you choose text as your file type you would organize data into newline terminated records and use fgets and fputs (or fprintf) for IO. In many cases binary files are preferred over text because the data is usable as soon as it is read. The code for reading and writing binary files is usually very clean and logical. Text config files, on the other hand, are preferred when you want the file to be editable by the user. -Rog
  2. Rog

    What to learn first?

    If your intention is to learn game programing then you should make C++ your main language. If you intended to write business applications then I would tell you to learn VB or Java as your main language. Always delve into other languages, but keep yourself centered on your main language. I don't want to get into a language war, so I won't make a bunch of opinionated statements about the differences between C++, VB and Java. I will just put this out there... The VB and Java languages were designed for developing business applications. C++ was designed to be a relativly low level, multi purpose language, suitable for systems programming. Rog
  3. Rog

    some constructor problems

    Just a comment on your choice of identifier name FILE. I would avoid that one and go with file or File. FILE is a structure declared in stdio.h that is used very frequently in C programming. No biggie, just a suggestion. Rog
  4. Rog

    some constructor problems

    Quote:Original post by raptorstrike yes i do but i also thought that if you inherit you automaticaly used the new constructor if one is defined First the base class constructor is called, then the derived class constructor. You can control which base constructor is called if you need to. Rog
  5. It sounds to me like you would be better to make the event reciever a pure virtual function of the IEventReciever base class. When you derive a game state you implement the virtual function for that specific state. That way C++ will make sure the correct function was called.
  • 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!