Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

128 Neutral

About ekrax

  • Rank
  1. ekrax

    What does your username mean?

    back in the day when i was like 13 i thought i was a hacker/cracker cuz i knew how to use ping and tracert from a dos prompt haha ... the krax part ... anyways it sounds neat so i stuck with it. id use my real name but im paranoid of wierd internet stalkers :p [edit] noooooooooo, seems that my alias has been taken by others [/edit]
  2. Quote: int array[50] = {0,}; o_O i did not know your "did you know" ... did you know if you have a STL container of objects which call these functions ... glRasterPos2d(x, y) before ... glColor4f(r, g, b, a) ... you'll be left to hours of painful debugging?
  3. ekrax

    Good Homebrew

    this is DC stuff, lot's of emulation info (emulators for the DC) but other lots of other stuff also. Clicky
  4. if your looking for raytracing code i suggest going to its a very very nice open source raytracer. ive never actually looked into the source as i doubt my programming skills are sufficient enough for it. anyways i suggst you check it out.
  5. ekrax

    SDL_SetColorKey ...

    Ah got it working, i declared sprite_file as an fstream and not ifstream and somehow wierd data got written to that file (somehow still worked without color key though).
  6. ekrax

    SDL_SetColorKey ...

    i tried using color key before pushing it into the container and it still didnt work (didnt have to use frames as index either) ... also the files do load properly, obiovusly just with a bright pink background around them. image is declared as SDL_Surface * and is part of the XFrame struct (i also un-nested this class, but still didnt work). also it seems i can apply the color key to the entire screen .. which isnt much use, but anything else and it crashes.
  7. hey i decided id give linux a try (mandrake linux 10.1) and have downlowded the iso's from their site, i was just reading the documentation and it seems that when partioning there's a good chance that the current partion (winXP in my case) will be damaged. well thats what they make it out to be, they say like 20 times back everything up becasue partioning often doesnt work right ... run scandisk and defrag is safemode and all these other percutions ... from anyone who has a partioned system with windows and linux/unix did partioning your drive currupt anything? does this happen rarley but they just enforce heavy percussions to avoid angry mail? whats the deal with this?
  8. hello, ive decied to give SDL a try after using opengl for a bit, and wow it's much easier (for 2d of course) but why does SDL_SetColorKey crash my program! CSprite::CSprite(string sprite_fname) { frames = 0; current = 0; timer = 0; oldx = 0; fstream sprite_file(sprite_fname.c_str()); while (!sprite_file.eof()) { string image_fname; int pause; sprite_file >> image_fname; sprite_file >> pause; anim_v.push_back(XFrame(SDL_LoadBMP(image_fname.c_str()), pause)); SDL_SetColorKey ( anim_v[frames].image, SDL_SRCCOLORKEY, SDL_MapRGB(anim_v[frames].image->format, 255, 0, 255) ); frames++; } } if i comment out SDL_SetColorKey part it works perfectly fine ... i try to make temp copies and try to apply SetColorKey to that then push_back the anim vector, but no matter what it crashes the program. im new to sdl so im probably missing something trivial. thanks for any help in advance.
  9. [EDIT] ok using d1, and d2 as types was a typo, also i made a typo in that the actual lists of derived types are lists of CBase pointers. so that's why i cloned the objects and deleted the old objects. however the program still crashes, most likely becasue i'm not casting. so this doesn't work without casts? std::list<CObject*> base_l; std::list<CDerived*> derived_l; std::list<CObject*>::iterator i; then in the loop: if (typeid(**i) == typeid(CDerived)) { derived_l.push_back((*i)->clone()); delete *i; } [EDIT again] well i just figured out it was becasue i was deleteing part of the list while i was still running thorugh it, so i had to save the old refrences into a garbage list and delete it after ... thats a quick fix as i shoudnt need to do that. [EDIT ...] and i dont all i had to do was push back the same refrence and clear the main list before, but i guess this is still inefficient and i should be using the stl sort. correct me if im wrong but is the prototype sort(iterator, iterator, functionPointer) ? [Edited by - ekrax on November 19, 2004 4:23:31 PM]
  10. hello. im having trouble doing the above, mostly becasue im unfamiliar with the syntax, however there might be another way that i am unaware of. basically i have a list of CObject pointers and this list needs to be sorted by object type each render to insure that the game objects are rendered in the correct order. can i use the standar sort alogorithm for this? im not sure. so i attemped to make my own sort function. just got stuck when i coudnt get the typeid working correctly becasue i coudnt figure out how to derefrence the iterator properly. this is the just of it ... std::list < CBase * > b; // ... and in the sort function: std::list < CDerivedType1 > d1; std::list < CDericedType2 > d2; for (std::list<CBase*>::iterator i=b.begin(); i!=b.end(); b++) { if (typeid(*i) == typeid(d1)) { d1.push_back(*i->clone()); delete *i } if (typeid(*i) == typeid(d2)) { d2.push_back(*i->clone()); delete *i } } d1.merge(d2); b.clear(); b = d1; the typeid part isnt working, and i suspect its becasue im not derefrencing the iterator properly. how should this be accomplished? can i use the stl standart sort with this type of sorting? thanks for any help in advance.
  11. use inclusion guards in your headers. (file1.h) #ifndef FILE1_H #define FILE1_H // ... // ... stuff #endif (eof) (file2.h) #ifndef FILE2_H #ifndef FILE2_H // ... // ... blah blah #endif (eof) (file3.h) #ifndef FILE3_H #ifndef FILE3_H #include "file1.h" #include "file2.h" // ... // ... more stuff #endif (eof) (file1.cpp) #include "file1.h" // ... (eof) (file2.cpp) #include "file2.h" // ... (eof) (file3.cpp) #include "file3.h" // ... (eof) by using the #ifndef, #define, and #endif ... in your headers you can insure that each header is only includes once in your project, but also you can declare that header as many times in any source file. hope this helps.
  12. i would have my 'map' class worry about collisions, and pass my sprite data to it, instead of vice versa. struct Sprite { int x; int y; int width; int height; // whatever holds your image }; class CMap { private: int *tiles; bool *blocks; int width; int height; // ... public: bool bCollision(const CSprite *); // ... }; bool CMap::bCollision(const CSprite *spr) { // do tests // return true or false } during the actual game loop maybe something like this ... for (int n = 0; n < numberOfSprites; n++) { if (mapInstance.bCollision(&sprite[n])) { // do something } } i would just make sure you dont have multiple copies of large amounts of data, ie if you want to pass the map data to the sprite i would pass it via const pointer so you do not create an additional copy of that data and so you cant modify it.
  13. ekrax

    A* obj = new B (basic OOP question)

    i would call it a base class pointer (of type A).
  14. ekrax

    wierd color problem.

    *IMPORTANT* wow, after destroying a lot of code and rebuilding i still encountered the same problem. however, take a look at this code. if (text.c_str() == NULL) return; glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE); glRasterPos2d(x, y); glColor4f([0],[1],[2],[3]); glPushAttrib(GL_LIST_BIT); glListBase(*glFont - 32); glCallLists(text.size(), GL_UNSIGNED_BYTE, text.c_str()); glPopAttrib(); glDisable(GL_BLEND); what is wrong? well glRasterPos2d is called before glColor4f ... why does this matter ... who knows but if glColor4f is called before glRasterPos2d everything works perfectly fine. anyone know about this problem? why it happens?
  15. ekrax

    wierd color problem.

    well it seems mine is much more messed up, i actually got it to not display any text at all by creating different colored objects in this order ... red white green white blue the text that was the first white does not show up, everything else is white, except the text that is supposed to be blue is green. the only pattern that exsits is that the colors that show up are ones that i give, the colors arent randomly appearing, but randomly assosiating themselves with the wrong objects. i think ill take another crack at this tomorrow by revamping all the code related to this, if i fix it i'll post the changes.
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!