Historique des modifications - Message

Message #493

Sujet: [C#-VS 2005] Déplacement d'objets ?


Type Date Auteur Contenu
Création du message 04-11-2006 10:26:22 N10
En observant de plus près l'example 4 en C# j'ai pu remanier mon code mais je n'arrive pas à comprendre pourquoi les touches que j'ai assignées ne fonctionnes pas voici l'éssentiel de mon code :

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Irrlicht;
using Irrlicht.Video;
using Irrlicht.Core;
using Irrlicht.Scene;
using Irrlicht.GUI;
using Irrlicht.IO;

namespace _d_real
{
class Program
{
ICameraSceneNode node = null;
IrrlichtDevice device = null;
/// <summary>
/// Point d'entrée principal de l'application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
Program prog = new Program();
prog.run();
}
public bool OnEvent(Event p_e)
{
if (node != null && p_e.Type == EventType.KeyInput && !p_e.KeyPressedDown)
{
switch (p_e.Key)
{
case KeyCode.KEY_ESCAPE:
device.CloseDevice();
break;
case KeyCode.KEY_KEY_Z:
case KeyCode.KEY_KEY_S:
{
Vector3D v = node.Position;
v.Z += p_e.Key == KeyCode.KEY_KEY_Z ? 10.0f : 0.0f;
node.Position = v;
}
return true;
}
}
return false;
}
public void run()
{
// start up the engine
IrrlichtDevice device = new IrrlichtDevice(Irrlicht.Video.DriverType.OPENGL,new Dimension2D(1024, 768), 32, false, true, true);
device.WindowCaption = "Moteur-irrlicht";


//scene et driver en place
ISceneManager smgr = device.SceneManager;
IVideoDriver driver = device.VideoDriver;

//load map
IAnimatedMesh levelmesh = smgr.GetMesh("map street/01.dmf");

//envoi collision type OctTree
ISceneNode levelnode = null;
if (levelmesh != null)
levelnode = smgr.AddOctTreeSceneNode(levelmesh.GetMesh(0), null, 0);

ITriangleSelector selector = null;
if (levelnode != null)
{
levelnode.Position = new Vector3D(0, 0, 0);
selector = smgr.CreateOctTreeTriangleSelector(levelmesh.GetMesh(0), levelnode, 128);
}

//camera
node = smgr.AddCameraSceneNode(null, new Vector3D(-3000, 400, -10), new Vector3D(), -1);


//reponse de collision
ISceneNodeAnimator anim = smgr.CreateCollisionResponseAnimator(selector, node, new Vector3D(10, 150, 10),
new Vector3D(0, -1, 0), new Vector3D(0, 50, 0), 0);
node.AddAnimator(anim);

int fps = 0;

while (device.Run())
{
if (device.WindowActive)
{
device.VideoDriver.BeginScene(true, true, new Color(100, 100, 100, 100));

device.SceneManager.DrawAll();

device.VideoDriver.EndScene();


// display frames per second value
if (fps != device.VideoDriver.FPS)
{
fps = device.VideoDriver.FPS;
device.WindowCaption =
"Moteur - irrlicht [" +
device.VideoDriver.Name + "] fps:" + fps;
}
}

}
}
}
}



Si quelqu'un peut m'aider à comprendre pourquoi même ma touche "escape" ne ferme pas mon programme smile

Retour

Options Liens officiels Caractéristiques Statistiques Communauté
Préférences cookies
Corrections
irrlicht
irrklang
irredit
irrxml
Propulsé par Django
xhtml 1.0
css 2.1
884 membres
1440 sujets
11337 messages
Dernier membre inscrit: Saidov17
113 invités en ligne
membre en ligne: -
RSS Feed