Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK .NET / Keyboard Input

Author
Message
XFS Illusion
17
Years of Service
User Offline
Joined: 20th Apr 2006
Location:
Posted: 6th May 2010 04:38 Edited at: 6th May 2010 05:03
If I use an if then to read a keystate in a loop, it doesn't work at all. I'm using VB.Net. Sync is on and i've also tried using the Keystate command. I tested it with this code:


Is this a bug or do such calls need to be coded differently in .NET? I'm using the latest version of the library. I've searched these forums with others having this problem, but no solutions. I see some saying use the events on the form, but i'm not using a form. I ran this test in the default DarkGDK class. If this GDK can't take keyboard input in vb.net as it was advertised, then its pretty much useless and a waste of money.

APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 6th May 2010 17:31
The KeyState function works, but it only works if your CtlDarkGDKViewport.Embedded Property is set to False.

DarkGDK.NET uses DirectX Input which can only be handled correctly if your game window is not embedded into a parent WinForm, this way, keyboard messages are processed correctly. If you use an embedded Viewport control, these messages do not get filtered to DarkGDK.NET directly which forces us to use the main WinForm events instead.

I have tried to resolve this problem, but because of DirectX input handling within the library, this is an unfortunate side effect.

As said, set the Embedded property to false. Setting fullscreen to true will give you exclusive control over the keyboard and game control functions as required.

Paul.

XFS Illusion
17
Years of Service
User Offline
Joined: 20th Apr 2006
Location:
Posted: 6th May 2010 20:17
Can you be more specific on how to set these properties? The help file is rather vague, the actual code to do it would be helpful. I'm assuming that the darkgdk render window is actually just a control on a form, however, i see the commands but don't know how to set them nor do I see them anywhere in the options for the form.

APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 6th May 2010 21:08 Edited at: 6th May 2010 21:15
XFS, when creating a new Visual Studio Project, there should be a DarkGDKApplication template for both Visual Basic and C#.

When you create your new project, the main form window has a CtlDarkGDKViewport control which you can modify it's properties. The properties determine how your application starts up. Two of the properties of the control are Embedded, and FullScreen.

By adjusting these properties in Design mode, you can effect the behaviour of how the application starts up when you build it.

Create a new project and select the template to see what I mean.



Paul.

XFS Illusion
17
Years of Service
User Offline
Joined: 20th Apr 2006
Location:
Posted: 6th May 2010 21:54
That seems to have done it, thank you for your detailed explanation. Funny I didn't see that before, I totally ignored that window!

APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 6th May 2010 22:03
Your very welcome, glad I could help.

Paul.

XFS Illusion
17
Years of Service
User Offline
Joined: 20th Apr 2006
Location:
Posted: 12th May 2010 23:09
I have a quick question that is kind of related so I decided to post it here. Is it possible to post controls, such as a combobox within the viewport? I tried, it shows up, but then I lose my input capability because Embedded has to be set to true. It also doesn't show up in fullscreen mode. Was wondering if there was a way around this.

APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 13th May 2010 03:03
XFS Illusion,

I'm afraid there isn't when it comes to this type of situation. The reason is because the DarkGDK.NET viewport and the fullscreen mode window are essentially a completely separate display frame which is handled by DirectX. The WinForms controls and DirectX framebuffer to not work in unison even though they may occupy the same area of the screen.

infact, when you go full screen, the display you actually see is a separate window altogether from the winform in which the CtlDarkGDKViewport is embedded on.

This unfortunately is something that cannot be fixed either. If you plan to have visual controls on your 3D viewport, you may need to use GUI based code which has been done with DarkBASIC Professional and DarkGDK to obtain the same type of behaviour.

I know it's not the best solution, but if I find any details on rendering such controls in the viewport, I'll post the URLs.

Paul.

XFS Illusion
17
Years of Service
User Offline
Joined: 20th Apr 2006
Location:
Posted: 14th May 2010 04:55 Edited at: 14th May 2010 04:55
Right on, well it was worth a shot. I'll find another option.

Login to post a reply

Server time is: 2024-04-18 07:55:17
Your offset time is: 2024-04-18 07:55:17