• Content count

  • Joined

  • Last visited

Community Reputation

146 Neutral

About brcolow

  • Rank
  1. Basics for a map engine?

    I take it you're new, but please try and be thoughtful with your posts. We try to help, but when you ask a question so vague and so nonsensical (saying things like "my game just doesnt run on anything") is not going to get you any help. So, why not try and diagram this 2D tile-based map engine. If you get stuck, ask for help on a specific thing. No one here is going to do your coding for you, no matter how much we might want them to ;)
  2. ofstream issues

    I think I answered my own questions, basically I made the class declaration like so: class CLogger : std::ofstream The code compiles fine now, but the problem is that I am getting a run-time error. Here's the call-stack: Quote: > msvcr71d.dll!_fsopen(const char * file=0xcdcdcdcd, const char * mode=0x104ea5c4, int shflag=64) Line 55 + 0x3 C msvcr71d.dll!fopen(const char * file=0xcdcdcdcd, const char * mode=0x104ea5c4) Line 116 + 0xf C msvcp71d.dll!std::_Fiopen(const char * filename=0xcdcdcdcd, int mode=2, int __formal=438) Line 56 + 0x15 C++ msvcp71d.dll!std::basic_filebuf<char,std::char_traits<char> >::open(const char * _Filename=0xcdcdcdcd, int _Mode=2, int _Prot=438) Line 167 + 0x1a C++ msvcp71d.dll!std::basic_ofstream<char,std::char_traits<char> >::basic_ofstream<char,std::char_traits<char> >(const char * _Filename=0xcdcdcdcd, int _Mode=2, int _Prot=438) Line 628 + 0x1a C++ OninWars_d.exe!CLogger::CLogger() Line 8 + 0xcd C++ OninWars_d.exe!CGameManager::CGameManager() Line 10 + 0x2d C++ OninWars_d.exe!main() Line 15 + 0x2e C++ OninWars_d.exe!mainCRTStartup() Line 398 + 0x11 C That line is: _ASSERTE(*file != _T('\0')); in fopen.c Any ideas? :(
  3. ofstream issues

    I see, thanks for the help but I am a little unclear about what you said. What am I supposed to do for the class declaration of CLogger? Also, I assume I should make filename a public member var..yes? Also, do I need to do anything special when creating the class now?
  4. ofstream issues

    I tried that before..but just to make sure I tried it again, and the exact same error occured. Strange...I know :(
  5. ofstream issues

    You know, I thought about that and saw it but there is no way in my limited knowledge to make it global. You see, there is no = operator for ofstream, so I can't do something like: std::ofstream log (filename); this->logFile = log; So I'm not sure what to do..
  6. Hi, I am creating a logger class but I am having a run-time error. Basically I use this code to open the log: int CLogger::openLog(const char* filename) { std::ofstream logFile(filename); if (!logFile.is_open()) { return -1; //Error! Couldn't open the log } writeLog("--LOG STARTED--"); return 0; } Then, I use this code to write to the log (the overloaded method other classes throughout the code use): int CLogger::writeLog(char* text) { logFile << text << "\n"; logFile.flush(); return 1; } int CLogger::writeLog(int text) { logFile << text << "\n"; logFile.flush(); return 1; } int CLogger::writeLog(std::string text) { const char* charText = text.c_str(); logFile << charText << "\n"; logFile.flush(); return 1; } The error though, is strange. The log outputs --LOG STARTED-- as it should in the openLog method, but then when I call upon it from an outside class such as this one: int CGameState_Menu::preRun() { log->writeLog("preRun() menu state"); return 1; } I get a run-time error. Here is the call-stack: > msvcp71d.dll!std::operator<<<std::char_traits<char> >(std::basic_ostream<char,std::char_traits<char> > & _Ostr={...}, const char * _Val=0x00455f48) Line 711 + 0x3 C++ OninWars_d.exe!CLogger::writeLog(char * text=0x00455f48) Line 32 + 0x17 C++ OninWars_d.exe!CGameState_Menu::preRun() Line 22 C++ OninWars_d.exe!CGameManager::run() Line 106 + 0x24 C++ OninWars_d.exe!main() Line 17 C++ So, it dies on this line: streamsize _Pad = _Ostr.width() <= 0 || _Ostr.width() <= _Count ? 0 : _Ostr.width() - _Count; in ostream. Any ideas why this could be?
  7. Class Instances

    So, if I created the Blah class, and then did this in main (for example): Blah* blah; It wouldn't work because no Blah class was actually created? I could do... Blah blah; Blah* blah2 blah2 = blah; ....right?
  8. Class Instances

    This is a very newbie question, but I just don't understand the different between classes that are created/instanced like this: Blah blah; Blah* blah; What is the difference? Is Blah blah always required and then Blah* blah is a pointer to the blah class created with Blah blah? I just don't understand. Any help is appreciated :).
  9. NPC Conversation

    You pretty much answered your own question, hehe. I think a XML tree-design would work the best and it is what I did until I removed dialogue choices from my game. It would work something like this: <Dialogue> <Conversation> <Line id="1"> <Choice>Yes</Choice> <Content>Hello there, would you like to hear about rings?</Content> <Choice id="2">Yes</Choice> <Choice id="3">No</Choice> </Line> <Line id="2"> <Choice>No</Choice> <Content>So you DO want to hear about</Content> </Line> <Line id="3"> <Choice>No</Choice> <Content>Then leave me alone!!</Content> </Line> </Conversation> </Dialogue> Then you can parse that in using an XML parser..I suggest TinyXML :) Hope that helps.
  10. A Few Shader Questions

    Shader model how recent is that? Is CG hardware accelerated on ATI cards? Can you provide books for GLSL? Thanks again.
  11. I have been reading up on shaders and a few things have me a tad confused. I will go through them one by one :). 1. Can HLSL be run in OpenGL? 2. How supported is GLSL (hardware-wise)? 3. Are there any good resources (books/online tutorials/etc) for OpenGL Assembly Shaders? 4. CG is cross-platform, and not hardware embedded for generally speaking it will be slower than HLSL or GLSL, correct? 5. Do OpenGL Assembly shaders and DirectX assembly shaders share the same principles? What I mean is, if I have a book on DirectX assembly shaders, would it benefit me to read it for OpenGL shaders too? Thanks, Mike
  12. TinyXML Parsing

    Wow thanks so much Assassin, worked perfectly. Your a life saver :).
  13. TinyXML Parsing

    Hmm..I seem to be pretty stuck with this. Any other ideas? Thanks.
  14. TinyXML Parsing

    The problem still exists seems like the for loop is setup wrong. But how?
  15. TinyXML Parsing

    Whoops..I was taking out the dialogue for simplicity purposes..that isn't in the actual file..let me fix that.