<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[GMan's Mods & Stuff — splitscreen irrlicht/html (url)]]></title>
	<link rel="self" href="https://gprogs.com/extern.php?action=feed&amp;tid=201&amp;type=atom" />
	<updated>2007-04-16T13:14:38Z</updated>
	<generator>PunBB</generator>
	<id>https://gprogs.com/viewtopic.php?id=201</id>
		<entry>
			<title type="html"><![CDATA[Re: splitscreen irrlicht/html (url)]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?pid=785#p785" />
			<content type="html"><![CDATA[<p>aah, that is just wonderful news gman!</p><p>i will check out your code right away!</p><p>thank&#039;s alot for the speedy, to-the-point answer as always!</p>]]></content>
			<author>
				<name><![CDATA[kimgar]]></name>
				<uri>https://gprogs.com/profile.php?id=101</uri>
			</author>
			<updated>2007-04-16T13:14:38Z</updated>
			<id>https://gprogs.com/viewtopic.php?pid=785#p785</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: splitscreen irrlicht/html (url)]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?pid=783#p783" />
			<content type="html"><![CDATA[<p>yes.&nbsp; you need to manually pass on any events to Irrlicht.&nbsp; here is the modified MaxGUI example:<br /></p><div class="codebox"><pre><code>&#039; this is an example showing how to display Irrlicht in a panel on a MaxGUI form.  i have modified it a bit
&#039; by adding an eventreceiver to the Irrlicht instance to show how MaxGUI and Irrlicht events can coexist.
&#039; it is important to note that there still is probably some issues to work out, but for now this works.
&#039;
&#039; NOTE: press the &#039;w&#039; key to toggle wireframe

Strict 
Framework Irrlicht.Core
Import brl.eventqueue

Import BRL.Basic
Import BRL.Win32MaxGUI

Local window:TGadget
Local panel:TGadget

Local windowWidth:Int = 640
Local windowHeight:Int = 380

window=CreateWindow(&quot;Irrlicht Win32 BlitzMax window example&quot;,100,100,windowWidth,windowHeight,Null,WINDOW_TITLEBAR | WINDOW_CLIENTCOORDS | WINDOW_HIDDEN)

&#039; create window To put irrlicht in
Local hIrrlichtWindow:TGadget=CreatePanel(50,80,320,220,window,PANEL_ACTIVE|PANEL_BORDER)

Local HTMLWindow:TGadget=CreateHTMLView(380,80,250,220,window)

&#039; create ok button
Local Ok:TGadget=CreateButton(&quot;OK - Close&quot;,windowWidth - 160,windowHeight - 40,150,30,window)

Local go:TGadget=CreateButton(&quot;GO URL&quot;,windowWidth - 320,windowHeight - 40,150,30,window)

&#039; this is not in the original, but is here to show you can have a textbox and enter into it
&#039; without the events posting to Irrlicht
Local tb:TGadget=CreateTextField(windowWidth - 260,windowHeight - 70,250,20,window)

&#039; create some text
CreateLabel(&quot;This is Irrlicht running inside a Win32 MaxGUI window.&quot;,20,20,400,40,window)
    
Local param:SIrrlichtCreationParameters=SIrrlichtCreationParameters.create()
param.setWindowId(QueryGadget(hIrrlichtWindow,QUERY_HWND))
param.setDriverType(EDT_OPENGL)

&#039; create the device from the params object
Local device:IrrlichtDevice= ..
    IrrlichtDevice.createFromParams(param)

&#039; the original does not have this.  this is just to show that you can mix events between MaxGUI and Irrlicht.
Type MyEventReceiver Extends IEventReceiver

    Field box:ISceneNode

    Method setBox(b:ISceneNode)
        box=b
    EndMethod

    Method OnEvent:Int(event:SEvent)

        &#039; check If user presses the key &#039;W&#039;
        If event.getEventType()=EET_KEY_INPUT_EVENT And event.getKeyPressedDown()=False
        
            Local key:Int=event.getKeyInputKey()

            Select key
                &#039; switch wire frame mode
                Case EKEY_KEY_W  
                    box.setMaterialFlag(EMF_WIREFRAME, box.getMaterial(0).getWireframe()=False)
                    Return True    
            EndSelect            
        EndIf
        
        Return False
    EndMethod

    &#039; we must override the generate function in order for instantiation to work properly
    &#039; must return IEventReceiver
    Function generate:IEventReceiver()
        Return New MyEventReceiver
    EndFunction
EndType

&#039; setup a simple 3d scene

Local smgr:ISceneManager=device.getSceneManager()
Local driver:IVideoDriver=device.getVideoDriver()

Local cam:ICameraSceneNode=smgr.addCameraSceneNode();
cam.setTarget(_VECTOR3DF(0,0,0))

Local anim:ISceneNodeAnimator=smgr.createFlyCircleAnimator(_VECTOR3DF(0,10,0),30.0)
cam.addAnimator(anim)
anim.drop()

Local cube:ISceneNode=smgr.addCubeSceneNode(25)
cube.setMaterialTexture(0,driver.getTexture(&quot;../media/rockwall.bmp&quot;))
cube.setMaterialFlag(EMF_LIGHTING,False)

smgr.addSkyBoxSceneNode( ..
    driver.getTexture(&quot;../media/irrlicht2_up.jpg&quot;), ..
    driver.getTexture(&quot;../media/irrlicht2_dn.jpg&quot;), ..
    driver.getTexture(&quot;../media/irrlicht2_lf.jpg&quot;), ..
    driver.getTexture(&quot;../media/irrlicht2_rt.jpg&quot;), ..
    driver.getTexture(&quot;../media/irrlicht2_ft.jpg&quot;), ..
    driver.getTexture(&quot;../media/irrlicht2_bk.jpg&quot;))

&#039; create the event receiver that toggles wireframe
Local receiver:IEventReceiver=IEventReceiver.create(MyEventReceiver.generate)
MyEventReceiver(receiver).setBox(cube)
device.setEventReceiver(receiver)

&#039; show And execute dialog
ShowGadget(window)

&#039; do message queue

&#039; Instead of this, you can also simply use your own message loop
&#039; using GetMessage, DispatchMessage And whatever. Calling
&#039; Device-&gt;run() will cause Irrlicht To dispatch messages internally too. 
&#039; You need Not call Device-&gt;run() If you want To do your own message 
&#039; dispatching loop, but Irrlicht will Not be able To fetch
&#039; user Input Then And you have To do it on your own using the BlitzMax
&#039; event mechanism.

While(device.run())

    driver.beginScene(True, True)
    smgr.drawAll()
    driver.endScene()

    If PeekEvent() Then 
        PollEvent()
        Select EventID()
            Case EVENT_WINDOWCLOSE
                Exit
            Case EVENT_GADGETACTION
                If EventSource()=Ok
                    PostEvent(CreateEvent(EVENT_WINDOWCLOSE,Ok))
                ElseIf EventSource()=go
                    Local url:String
                    If GadgetText(tb)&lt;&gt;&quot;&quot; Then url=GadgetText(tb) Else url=&quot;http://www.blitzmax.com&quot;
                    HtmlViewGo( HTMLWindow,url )                
                ElseIf EventSource()=tb
                    &#039;Print &quot;textbox&quot;
                Else &#039; pass it on to Irrlicht
                    &#039; you would need to determine the event and pass it on
                    Local event:SEvent=SEvent.create()
                    event.setEventType(EET_KEY_INPUT_EVENT)
                    event.setKeyInputKey(EKEY_KEY_W)
                    device.postEventFromUser(event)                
                EndIf
            Default
                &#039;PostEvent(CreateEvent(EventID()),True)
If EventID()=EVENT_KEYDOWN
    Local event:SEvent=SEvent.create()
    event.setEventType(EET_KEY_INPUT_EVENT)
    event.setKeyInputKey(EventData())
    device.postEventFromUser(event)                
EndIf
        End Select
    End If        
    
Wend

&#039; the alternative, own message dispatching loop without Device-&gt;run() would
&#039; look like this:

Rem
While True
    If PeekEvent() Then 
        PollEvent()
        Select EventID()
        Case EVENT_WINDOWCLOSE
            Exit
        Case EVENT_GADGETACTION        
            If EventSource()=Ok
                PostEvent(CreateEvent(EVENT_WINDOWCLOSE,Ok))
            End If
        End Select
    End If        
    &#039;// advance virtual time
    device.GetTimer().Tick()
    &#039;// draw engine picture
    driver.beginScene(True, True, 0)
    smgr.drawAll()
    driver.endScene()
Wend
EndRem

device.closeDevice()
device.drop()</code></pre></div>]]></content>
			<author>
				<name><![CDATA[gman]]></name>
				<uri>https://gprogs.com/profile.php?id=2</uri>
			</author>
			<updated>2007-04-16T12:04:43Z</updated>
			<id>https://gprogs.com/viewtopic.php?pid=783#p783</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[splitscreen irrlicht/html (url)]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?pid=782#p782" />
			<content type="html"><![CDATA[<p>is it possible at all, to create a splitscreen kind of application with irrlicht on one side and a webpage on the other?</p><p>i&#039;ve had a look at highGUI, maxGUI and the splitscreen example, but i must say i am a little confused.<br />time is kind of short, so before i burn too much time trying to achieve the impossible, it would be really wonderful if someone could just confirm wether this was possible or not ?</p>]]></content>
			<author>
				<name><![CDATA[kimgar]]></name>
				<uri>https://gprogs.com/profile.php?id=101</uri>
			</author>
			<updated>2007-04-16T10:38:12Z</updated>
			<id>https://gprogs.com/viewtopic.php?pid=782#p782</id>
		</entry>
</feed>
