Astornia demo
-
- Posts: 108
- Joined: Fri Aug 22, 2003 1:04 pm
- Location: Kerkrade, Netherlands
- Contact:
Astornia demo
well, its nothing big yet, but it shows what i'm working on recently, i actually just started to get a bit serious.
but plz read the readme
http://home.wanadoo.nl/batavier.kerkrad ... 050Rel.zip
well, you can find it on that location, and i hope you will like it.
and i hope to get some tips how i can improve my programming skills
but plz read the readme
http://home.wanadoo.nl/batavier.kerkrad ... 050Rel.zip
well, you can find it on that location, and i hope you will like it.
and i hope to get some tips how i can improve my programming skills
Re: Astornia demo
FleshCrawler wrote: and i hope to get some tips how i can improve my programming skills
Code: Select all
node2->setMaterialTexture( 0, driver->getTexture("data/zombie/zombie.jpg") );
if (node2 !=NULL){
LogWrite("Mesh 2 Texture Loaded...\n");
}
else
{
LogWrite("Mesh 2 Texture Loading Failed (File not found)...\n");
}
Code: Select all
ITexture* t=driver->getTexture("data/zombie/zombie.jpg");
if (t !=NULL){
LogWrite("Mesh 2 Texture Loaded...\n");
node2->setMaterialTexture( 0, t);
}
else
{
LogWrite("Mesh 2 Texture Loading Failed (File not found)...\n");
}
-
- Posts: 108
- Joined: Fri Aug 22, 2003 1:04 pm
- Location: Kerkrade, Netherlands
- Contact:
i updated the code, tnx
but on the ESC part, i tried everything, just doesnt seem to work in any way. i dont what it could be.
if i use closedevice first i get:
First-chance exception in Astornia.exe: 0xC0000005: Access Violation.
and when using drop i get:
-> --ReferenceCounter;
in IUnknown.h
i'm thinking of dropping that part of code. and just use Alt F4 instead
but on the ESC part, i tried everything, just doesnt seem to work in any way. i dont what it could be.
if i use closedevice first i get:
First-chance exception in Astornia.exe: 0xC0000005: Access Violation.
and when using drop i get:
-> --ReferenceCounter;
in IUnknown.h
i'm thinking of dropping that part of code. and just use Alt F4 instead
Hi,
You drop the device a second time here:
This does not work, sind there is only one instanc of the device.
Removing drop() in onEvent() will help.
The drop after the run()-loop will be called anyway.
You drop the device a second time here:
Code: Select all
//Drop the Irrlicht device.
device->drop();
if (device !=NULL){
LogWrite("Device Destruction Succes...\n");
}
else
{
LogWrite("Device Destruction Failed...\n");
}
//return to windows
return 0;
Removing drop() in onEvent() will help.
The drop after the run()-loop will be called anyway.
-
- Posts: 108
- Joined: Fri Aug 22, 2003 1:04 pm
- Location: Kerkrade, Netherlands
- Contact:
-
- Posts: 108
- Joined: Fri Aug 22, 2003 1:04 pm
- Location: Kerkrade, Netherlands
- Contact:
Hello, me again, maybe getting up this threat, but its about the same demo, i totally rewrote it. and now i again got a problem with the esc-key
i took the code right out of the Techdemo...
in CDemo.h
and then as following in CDemo.cpp
but when i hit it, nothing happens :S not closing, no error, nothing.
even changed return fucntion to true, 0, 1 and just nothing :S
i took the code right out of the Techdemo...
in CDemo.h
Code: Select all
class CDemo : public IEventReceiver
{
public:
...
virtual bool OnEvent(SEvent event);
private:
...
};
Code: Select all
bool CDemo::OnEvent(SEvent event)
{
if (event.EventType == EET_KEY_INPUT_EVENT &&
event.KeyInput.Key == KEY_ESCAPE &&
event.KeyInput.PressedDown == false)
{
// user wants to quit.
device->closeDevice();
}
return false;
}
even changed return fucntion to true, 0, 1 and just nothing :S
I've been absent for really long, but i'm ready to reign my terror on you once again, mwuahahahahaha
The Return doesn't matter in this case. What is important is the device->closeDevice(); This would then be caught by your game loop.
By closing the device, device->run() == false.
Code: Select all
while(device->run() && driver)
{
//do stuff
}
Crud, how do I do this again?
-
- Posts: 108
- Joined: Fri Aug 22, 2003 1:04 pm
- Location: Kerkrade, Netherlands
- Contact:
In your main.cpp you have a loop that looks like this, which is the main game loop:
When you call device->closeDevice(), that sets device->run() to return a false thus exiting from the game while loop, and calling device->drop(), and ending the program.
That is just a brief explanation. If you need a better explanation I can look through the source code of Irrlicht, and provide an explanation of what the code does exactly step by step.
Code: Select all
while( device->run() )
{
//code goes here
}
device->drop();
return 0;
That is just a brief explanation. If you need a better explanation I can look through the source code of Irrlicht, and provide an explanation of what the code does exactly step by step.
-
- Posts: 108
- Joined: Fri Aug 22, 2003 1:04 pm
- Location: Kerkrade, Netherlands
- Contact:
Yeah that would make it a lot easier to debug the code if you post the source. I am just starting to learn Game programming and the irrlicht engine, so I am too a beginer.
Also in my above post I was just explaining what device->closeDevice() does.
One more thing:
in the OnEvent code that you posted try putting this:
std::cout << "device->closeDevice() is being called" << endl;
just before the device->closeDevice(); call.
Then when you click on the ESC key check the command prompt window, which opens when you run your demo to see if that message is printed. IT might be that it isn't passing the if statement.
That way you are making sure that your program is actually calling the closeDevice() function.
P.S. make sure to include <iostream> in the CDemo class to be able to use cout.
Also in my above post I was just explaining what device->closeDevice() does.
One more thing:
in the OnEvent code that you posted try putting this:
std::cout << "device->closeDevice() is being called" << endl;
just before the device->closeDevice(); call.
Then when you click on the ESC key check the command prompt window, which opens when you run your demo to see if that message is printed. IT might be that it isn't passing the if statement.
That way you are making sure that your program is actually calling the closeDevice() function.
P.S. make sure to include <iostream> in the CDemo class to be able to use cout.
-
- Posts: 108
- Joined: Fri Aug 22, 2003 1:04 pm
- Location: Kerkrade, Netherlands
- Contact:
well,i just uploaded the source to
http://home.wanadoo.nl/batavier.kerkrad ... tornia.zip
so, i hope this makes it a lot easier
http://home.wanadoo.nl/batavier.kerkrad ... tornia.zip
so, i hope this makes it a lot easier
I've been absent for really long, but i'm ready to reign my terror on you once again, mwuahahahahaha
OK I checked your source code, and here is what I did to make the ESC key work.
IN CDemo.cpp:
CHANGE
TO
You forgot to add the CDemo object as an Event reciever for the device you created, so even though you were clicking the ESC key, the device was not getting the message.
IN CDemo.cpp:
CHANGE
Code: Select all
void CDemo::run()
{
device = createDevice(driverType,
resolutionType , 16, fullscreen);
....... More code here
}
TO
Code: Select all
void CDemo::run()
{
device = createDevice(driverType,
resolutionType , 16, fullscreen, false, this);
....... More code here
}
You forgot to add the CDemo object as an Event reciever for the device you created, so even though you were clicking the ESC key, the device was not getting the message.
Also in the OnEvent in the CDemo.cpp this doesn't work:
Because device->closeDevice() is void so it doesn't return anything. I think something like this might work:
Because is device->closeDevice() is called device->run() will return a FALSE
Code: Select all
if (device->closeDevice !=NULL){
LogWrite("Demo Successfully Exit...\n");
Code: Select all
if ( device->run() ){
LogWrite("Demo Successfully Exit...\n");