<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[GMan's Mods & Stuff — Reading two buttons at the same time.]]></title>
		<link>https://gprogs.com/viewtopic.php?id=82</link>
		<atom:link href="https://gprogs.com/extern.php?action=feed&amp;tid=82&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Reading two buttons at the same time..]]></description>
		<lastBuildDate>Tue, 01 May 2007 11:35:48 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Reading two buttons at the same time.]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=859#p859</link>
			<description><![CDATA[<p>glad i could help <img src="https://gprogs.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[null@example.com (gman)]]></author>
			<pubDate>Tue, 01 May 2007 11:35:48 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=859#p859</guid>
		</item>
		<item>
			<title><![CDATA[Re: Reading two buttons at the same time.]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=858#p858</link>
			<description><![CDATA[<p>Wow, thats great! Every things working perfectly.<br />Thank you, gman.</p>]]></description>
			<author><![CDATA[null@example.com (HondaDarrell)]]></author>
			<pubDate>Tue, 01 May 2007 03:14:55 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=858#p858</guid>
		</item>
		<item>
			<title><![CDATA[Re: Reading two buttons at the same time.]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=855#p855</link>
			<description><![CDATA[<p>greetings <img src="https://gprogs.com/img/smilies/smile.png" width="15" height="15" alt="smile" />&nbsp; im happy to say i finally took the time to round out the SmoothEventReceiver type.&nbsp; its now fully documented, includes mouse inputs, and fixes the updown/downup and count issues.&nbsp; you can download it in the addons post.&nbsp; hope it works out for you <img src="https://gprogs.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[null@example.com (gman)]]></author>
			<pubDate>Tue, 01 May 2007 02:02:16 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=855#p855</guid>
		</item>
		<item>
			<title><![CDATA[Re: Reading two buttons at the same time.]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=850#p850</link>
			<description><![CDATA[<p>this was a fun one to track down but i think i finally have it.&nbsp; essentially rendering is happening faster than the key detection so the same keypress in the loop is returning True multiple times.&nbsp; after much review of the code i just couldnt see how a call to IsKeyUpDown could happen multiple times in a row.&nbsp; by adding the keyhitcnt to the end of the State i found saw that the count was not increasing per message:<br /></p><div class="codebox"><pre><code>State = &quot;You shouldn&#039;t be reading this: &quot;+Rcv.KeyHitCnt(EKEY_SPACE)</code></pre></div><p>the count gets incremented with each key down detection so it remaining at the same # for all the draws means that the same press is being reported.&nbsp; i think i have resolved your issue by using the key hit count.&nbsp; try changing your code to:<br /></p><div class="codebox"><pre><code>Function UsrIpt()
    State = &quot;Working&quot;
    If Rcv.IsKeyUpDown( EKEY_SPACE ) And Rcv.KeyHitCnt(EKEY_SPACE,True)=1 Then ..
        State = &quot;You shouldn&#039;t be reading this: &quot;+Rcv.KeyHitCnt(EKEY_SPACE)
    Print State
End Function</code></pre></div><p>be sure to backtrack through the messages as now the &quot;you shouldnt&quot; message will only happen one time.&nbsp; by checking the keyhitcnt and passing true to clear it out and set the count to 0, means that after the first call the If will now fail causing your UpDown only once.</p>]]></description>
			<author><![CDATA[null@example.com (gman)]]></author>
			<pubDate>Mon, 30 Apr 2007 03:18:19 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=850#p850</guid>
		</item>
		<item>
			<title><![CDATA[Re: Reading two buttons at the same time.]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=848#p848</link>
			<description><![CDATA[<p>I&#039;m still having the same problem.<br />KeyUpDown updates faster when I lower the system keyboard typomatic delay.<br />It seems like the key reads UpDown untill the typomatic delay elapses.<br /></p><div class="codebox"><pre><code>Strict
Framework brl.Blitz
Import brl.StandardIO
Import irrlicht.Core
Import irrlicht.addons
Import brl.pngloader

Const ScreenW = 800, ScreenH = 600, ScreenD = 32
Global Rcv:SmoothEventReceiver = SmoothEventReceiver.createReceiver()
Global Device:IrrlichtDevice = IrrlichtDevice.Create( EDT_DIRECT3D9, _DIMENSION2DI( ScreenW, ScreenH ), ScreenD, True, False, True, Rcv )
Global State:String

While( Device.Run())
    UsrIpt()
Wend

Function UsrIpt()
    State = &quot;Working&quot;
    If Rcv.IsKeyUpDown( EKEY_SPACE ) Then State = &quot;You shouldn&#039;t be reading this&quot;
    Print State
End Function</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (HondaDarrell)]]></author>
			<pubDate>Sat, 28 Apr 2007 20:14:52 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=848#p848</guid>
		</item>
		<item>
			<title><![CDATA[Re: Reading two buttons at the same time.]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=847#p847</link>
			<description><![CDATA[<p>greetings <img src="https://gprogs.com/img/smilies/smile.png" width="15" height="15" alt="smile" />&nbsp; i put out a new addons mod that may fix your problem.&nbsp; lmk how it goes!</p>]]></description>
			<author><![CDATA[null@example.com (gman)]]></author>
			<pubDate>Sat, 28 Apr 2007 13:19:06 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=847#p847</guid>
		</item>
		<item>
			<title><![CDATA[Re: Reading two buttons at the same time.]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=844#p844</link>
			<description><![CDATA[<p>For some reason when I use &quot;IsKeyUpDown()&quot;, the key reads pressed for longer than a single frame. I need the key to read pressed then ignored by the next frame.<br />Am I using this command correctly?</p>]]></description>
			<author><![CDATA[null@example.com (HondaDarrell)]]></author>
			<pubDate>Sat, 28 Apr 2007 03:12:44 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=844#p844</guid>
		</item>
		<item>
			<title><![CDATA[Re: Reading two buttons at the same time.]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=831#p831</link>
			<description><![CDATA[<p>glad i could help <img src="https://gprogs.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[null@example.com (gman)]]></author>
			<pubDate>Mon, 23 Apr 2007 19:18:44 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=831#p831</guid>
		</item>
		<item>
			<title><![CDATA[Re: Reading two buttons at the same time.]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=830#p830</link>
			<description><![CDATA[<p>I forgot to look at the output. <img src="https://gprogs.com/img/smilies/tongue.png" width="15" height="15" alt="tongue" /><br />I was only paying attention to another expression I had added.<br />Thank you gman.</p>]]></description>
			<author><![CDATA[null@example.com (HondaDarrell)]]></author>
			<pubDate>Mon, 23 Apr 2007 19:14:59 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=830#p830</guid>
		</item>
		<item>
			<title><![CDATA[Re: Reading two buttons at the same time.]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=829#p829</link>
			<description><![CDATA[<div class="codebox"><pre><code>SuperStrict
Framework brl.Blitz
Import brl.StandardIO
Import irrlicht.Core
Import irrlicht.addons
Import brl.pngloader

Const ScreenW:Int = 800, ScreenH:Int = 600, ScreenD:Int = 32
Global Rcv:SmoothEventReceiver = SmoothEventReceiver.createReceiver()
Global device:IrrlichtDevice = IrrlichtDevice.Create( EDT_DIRECT3D9, _DIMENSION2DI( ScreenW, ScreenH ), ScreenD, False, False, False, Rcv )

While(Device.Run())
UsrIpt()
Wend

Function UsrIpt()
    If Rcv.IsKeyDown( EKEY_KEY_W ) Then Print &quot;W Key Pressed: &quot;+MilliSecs()
End Function</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (gman)]]></author>
			<pubDate>Mon, 23 Apr 2007 16:21:08 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=829#p829</guid>
		</item>
		<item>
			<title><![CDATA[Re: Reading two buttons at the same time.]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=828#p828</link>
			<description><![CDATA[<p>I&#039;m not sure how to use the smooth event receiver.<br />When I check a key press nothing is returned.</p><p>Here&#039;s an example of what I tried.<br /></p><div class="codebox"><pre><code>Strict
Framework brl.Blitz
Import brl.StandardIO
Import irrlicht.Core
Import irrlicht.addons
Import brl.pngloader

Const ScreenW = 800, ScreenH = 600, ScreenD = 32
Global Rcv:SmoothEventReceiver = SmoothEventReceiver.createReceiver()
Global device:IrrlichtDevice = IrrlichtDevice.Create( EDT_DIRECT3D9, _DIMENSION2DI( ScreenW, ScreenH ), ScreenD, True, False, True, Rcv )

While(Device.Run())
UsrIpt()
Wend

Function UsrIpt()
    If Rcv.IsKeyDown( EKEY_KEY_W ) Then Print &quot;W Key Pressed&quot;
End Function</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (HondaDarrell)]]></author>
			<pubDate>Mon, 23 Apr 2007 13:34:33 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=828#p828</guid>
		</item>
		<item>
			<title><![CDATA[Re: Reading two buttons at the same time.]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=362#p362</link>
			<description><![CDATA[]]></description>
			<author><![CDATA[null@example.com (gman)]]></author>
			<pubDate>Mon, 10 Jul 2006 14:57:32 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=362#p362</guid>
		</item>
		<item>
			<title><![CDATA[Re: Reading two buttons at the same time.]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=360#p360</link>
			<description><![CDATA[<p>I tried seting up the &quot;irraddons&quot; and blitzmax could&#039;nt build the module. It says it could&#039;nt find &quot;gg.irraddons&quot; but it is in the right place. I tried the BMK compiler and it compiled &quot;irrlicht&quot; and &quot;irrbmax&quot; but the &quot;irraddons.cpp&quot; did not compile.<br />What can I do?</p>]]></description>
			<author><![CDATA[null@example.com (HondaDirtBiker)]]></author>
			<pubDate>Thu, 06 Jul 2006 18:01:10 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=360#p360</guid>
		</item>
		<item>
			<title><![CDATA[Re: Reading two buttons at the same time.]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=355#p355</link>
			<description><![CDATA[<p>greetings HondaDirtBiker <img src="https://gprogs.com/img/smilies/smile.png" width="15" height="15" alt="smile" />&nbsp; the default input receiver in Irrlicht is a bit lacking.&nbsp; i ported a better receiver that does allow checking multiple inputs at once.&nbsp; its available in the gg.IrrAddons module in the downloads section and is called T_irrSmoothEventReceiver.&nbsp; use the methods on it to check for input similar to B3D.&nbsp; you may need to recompile it for BMAX 1.20.</p>]]></description>
			<author><![CDATA[null@example.com (gman)]]></author>
			<pubDate>Sat, 17 Jun 2006 03:25:08 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=355#p355</guid>
		</item>
		<item>
			<title><![CDATA[Reading two buttons at the same time.]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=354#p354</link>
			<description><![CDATA[<p>I need the event receiver to read two or more buttons at the same time.<br />I know I post on here alot, and everyone has been great, but i&#039;m still confused by the event receiver. The Irrlicht tutorials only demonstrate pressing one button at a time. So how could my code understand multiple input at the same time, including the GUI?<br />Thank you.<br /></p><div class="codebox"><pre><code>Global CNT:Int = 0
Global ListBox:T_irrIGUIListBox

Type MyEventReceiver Extends T_irrIEventReceiver

    Method OnEvent:Int(event:T_irrSEvent)

&#039;---------------- Input Events -----------------
        If (event.GetEventType()=EET_KEY_INPUT_EVENT and event.GetKeyPressedDown()=True)
            
            Local Key:Int=event.GetKeyInputKey()
            
            Select Key
            &#039;Thrust
                &#039;Forward
                Case EKEY_UP
&#039;                    thrust:Int = 1
                    Return True
                &#039;Retro
                Case EKEY_DOWN
&#039;                    retro:Int = 1
                    Return True
            
            &#039;Action Primary
                Case EKEY_SPACE
                    Ammo:-1
                    Return True
            
                Default
                    Return False
            EndSelect
        EndIf

&#039;----------------- GUI Events ------------------
        If (event.GetEventType()=EET_GUI_EVENT)

            Local id:Int = event.GetGUIEventCaller().GetID()
            Local GUI:T_irrIGUIEnvironment = device.GetGUIEnvironment()

            Local EvType:Int=event.GetGUIEventType()

            Select EvType
                rem
                If a scrollbar changed its scroll position, And it is &#039;our&#039;
                scrollbar (the one with id 104), Then we change the
                transparency of all gui elements. This is a very easy task:
                There is a skin Object, in which all color settings are stored.
                We simply go through all colors stored in the skin And change
                their alpha value.
                endrem

                Case EGET_SCROLL_BAR_CHANGED
                    If (id = 104)
                        Local Pos:Int = T_irrIGUIScrollBar.CreateFromHandle(event.GetGUIEventCaller().handle,False).GetPos()
                        Local I:Int

                        For I=0 To EGDC_COUNT-1
                            Local Col:T_irrSColor = GUI.GetSkin().GetColor(I)
                            Col.SetAlpha(Pos)
                            GUI.GetSkin().SetColor(I,Col)
                        Next
                    EndIf

                rem
                If a button was clicked, it could be one of &#039;our&#039;
                three buttons. If it is the first, we shut down the engine.
                If it is the second, we create a little window with some
                text on it. We also add a String To the list box To Log
                what happened. And If it is the third button, we create
                a file open dialog, And add also this as String To the list box.
                That&#039;s all for the event receiver.
                endrem

                Case EGET_BUTTON_CLICKED

                    If (id = 103)
                        device.CloseDevice()
                        Return True
                    EndIf

                    If (id = 102)
                        ListBox.AddItem(&quot;Window created&quot;)
                        CNT :+ 30
                        If (CNT &gt; 200)
                            CNT = 0
                        EndIf

                        Local Window:T_irrIGUIWindow = GUI.AddWindow( ..
                            T_irrRect_S32.CreateFromVals(100 + CNT, 100 + CNT, 300 + CNT, 200 + CNT), ..
                            False, .. &#039; modal?
                            &quot;Test window&quot;)

                        GUI.AddStaticText(&quot;Please close me&quot;, ..
                            T_irrRect_S32.CreateFromVals(35,35,140,50), ..
                            True, .. &#039; border?
                            False, .. &#039; wordwrap?
                            Window)

                        Return True
                    EndIf

                    If (id = 101)
                        ListBox.AddItem(&quot;File open&quot;);
                        GUI.AddFileOpenDialog(&quot;Please choose a file.&quot;)
                        Return True
                    EndIf
            EndSelect
        EndIf

        Return False

    EndMethod

    &#039; we must override the generate function in order for instantiation to work properly
    &#039; must return T_irrIEventReceiver
    Function Generate:T_irrIEventReceiver()
        Return T_irrIEventReceiver(New MyEventReceiver)
    EndFunction
EndType</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (HondaDirtBiker)]]></author>
			<pubDate>Fri, 16 Jun 2006 07:55:13 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=354#p354</guid>
		</item>
	</channel>
</rss>
