Pages: 1
Bonjour,
Voici mon code qui permet de naviguer en mode FPS dans ma Picturebox.
Quand je clique mon curseur devient libre.
Quand j'exécute la fonction reprise_mode via un bouton le curseur revinet en mode FPS par contre les touches ne réagissent plus ?
Public Sub reprise_mode() PCam.InputReceiverEnabled = True End Sub
Un idée peut-être ?
Tout le code :
Imports System Imports Irrlicht ' compiler error here? Look at the next comment Imports Irrlicht.video Imports Irrlicht.core Imports Irrlicht.scene Imports System.Xml Imports System.io Imports System.Text Imports Irrlicht.gui Module Module1 Public stop_camera As Short Public Dev As IrrlichtDevice Public PCam As ICameraSceneNode Public Panim As ISceneNodeAnimator Public Pglobalscene As ISceneManager ' The main entry point for the application. Public Sub AffectePicture(ByVal c As System.Windows.Forms.PictureBox) Dim device As New IrrlichtDevice(DriverType.DIRECT3D9, New dimension2d(c.Width, c.Height), 16, False, True, False, True, c.Handle) If device Is Nothing Then MsgBox("Device creation failed.") End If Dim Path As string = System.Windows.Forms.Application.StartupPath Dim smgr As ISceneManager = device.SceneManager Dim driver As IVideoDriver = device.VideoDriver Dim levelmesh As IAnimatedMesh = device.SceneManager.GetMesh(Path + "\magasin\magasin.x") Dim q3node As ISceneNode q3node = smgr.AddOctTreeSceneNode(levelmesh.GetMesh(0), Nothing, 0) q3node.Scale = New vector3d(0.8, 0.8, 0.8) Dim selector As ITriangleSelector q3node.Position = New vector3d(-10, -10, -10) selector = smgr.CreateOctTreeTriangleSelector(levelmesh.GetMesh(0), q3node, 200) Dim camera As ICameraSceneNode = smgr.AddCameraSceneNodeFPS(Nothing, 100, 300, 0) PCam = camera Dim anim As ISceneNodeAnimator = smgr.CreateCollisionResponseAnimator(selector, camera, New vector3d(30, 50, 30), New vector3d(0, -1, 0), New vector3d(0, 30, 0), 0) Panim = anim camera.Position = New vector3d(-100, 50, -150) camera.FarValue = 5000 camera.AddAnimator(anim) device.CursorControl.Visible = True smgr.AddSkyBoxSceneNode(driver.GetTexture(Path + "\textures\default_skyboxup.jpg"), driver.GetTexture(Path + "\textures\default_skyboxdn.jpg"), driver.GetTexture(Path + "\textures\default_skybox3.jpg"), driver.GetTexture(Path + "\textures\default_skybox1.jpg"), driver.GetTexture(Path + "\textures\default_skybox2.jpg"), driver.GetTexture(Path + "\textures\default_skybox0.jpg"), Nothing, 0) q3node.SetMaterialFlag(MaterialFlag.LIGHTING, False) While device.Run device.VideoDriver.BeginScene(True, True, New Color(0, 200, 200, 200)) device.SceneManager.DrawAll() device.GUIEnvironment.DrawAll() device.EventReceiver = New MyEventReceiver driver.EndScene() End While End Sub Public Class MyEventReceiver Implements IEventReceiver Public Function OnEvent(ByVal e As [Event]) As Boolean Implements IEventReceiver.OnEvent If e.Type = EventType.KeyInput Then '37=leftkey,38=upkey,39=rightkey,40=downkey, If e.Key = KeyCode.KEY_ESCAPE Then Return True End End If End If If e.Type = EventType.MouseInput Then If e.MouseInputType = MouseInputEvent.PressedDownLeft Then PCam.InputReceiverEnabled = False Return True End If End If Return False End Function End Class Public Sub reprise_mode() PCam.InputReceiverEnabled = True End Sub End Module
Merci de votre aide.
Dernière modification par AngeSofts (09-03-2008 17:44:50)
Hors ligne
C'est bon ne chercher plus j'ai trouver
il fau tredonner le focus a la picturebox avant d'activer la fonction l
mapicturebox.focus() reprise_mode()
Dernière modification par AngeSofts (09-03-2008 17:44:15)
Hors ligne
Pages: 1
Options | Liens officiels | Caractéristiques | Statistiques | Communauté |
---|---|---|---|---|
Corrections |
|
xhtml 1.0 css 2.1 Propulsé par FluxBB Traduit par FluxBB.fr |
882 membres 1429 sujets 11119 messages |
Dernier membre inscrit: LiseBuisson96 58 invités en ligne Aucun membre connecté RSS Feed |