Hi I am new to irrlicht and was using your tutorial. I finished lesson 3 but when i run the program it only shows a black screen until i press A,S,W or D and after that it only shows a totally blue screen. please help me see the cube, here is my code so far copied and pasted to be sure.
#include <Irrlicht.h>
using namespace irr;
using namespace video;
using namespace core;
using namespace gui;
using namespace scene;
#pragma comment(lib, "Irrlicht.lib")
bool keys[irr::KEY_KEY_CODES_COUNT];
class MyEventReceiver : public IEventReceiver {
public:
virtual bool OnEvent(const SEvent& event) {
if(event .EventType == irr::EET_KEY_INPUT_EVENT){
keys[event.KeyInput.Key] = event.KeyInput.PressedDown;
return false;
}
return false;
}
};
int main()
{
IrrlichtDevice *device = createDevice(EDT_OPENGL);
IVideoDriver* video = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
MyEventReceiver rv;
device->setEventReceiver(&rv);
for(int x=0; x<irr::KEY_KEY_CODES_COUNT; x++) keys[x] = false;
ISceneNode* cube = smgr->addCubeSceneNode();
cube->setPosition(vector3df(0, 0, 5));
while(device->run() && device) {
if(keys[KEY_KEY_W]) {
cube->setPosition(cube->getPosition()+vector3df(0, 0, 5));
}
if(keys[KEY_KEY_S]) {
cube->setPosition(cube->getPosition()-vector3df(0, 0, 5));
}
if(keys[KEY_KEY_A]) {
cube->setPosition(cube->getPosition()-vector3df(5, 0, 0));
}
if(keys[KEY_KEY_D]) {
cube->setPosition(cube->getPosition()+vector3df(5, 0, 0));
}
video->beginScene(true, true, video::SColor(255,0,0,255));
smgr->drawAll();
video->endScene();
}
}
THANKS