Jump to content

Furbolg

Members
  • Posts

    243
  • Joined

  • Last visited

Everything posted by Furbolg

  1. I see your problem, its like you want to store int, float, double and std::string in a single std::vector. I dont have a solution right now, have you had a look at the c++ design patterns?
  2. Typedef is just a shorter form / comfort: (these example are from a dll (plugin system) and i dont put in c++ casts, they would make it harder to understand) Typedef: // define the type typedef int(__stdcall *CallBack)(void); // use it to load the method CallBack callme = (CallBack)::GetProcAddress(hDLL, "somecallback"); // call the method callme(); Without: // use it int(__stdcall *CallBack)(void) = 0; CallBack = (int(__stdcall*)(void))::GetProcAddress(hDLL, "somecallback"); // call it CallBack();
  3. Just try and post your statement in a c++ forum.... but take cover Is it a problem ? For c++ programmers (the guys who love c++ and not only use it because of speed/portability): yes For the big part of this community: probably not But you mentioned a messed up callstack, this can't be happening when used correct c++ patterns (mcp posted). // edit: It is working but the behavior is undefined, it can work on windows but dont work on *nix.
  4. If you argue this way then let me ask: whats the difference between integer and string ? In theory (assembler) you are right josh but c++ has some patterns / behavior which define some basic rules. You can't just take the ones you like and ignore the rest. // Edit: To be honest, its actually more C/C++ then C++... dont take it personal, please.
  5. Good explanation, didnt know/realized that AddHook is the real problem. Of course using void* is a bad thing, because void* can be anything. But there are exceptions for example if you know what void* represents, then it shouldnt be a problem to cast it ( beginthread etc. ):
  6. You can try the code i posted first... does OSX uses gcc ? Maybe you can update your compiler ? No it looks like a incompatibility .... c++ isnt that much standardized as i would wish (Visual C++ 6 anyone ? ).
  7. Sorry josh but this statement is wrong and (void*) is a c cast, the code above is cleaner. Passing data as void* and cast it back is valid and sometimes you dont have a choice, for example most winapi functions do it this way (beginthread, getwindowlong ...). // Edit: your example compiles fine at my solution (picture attached) // Edit2: Oh sorry.. OSX... didnt see that But (void*) is still a bad choice
  8. Try this one (not tested) void Coll(void* data) { Entity* ent = reinterpret_cast<Entity*>(data); ent->somemethod(); } this->Full->AddHook(Entity::UpdatePhysicsHook, Coll);
  9. The problem is if you write " *it->MyMethod() " (example to show the problem) then c++ will try to use " * " (asterisk) on MyMethod but you want it on " it ", so you have to write (*it) to deferencing the iterator. // Edit: to clarify you could write something like this Mycallback = &(*it)->GetMethodToCallBack();
  10. Do i smell a new Assassin's Creed ?
  11. Good tutorial aggror! Just one hint : please use c++ casts (static_cast, dynamic_cast, reinterpret_cast, const_cast) and not the old c casts.
  12. Good tutorial Aggror! Because the "move ambiguous" error ... i could bet this is because std::move. // edit: Yes ... look at "Leadwerks.h" at line 166... thats why "using namespace" is a bad idea. You can solve this problem by writing ::move in your App::Start method.
  13. Then you encountered one of the glorious VS bugs These bugs are annoying but its okay in the new versions, if you are crazy try visual studio 6 ( we are actually 11 i think)... it crashes everytime everywhere
  14. Have you tried "Clean Solution" or "Rebuild Solution" yesterday ?
  15. I've attached a screenshot how my dll configuration looks, is your similiar ? If yes then you have to change the line "$(ProjectDir)" to "$(ProjectDir)\$(Configuration)" ... i think.
  16. Visual Studio set another current dir, you have to copy your files into project folder or change the configuration but i dont remember which entry it was. // edited: sorry im tired its project folder
  17. If LoadMap could return an Entity (like in LE2) or had an second parameter with an entity list (std::vector, entity* ...) that would be really handy. I dont like these C Callbacks and try to avoid them but sometimes you dont have a choice (WinAPI MessageHandler, LoadMap etc.).
  18. Furbolg

    Solo Warrior

    Final Fantasy, anyone ?
  19. Oh you will, because class mytest { public: mytest() : someint(0), somefloat(0.0f) { calcsome(); } private: int someint; float somefloat; void calcsome() { } } int main() { mytest* test = new test(); // or mytest test2(); } is much better then somethind like int someint; float somefloat; void calcsome() { } void xyz_init(int a, float B) { someint = a; somefloat = b; calcsome(); } int main() { xyz_init(0, 0.0f); }
  20. Please dont make the mistake and equal c with c++, c++ is based on c but has some major improvement (new(constructor)/delete(destructor), templates, classes (private/public/proctected, inheritance, virtual)..... etc.) When you mastered c, c++ isnt that hard but there are differences (malloc/realloc/free vs new/delete ... dont to mention stl).
  21. Before optimizing, josh should implement all thats necessary and check if it works. You know "premature optimization is root of all evil".
  22. Wow Shadmar real nice, i wish i had your shader (GLSL/HLSL) knowledge Real amazing!
  23. Furbolg

    Launch Day

    Thank you for your listening to your community and dont abandon us (like some publisher).
  24. Whats your problem ? If you go with Esenthel and dont want to support LE its fine but then maybe you should leave instead of spreading hate.
×
×
  • Create New...