#1 

09-03-2008 15:13:37

AngeSofts
Membres
Avatar de AngeSofts
Date d'inscription:
Messages: 12
IP: 82.232.218.63
Courriel

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 + "\	extures\\default_skyboxup.jpg"), driver.GetTexture(Path + "\	extures\\default_skyboxdn.jpg"), driver.GetTexture(Path + "\	extures\\default_skybox3.jpg"), driver.GetTexture(Path + "\	extures\\default_skybox1.jpg"), driver.GetTexture(Path + "\	extures\\default_skybox2.jpg"), driver.GetTexture(Path + "\	extures\\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.


Mon blog sur VB.net et bientôt aide Irrlicht

http://dotnet-sources.spaces.live.com/default.aspx

Hors ligne


#2 

09-03-2008 16:43:34

AngeSofts
Membres
Avatar de AngeSofts
Date d'inscription:
Messages: 12
IP: 82.232.218.63
Courriel

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()


Mon blog sur VB.net et bientôt aide Irrlicht

http://dotnet-sources.spaces.live.com/default.aspx

Hors ligne


OptionsLiens officielsCaractéristiquesStatistiquesCommunauté
Préférences cookies
Corrections
irrlicht
irrklang
irredit
irrxml
Propulsé par Django
xhtml 1.0
css 2.1
884 membres
1441 sujets
11339 messages
Dernier membre inscrit: Saidov17
76 invités en ligne
membre en ligne: -
RSS Feed