Board index » delphi » DirectX ?????

DirectX ?????

I know this isn't graphics related but there is a bit of DirectX discussion
here so I was hoping someone could help.

I'm trying to read what key was pressed using DirectInput.  I need to be
able to convert the return into a string or integer so I can use it for
other stuff.

Mainform.didev.GetDeviceStateKeyboard(state);

I need to know the value of State.key and put it into a string or int to do
other things with it.  The State.Key is returned as an array and I can't
figure out how to get it to a string.

I can't use GetAsyncKeyState because of the nature of what I'm trying to do,
but it worked fine using the virtual keycodes with  that.  Will the
State.Key return the DInput key codes or the numeric values? (i e DIK_ESCAPE
= 1)

Thanks for the help.

Bobby

 

Re:DirectX ?????


HI Bobby,
   You probably want to try something like
DIK8.GetDeviceState(SizeOf(DIKeyBuffer), @DIKeyBuffer);
Where DIKeyBuffer is an 256 array of Bytes.
Anyway there is an example you can use @
http://www.crazyentertainment.net/samples.php?section=directx

I hope that helps,

Dominique
http://www.DelphiGamer.com := for all you Object Pascal game development
needs;

Quote
Bobby Hodges wrote:
> I know this isn't graphics related but there is a bit of DirectX discussion
> here so I was hoping someone could help.

> I'm trying to read what key was pressed using DirectInput.  I need to be
> able to convert the return into a string or integer so I can use it for
> other stuff.

> Mainform.didev.GetDeviceStateKeyboard(state);

> I need to know the value of State.key and put it into a string or int to do
> other things with it.  The State.Key is returned as an array and I can't
> figure out how to get it to a string.

> I can't use GetAsyncKeyState because of the nature of what I'm trying to do,
> but it worked fine using the virtual keycodes with  that.  Will the
> State.Key return the DInput key codes or the numeric values? (i e DIK_ESCAPE
> = 1)

> Thanks for the help.

> Bobby

Re:DirectX ?????


Thanks,  I figured it out.  I was just attacking the thing all wrong.
Thanks for the reply.

Bobby

Quote
"Dominique Louis" <Domini...@SavageSoftware.com.au> wrote in message

news:3C1E087E.4010205@SavageSoftware.com.au...
Quote
> HI Bobby,
>    You probably want to try something like
> DIK8.GetDeviceState(SizeOf(DIKeyBuffer), @DIKeyBuffer);
> Where DIKeyBuffer is an 256 array of Bytes.
> Anyway there is an example you can use @
> http://www.crazyentertainment.net/samples.php?section=directx

> I hope that helps,

> Dominique
> http://www.DelphiGamer.com := for all you Object Pascal game development
> needs;

> Bobby Hodges wrote:

> > I know this isn't graphics related but there is a bit of DirectX
discussion
> > here so I was hoping someone could help.

> > I'm trying to read what key was pressed using DirectInput.  I need to be
> > able to convert the return into a string or integer so I can use it for
> > other stuff.

> > Mainform.didev.GetDeviceStateKeyboard(state);

> > I need to know the value of State.key and put it into a string or int to
do
> > other things with it.  The State.Key is returned as an array and I can't
> > figure out how to get it to a string.

> > I can't use GetAsyncKeyState because of the nature of what I'm trying to
do,
> > but it worked fine using the virtual keycodes with  that.  Will the
> > State.Key return the DInput key codes or the numeric values? (i e
DIK_ESCAPE
> > = 1)

> > Thanks for the help.

> > Bobby

Other Threads