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.

AppGameKit Classic Chat / Tier 2: Windowing

Author
Message
Kirkkaf13
6
Years of Service
User Offline
Joined: 9th Jul 2013
Location: Nottingham, England
Posted: 17th Apr 2019 08:45
I have not tried Tier 2 yet but it's probably the route I will go once I am more familiar with AppGameKit functions. Is it possible to handle the windowing? For example can I use QT and embed AppGameKit into it allowing for custom tooling? Or do all tools have to be independent like the visual editor?
Kirk
xtremi
User Offline
Joined: 26th Aug 2018
Location:
Posted: 24th Apr 2019 09:49 Edited at: 24th Apr 2019 10:14
Just want to bump this post. I'm using Tier2 and it would be very interesting to be able to embed AppGameKit in a QT window.

You can embed an OpenGL view in a Qt window, so I'm sure it's possible to do some tweaking and put an AppGameKit in there. I don't have time to try though...

EDIT

So I was looking in the Core.h/.cpp files of the AppGameKit tier 2 Visual Studio template projects. At some point you have the following code:


So this HWND is the window handle, and right now I'm googling a bit on this, and I guess this is what you can somehow embed in a Qt widget. Probably easier said than done. Just setting up a VS project that handles both Qt and AppGameKit dependencies sounds complicated.

Anyone got some experience on this?
blink0k
AGK Developer
Gold Codemaster
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 25th Apr 2019 22:28
I got this from one of the newsletters i think. It uses comms to communicate between AppGameKit and C#

Attachments

Login to view attachments
xtremi
User Offline
Joined: 26th Aug 2018
Location:
Posted: 26th Apr 2019 06:58
Thanks! That's pretty cool, tested it and it works, but haven't looked in detail in how it works.
But looks like its an independent AppGameKit project built to an executable, then this exe is embedded in the window of the C# application?
blink0k
AGK Developer
Gold Codemaster
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 29th Apr 2019 04:44
it is two separate executables
1. The c# app
2. The AppGameKit App

The c# app embeds the AppGameKit window in it's window and they communicate via comms.
At least that's the way i see it happening
MadBit
Valued Member
10
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 29th Apr 2019 15:01
I have no experience with qt. But I have integrated the window of AGKSharp. Before I had also integrated a wxWidget for the Agk output.
The way is the same.
Create a Qt-window.
Get the window handle (HWND) returned to you. Maybe a Qt function.
Pass this value to the AppGameKit initialization.
This only works with Windows. Not under linux and MacOS.

If you want to use the mouse and keyboard with Agk. You have to pass the input from Qt to Agk. Take a look at the Tier2 templates to see how it works. You just have to adapt them to Qt.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
xtremi
User Offline
Joined: 26th Aug 2018
Location:
Posted: 29th Apr 2019 16:31
Thanks! Good info.
I might try this
george++
12
Years of Service
User Offline
Joined: 13th May 2007
Location: Hellas
Posted: 29th Apr 2019 20:23
Quote: "Before I had also integrated a wxWidget for the Agk output."

@MadBit: Some years have been past since my last involvement with the wxWidgets. Could you please provide a snippet? (it will save me a lot of time)
MadBit
Valued Member
10
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 30th Apr 2019 09:41 Edited at: 30th Apr 2019 09:41
I first had to look in the nirvana of my hard drive where I have hidden my wxTemplates.
But now I found it. I noticed that we have already discussed this topic here.
I still upload the files.

Agk-Sample Program
wxWidgets libraries.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)

Attachments

Login to view attachments
george++
12
Years of Service
User Offline
Joined: 13th May 2007
Location: Hellas
Posted: 30th Apr 2019 12:03
Thank you MadBit, I'll give it a try.
xtremi
User Offline
Joined: 26th Aug 2018
Location:
Posted: 25th May 2019 10:34
So after a lot of fighting with Visual Studio, Qt and AppGameKit, I managed to create a Qt C++ project with all AppGameKit stuff in VS2017. I got AppGameKit running in a widget by passing a HWND window handle like @MadBit explained (thanks!).



However, I'm still a bit unsure how I should proceed to handle key and mouse input over the embedded window...
george++
12
Years of Service
User Offline
Joined: 13th May 2007
Location: Hellas
Posted: 25th May 2019 16:05 Edited at: 25th May 2019 17:26
Nice try xtremi.
I don't know much about Qt, but I would suggest you, to connect mouse events (signals?) with your handler (slots?).
xtremi
User Offline
Joined: 26th Aug 2018
Location:
Posted: 26th May 2019 10:07
I could probably have done something like that george++, but then I would have to re-implement / wrap a lot of already existing code in AGK.

So I figured it out (if anyone need this at some point):

We need a new QAbstractNativeEventFilter:



The WndProc function called from nativeEventFilter() is the AppGameKit function taking care of all key/mouse input. Its in the Core.cpp file of the AppGameKit template project.
So just make this function available for event filter.

Then in the main.cpp:




Another thing I struggled with was that my AppGameKit loop was iterating without iterating the Qt loop. So in the AGK's Core.cpp, in the main function, qApp->processEvents() need to be called AFTER App.Loop().


Login to post a reply

Server time is: 2019-08-26 08:37:13
Your offset time is: 2019-08-26 08:37:13