-
Posts
321 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by xtreampb
-
your example in the other thread is how to fix the bug in the source code...I don't have access to the source code. Admin posted an updated source code doc saying that should work. it does compile, but it now has a runtime error with the characteristics of the pointer not being initialized.
-
per admin request here is my source code. my stone.cpp file where my issue is taking place void Coll (Entity* entity0)//, Entity* entity1, float* position, float* normal, float speed) { System::Print("Test"); } Stone::Stone() { this->Create(); } Stone::~Stone() { this->Release(); } void Stone::Create() { //load the models this->Full=Model::Load(MODEL_FOLDER + string("stone_1.mdl")); this->P1=Model::Load(MODEL_FOLDER + string("stone_1part01.mdl")); this->P2=Model::Load(MODEL_FOLDER + string("stone_1part02.mdl")); this->P3=Model::Load(MODEL_FOLDER + string("stone_1part03.mdl")); this->P4=Model::Load(MODEL_FOLDER + string("stone_1part04.mdl")); this->P5=Model::Load(MODEL_FOLDER + string("stone_1part05.mdl")); //this->Full->AddHook(<#const int hookid#>, <#void *hook#>); this->Full->AddHook(Entity::UpdatePhysicsHook, (void*)Coll); //set the phy shapes this->Full->SetShape(Shape::Load(MODEL_FOLDER + string("stone_1.phy"))); //this->P1->SetShape(Shape::Load(MODEL_FOLDER + string("stone_1part01.phy"))); //this->P2->SetShape(Shape::Load(MODEL_FOLDER + string("stone_1part02.phy"))); //this->P3->SetShape(Shape::Load(MODEL_FOLDER + string("stone_1part03.phy"))); //this->P4->SetShape(Shape::Load(MODEL_FOLDER + string("stone_1part04.phy"))); //this->P5->SetShape(Shape::Load(MODEL_FOLDER + string("stone_1part05.phy"))); //set the mass this->Full->SetMass(1); this->P1->SetMass(1); this->P2->SetMass(1); this->P3->SetMass(1); this->P4->SetMass(1); this->P5->SetMass(1); //hide the broken pieces this->P1->Hide(); this->P2->Hide(); this->P3->Hide(); this->P4->Hide(); this->P5->Hide(); } unsigned long Stone::Release() { this->Full->Release(); this->P1->Release(); this->P2->Release(); this->P3->Release(); this->P4->Release(); this->P5->Release(); return 0; } void Stone::SetPosition(Vec3 mPos) { this->Full->SetPosition(mPos); this->P1->SetPosition(mPos); this->P2->SetPosition(mPos); this->P3->SetPosition(mPos); this->P4->SetPosition(mPos); this->P5->SetPosition(mPos); } void Stone::SetRotation(Vec3 mRot) { this->Full->SetRotation(mRot); this->P1->SetRotation(mRot); this->P2->SetRotation(mRot); this->P3->SetRotation(mRot); this->P4->SetRotation(mRot); this->P5->SetRotation(mRot); } void Stone::Break()//Entity* entity0, Entity* entity1, float* position, float* normal, float speed) { this->Full->Hide(); this->P1->Show(); this->P2->Show(); this->P3->Show(); this->P4->Show(); this->P5->Show(); } my stone.h file #include "Leadwerks.h" using namespace Leadwerks; #ifndef Kings_Stone_h #define Kings_Stone_h class Stone { public: Stone(); ~Stone(); void Create();//leadwerks constructor unsigned long Release();//leadwerks deconstructor void SetPosition(Vec3); void SetRotation(Vec3); void Break(); //void __cdecl Break();//Entity* entity0, Entity* entity1, float* position, float* normal, float speed); private: //the models Model *Full; Model *P1; Model *P2; Model *P3; Model *P4; Model *P5; }; #endif and my App.cpp file #include "App.h" using namespace Leadwerks; App::App() : window(NULL), context(NULL), world(NULL), camera(NULL) {} App::~App() { delete world; delete window; } // #if defined (PLATFORM_WINDOWS) || defined (PLATFORM_MACOS) bool freelookmode=true; #else bool freelookmode=false; #endif bool App::Start() { //Create a window window = Window::Create("Kings"); //Create a context context = Context::Create(window); //Create a world world = World::Create(); //Create a camera camera = Camera::Create(); camera->Move(0,2,-5); camera->SetRotation(35,0,0); SpotLight *mLight=SpotLight::Create(); mLight->SetPosition(2,5,0); mLight->SetRange(10); mLight->SetColor(1.0, 1.0, 1.0); Stone *mStone=new Stone(); mStone->SetPosition(Vec3(0,10,0)); /*std::string mapname = System::GetProperty("map","Maps/Test.map"); Map::Load(mapname);*/ Model *ground=Model::Load("Models/CobbleBlock/Block_1.mdl"); ground->SetScale(10,.2,10); ground->SetPosition(0, -2, 0); ground->SetShape(Shape::Box()); mLight->Point(ground); //Hide the mouse cursor window->HideMouse(); //std::string mapname = System::GetProperty("map","Maps/start.map"); //Map::Load(mapname); //Move the mouse to the center of the screen window->SetMousePosition(context->GetWidth()/2,context->GetHeight()/2); return true; } bool App::Loop() { //Close the window to end the program if (window->Closed()) { return false; } //Press escape to end freelook mode if (window->KeyHit(Key::Escape)) { window->closed=true; } Time::Update(); world->Update(); world->Render(); context->Sync(false); return true; }
-
I just fallowed the updated tutorial that the admin linked to me in a chat (found here: http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/object/objectaddhook-r759) It compiles, but at run time throws the fallowing error: EXC_BAD_ACCESS(code=2, address=0x0) Anyone got any advice from here?
-
so if type casting a void pointer to a function...how do i do that. I tried static_cast, dynamic_cast and reinterpret_cast. Also the implicit casts didn't work.
-
so yea didn't work, wouldn't compile. Yes OS X uses GCC. So i did some funny things. I'm not even sure what i did but this compiles... void (*Coll)//, Entity* entity1, float* position, float* normal, float speed) { }; this->Full->AddHook(Entity::UpdatePhysicsHook, Coll); however when the add hook is hit durring runtime it throws the following error EXC_BAD_ACCESS(code=2, address=0x0) So I have this pointer of a function that isn't initialized. So now i need to initialize my Coll function some how I believe. Can some one explain to me what i have done? Per your requested admin. My code as it stands now. my cpp file #include "Stone.h" #define MODEL_FOLDER "Models/Stone/" //Collisions Function void (*Coll)//, Entity* entity1, float* position, float* normal, float speed) { }; /*void mColl() { }*/ Stone::Stone() { this->Create(); } Stone::~Stone() { this->Release(); } void Stone::Create() { //load the models this->Full=Model::Load(MODEL_FOLDER + string("stone_1.mdl")); this->P1=Model::Load(MODEL_FOLDER + string("stone_1part01.mdl")); this->P2=Model::Load(MODEL_FOLDER + string("stone_1part02.mdl")); this->P3=Model::Load(MODEL_FOLDER + string("stone_1part03.mdl")); this->P4=Model::Load(MODEL_FOLDER + string("stone_1part04.mdl")); this->P5=Model::Load(MODEL_FOLDER + string("stone_1part05.mdl")); //this->Full->AddHook(<#const int hookid#>, <#void *hook#>); this->Full->AddHook(Entity::UpdatePhysicsHook, Coll); //set the phy shapes this->Full->SetShape(Shape::Load(MODEL_FOLDER + string("stone_1.phy"))); //this->P1->SetShape(Shape::Load(MODEL_FOLDER + string("stone_1part01.phy"))); //this->P2->SetShape(Shape::Load(MODEL_FOLDER + string("stone_1part02.phy"))); //this->P3->SetShape(Shape::Load(MODEL_FOLDER + string("stone_1part03.phy"))); //this->P4->SetShape(Shape::Load(MODEL_FOLDER + string("stone_1part04.phy"))); //this->P5->SetShape(Shape::Load(MODEL_FOLDER + string("stone_1part05.phy"))); //set the mass this->Full->SetMass(1); this->P1->SetMass(1); this->P2->SetMass(1); this->P3->SetMass(1); this->P4->SetMass(1); this->P5->SetMass(1); //hide the broken pieces this->P1->Hide(); this->P2->Hide(); this->P3->Hide(); this->P4->Hide(); this->P5->Hide(); } unsigned long Stone::Release() { this->Full->Release(); this->P1->Release(); this->P2->Release(); this->P3->Release(); this->P4->Release(); this->P5->Release(); return 0; } void Stone::SetPosition(Vec3 mPos) { this->Full->SetPosition(mPos); this->P1->SetPosition(mPos); this->P2->SetPosition(mPos); this->P3->SetPosition(mPos); this->P4->SetPosition(mPos); this->P5->SetPosition(mPos); } void Stone::SetRotation(Vec3 mRot) { this->Full->SetRotation(mRot); this->P1->SetRotation(mRot); this->P2->SetRotation(mRot); this->P3->SetRotation(mRot); this->P4->SetRotation(mRot); this->P5->SetRotation(mRot); } void Stone::Break()//Entity* entity0, Entity* entity1, float* position, float* normal, float speed) { this->Full->Hide(); this->P1->Show(); this->P2->Show(); this->P3->Show(); this->P4->Show(); this->P5->Show(); } my .h code #include "Leadwerks.h" using namespace Leadwerks; #ifndef Kings_Stone_h #define Kings_Stone_h class Stone { public: Stone(); ~Stone(); void Create();//leadwerks constructor unsigned long Release();//leadwerks deconstructor void SetPosition(Vec3); void SetRotation(Vec3); void Break(); //void __cdecl Break();//Entity* entity0, Entity* entity1, float* position, float* normal, float speed); private: //the models Model *Full; Model *P1; Model *P2; Model *P3; Model *P4; Model *P5; }; #endif
-
so is this an OSX bug that josh needs to fix and i need to wait on or what? Also i have seen a bunch of different things (maybe it is all the same but i can't tell). What should I do? can anyone post a working work around with my code until the bug is fixed please. Lastly do i need to report this as a bug in the bug reporting section?
-
this is what i got in my CPP file void Coll(Entity* entity0)//, Entity* entity1, float* position, float* normal, float speed) { } this->Full->AddHook(Entity::UpdatePhysicsHook, Coll); i switched to the update physics hook to emulate what is in the linked thread and still getting the fallowing error "cannot initialize a paramater of type 'void *' with an lvalue of type 'void (Leadwerks::Entity *)'
-
yes i have removed the prototype completely
-
ok so i removed the prototype from my header and added it to the top of my CPP file. Still getting an error. I'm using OSX if that makes a difference.
-
what am i doing wrong?
-
yes that is correct as well as Full.
-
hey all i'm trying to add a collisions hook. Can someone help me with what i'm doing wrong //.h file void Break(Entity* entity0, Entity* entity1, float* position, float* normal, float speed); //CPP file this->Full->AddHook(Entity::CollisionHook, *Break)//my entity and adding the hook to my entity void Stone::Break(Entity* entity0, Entity* entity1, float* position, float* normal, float speed) { this->Full->Hide(); //blah blah blah } thank you for your help, ~Xtreampb~
-
Silly me. Went and double checked the document reference. CPP file needs to be this->ModelName=Model::Load("myPath");
-
Hey all, I like to do all my games in pure C++. With that said i seam to be having an issue with create my own object. My object is basically 6 models. In my header file, if I create them with as a pointer then use the load, if i try to do anything else with them such as Hide() it throws a bad access error, as if it was never stored in memory, or the mem address was lost. If i create them as a normal var, no issues. No issues that is until i try to terminate the problem. then it frees my object then tries to free it a second time, of course crashing the program saying that it tried to free an unallocated memory address. Anyone got any suggestions Thank you, Xtreampb
-
YouGrove, my demo, Castle Defense, everything is created at run time. the wall is created and everytime a sone is thrown, the stone and all the smaller borken pieces are created on the spot. It only starts to slow down b/c i don't clean up all the broken pieces laying on the ground.
-
So i have a concern about the paying for updates. What if i don't want what was released in lets say 3.2 but i want what is included in 3.3 Will i have to buy both 3.2 and 3.3 or would i be able to just buy 3.3 upgrade. I think people would be more welcome and accepting to that since you have decided to charge for the addition of features.
-
what is a literal i can use for this var?
-
nope my PC is running constantly and has been on for a while. an appspeed is a positive value as stated in my original post. @cassius it throws the error in debug, and release configurations
-
community optimized code. awesomeness. @canardian can you post a quick example of what you mean by moving loop vars closer to loop to use registers.
-
ok so would it be best to have a separate function (apart from the mObj::~mObj() function) that will delete the itself. when i want the object to removed because i'm done with it, I call this function. a separate question. After i'm done processing this object with outside object and functions. Can i remove it from my vector and have it manage itself. more specifically. once it collides, it shows a destroyed model. at this point i want to remove it from my vector and the object starts a timer. when the timer hits 5 secs it deletes itself. am i making sense, and if so, is this praticale?
-
so i'm coding doing my thing. squashing bugs as can you probably see when all of a sudden i get this error... Unhandled exception at 0x00a5eb16 in Castle Defense-Debug.exe: 0xC0000005: Access violation reading location 0x061e4e58. what makes this hard is that this breaks in the engine.cpp file at this function void UpdateWorld(float stepsize) { leUpdateWorld(stepsize); } i trace the stack to this function call UpdateWorld(AppSpeed()) ; i have made no changes anywhere near this line of code. So why is it all of a sudden complaining. the stepsize that i have when i break is approx 1.1752819 +/- 0.03 Suggestions greatly appriciated ~Xtreampb~
-
so sort of like a built in memory management/garbage collector. My current question is that i continously loop through the above code. when i'm done looping through do i need to do anything with this pointer. It is stored in the vector so my logic is to remove this pointer b/c i'm not using it. but like i said when i remove the pointer i call "delete _Block;" it removes the reference from my vector. So am i correct in saying when i delete a pointer in one place, it also deletes that pointer in another.
-
Confusion, can someone please better explain what this DLL does, and is it for C++ use of the engine?
-
Ok so i'm trying to preform some memory management by deleting pointers to my object that have already been stored in arrays. so like the code below cBlock *_Block=new cBlock(true); _Block->SetPosition(_Pos); SetEntityCallback(_Block->GetFullModel(), (byte*)Coll, ENTITYCALLBACK_COLLISION); CobbleVec.push_back(*_Block); ObjVec.push_back(_Block);//must push back all blocks //delete _Block; i had to remove the delete _Block; line because i believe it is removing all the data completely (based on tests I've been running). I feel as though if I don't delete _Block it will result in a memory leak. As you can see i'm placing this in 2 different vectors. My question is how do I delete this pointer with out removing all references to my object. Is there like a copy command I don't know about? Thanks ~Xtreampb~
-
i know it has something to do with my collisions. When my object collides it is destroyed. What i think is happening is it is colliding a second time and it hasn't been destroyed from the first collision. so it tries to destroy it the second time but there is nothing to destroy.