lagging pointer in game

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
me_go_fast
Posts: 8
Joined: Fri Jul 23, 2004 2:45 am
Location: Untied States

lagging pointer in game

Post by me_go_fast »

I am using the mouse pointer location and am loading an image for the target. All of it works but the target it laggy and choppy when you are walking and looking around. Here is the code i am using:

while(SPDevice->run() && Sdriver)
{
Sdriver->beginScene(true, true, video::SColor(0,100,100,100));
smgr->drawAll();
env->drawAll();
core::position2d<s32> m = SPDevice->getCursorControl()->getPosition();
Sdriver->draw2DImage(texture, core::position2d<s32>(m.X - 12,m.Y - 12), rect<s32>(0,0,25,25), 0, video::SColor(255,255,255,255), true);
Sdriver->endScene();
}


if anyone has a solution to this problm please let me know. thanks
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

I might be able to help if I could simulate what your trying to do...

I would need to see more of the code you can PM it to me if you like if you don't wish to post it here.

I have a few ideas of what it could be but I'm honestly not even sure what your talking about I would need to see it for myself.
me_go_fast
Posts: 8
Joined: Fri Jul 23, 2004 2:45 am
Location: Untied States

Post by me_go_fast »

Here is all the code:



irr::IrrlichtDevice* device = createDevice(video::EDT_DIRECTX8,
core::dimension2d<s32>(800,600), 32, true, true, &receiver);
video::IVideoDriver* Sdriver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* env = device->getGUIEnvironment();
video::ITexture* texture = Sdriver->getTexture("Cursor.bmp");
Sdriver->makeColorKeyTexture(texture, core::position2d<s32>(0,0));
scene::IAnimatedMesh* mapMesh = smgr->getMesh("Landscaped.3ds");
scene::ISceneNode* mapNode = 0;
if (mapMesh)
mapNode = smgr->addOctTreeSceneNode(mapMesh->getMesh(0));

if (mapNode)
{
mapNode->setPosition(core::vector3df(-2500,0,0));
}
scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS(0,
100.0f, 300.0f, -1, keyMap, 8);
camera->setPosition(core::vector3df(0,500,0));
device->getCursorControl()->setVisible(false);
while(SPDevice->run() && Sdriver)
{
Sdriver->beginScene(true, true, video::SColor(0,100,100,100));
smgr->drawAll();
env->drawAll();
core::position2d<s32> m = device->getCursorControl()->getPosition();
Sdriver->draw2DImage(texture, core::position2d<s32>(m.X - 12,m.Y - 12),
rect<s32>(0,0,25,25), 0, video::SColor(255,255,255,255), true);
Sdriver->endScene();
}


Thats it. All you need to do is make a key map or just delete that part in the creation of the camera scene node.
me_go_fast
Posts: 8
Joined: Fri Jul 23, 2004 2:45 am
Location: Untied States

Post by me_go_fast »

sorry, the smiley face is suposed to be an eight.
Post Reply