ok, sorry if i’m annoying but be rassured that i am as much or even more annoyed than you could be.
this shit doesn’t really make sense to me when trying to include it in my code so i will describe what i understand and what i don’t plus my actual problem in hope you will can enlight me.
first of all, i have my urho3D main class that represent my project :
class projet : public Application
and within the virtual void Start(), i have the SubscribeToEvent stuff including :
SubscribeToEvent(E_UPDATE, URHO3D_HANDLER(projet, HandleUpdate));
SubscribeToEvent(E_KEYDOWN, URHO3D_HANDLER(projet, HandleKeyDown));
so no problem here.
then, i have a “Dungeon” class in separates files that use r_Rooms (for random rooms), r_Cors (for random corridors), r_Juncs (for random junctions) and Module classes to build the dungeon.
example, the first loaded module :
Dungeon::Dungeon(int MODULE_MAX, Scene* scene, ResourceCache* cache)
MODULE_COUNT = 0;
roomJuncSwitch = 0;
room_p = new r_Rooms(); //i start with a room
module_p = new Module(MODULE_COUNT, room_p->type, room_p->std_name,
room_p->exits, room_p->path, room_p->texturepath,
temp_Body = module_p->m_Body;
each module object have its Node, AnimatedModel, RigidBody and CollisionShape that i can access with the pointer module_p-> and that should be this node that is collision tested for each loaded module…
so i need to put the subscribeToEvent stuff within my class i guess but that’s where i don’t really get it.
if i want to make a fonction within my class, first i declare it as a public member :
and then, in the .cpp, i can define what the function does :
void Dungeon::testCollision(Node* whatever)
but here, i guess i should have something like this in my class.h public member :
but i also guess it won’t work if it isn’t define in the projet class so i’m not sure how to use it
and for the function :
[code]void Dungeon(?)::HandleCollisionUpdate(StringHash eventType, VariantMap& eventData)
RigidBody* body = static_cast<RigidBody*>(eventData[P_BODY].GetPtr());
i guess i have to put it in my class.cpp somehow but since it’s a function definition, can i put it in the constructor of my class ?
anyway, i kinda understand a few things but with this method i’m lost, i don’t know where to put what because i don’t need it in the main.cpp and the way the function is defined just confuse me.
you have the main.cpp, the class.h and the class.cpp. what do you write in each stuff for an event to work ?