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 / [STICKY] AgkSharp for Windows - General Questions And Feedback

Author
Message
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 29th Oct 2018 18:24
To update an existing project you only need to copy the dll's.

You may need to reload the project in the ide.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 30th Oct 2018 14:44 Edited at: 30th Oct 2018 14:49
Copied the DLLs as shown in the image attached but no difference seems to be. I tried executing the getrawkeystate with the left shift key (since is the new key added) and it didn't worked. I copied the dlls with VS closed.

Should I copy Core?

Thank you!

EDIT: m_panel.Focus() is missing from Core. Should I add it? I have the same problem with the keys not working. (The other ones, not just the one mentioned earlier).
www.alexmatei.com

Attachments

Login to view attachments
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 30th Oct 2018 18:05
Do ALL keys not work? Or only those that have been added since the last AppGameKit update.
I forgot to add the new keycodes.

Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 30th Oct 2018 19:53 Edited at: 30th Oct 2018 19:53
All key don't work (checked now, again).

Maybe because that the panel doesn't focus when clicked if you remember the old fix you've made a week ago or so.
www.alexmatei.com
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 30th Oct 2018 20:21
I'll take a closer look tomorrow.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 30th Oct 2018 20:38
Sure!

Thank you very much!
www.alexmatei.com
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 31st Oct 2018 11:39
That's weird. I assumed I already integrated the fix in the template.

Ok, mouse and keyboard events are only sent to Agk when the panel also gets the focus. Therefore, as you already noticed, it is necessary to give the focus to the panel. In order to change the focus on the panel, we need an OnClick method to do this. Because it doesn't happen automatically on the panel like it does on a button.
Here's the modified code from Core.cs. The new keyboard codes are already in here. But not for the enumerator functions. They will only be available after the next update.
That means.
Agk.GetRawKeyPressed(257) works
Agk.GetRawLastKey() works
but
Agk.GetRawKeyPressed(EKey.SHIFTL) does not work yet
Agk.GetRawLastKeyEnum() does not work yet

With these changes you need two more assemblies. (WindowsBase and PresentationCore)
Right-click 'References' -> Add References
Folder 'Assemblies' - search and mark the required assemblies.

Core.cs

Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 1st Nov 2018 16:37
I tested out and the left shift now works as well as the panel focus. Good job! But key(17) (control) does not work, maybe some others may not work and the an interesting thing with arrowkeys. I have arrowkeys added in my project and instead of making contact in AppGameKit, makes contact with windows forms by hovering some buttons in my interface.
www.alexmatei.com
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 2nd Nov 2018 05:14
Keyboard codes 16, 17 and 18 (Shift, ctrl and alt) are now divided into left and right. Now you have to take the higher values. 257 - 262. See here.

That with the arrow keys is different. For these reasons I didn't loop through the keyboard input. Because in a Windows Form project the input is usually edited by the Form object.

If you want to work with the arrow keys you have to overwrite the method ProcessCmdKey from the Form object.

I can give you a codeSnippet later. I'm on my way to work now.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 2nd Nov 2018 09:54
Alright!

So the next updates procedure will be the DLL's and Core.cs?
www.alexmatei.com
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 2nd Nov 2018 14:06
This is bigger. I have to take a closer look. For now you can work with this method.

Copy in the application class (AgkFormTemplate).
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 3rd Nov 2018 08:18 Edited at: 3rd Nov 2018 08:29
So I think I've found an acceptable solution. Is that OK?

AgkFormTemplate.cs


EDIT:
The KeyCodes 16, 17 and 18 do not work.
use instead

16 => 257 (left) 258 (right) Shift
17 => 259 (left) 260 (right) Ctrl
18 => 261 (left) 262 (right) Alt

when I fix it. There will be an update of the DLL.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
AFA
7
Years of Service
User Offline
Joined: 29th May 2012
Location: Germany
Posted: 3rd Nov 2018 10:27
First of all I want to say how happy I am to see that you have built something this awesome.

Thanks to the step by step tutorial (Visual Studio) and the templates it really was easy to follow the steps and see how everything works. And this for somebody like me having no prior-experience with Visual Studio.

After diving into it I see great potential for this and hope that agk will officially support this.

Personally the biggest advantage of agk is the combination of simple coding without having any trouble no matter which platform it is for. Locking at Tier 2 we lose this advantage but gain processing speed, right?

So, I would like to have C sharp as a kind of "Tier 1 B" with multiple platform ablitity !
Is this technically possible for agk ?

Because somewhere agk said, OOP combined with multiple platform ability would not be possible. Where I have to say I'm not sure if and how extensive the OOP-functionality C sharp will be needed.


If I may dream once, we could have a
Tier 1 - family with our agk-basic but also C#, Python or Kotlin generating bytecode and running with the interpreter solution and a
Tier 2 - family with C++

The Tier 1 - family would then be a big competitor of Xamarin (what I do not like at all).
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 4th Nov 2018 05:19
@AFA
Thank you AFA.

AFA wrote: "Personally the biggest advantage of agk is the combination of simple coding without having any trouble no matter which platform it is for. Locking at Tier 2 we lose this advantage but gain processing speed, right?"

This is right. With c++ you can also develop for all other platforms. Templates and tutorials already exist, but the effort is much higher than in Tier 1.

AFA wrote: "Because somewhere agk said, OOP combined with multiple platform ability would not be possible. Where I have to say I'm not sure if and how extensive the OOP-functionality C sharp will be needed."

C-Sharp exists on Windows, Linux and MacOS. With Xamarin also for mobile platforms. I think that OOP (C#) is possible for multiple platforms.

@MateiSoft
After I have browsed in the Tier2 code. I came to the result that the DLL doesn't have to be updated to solve the input problem.

Here are the new Core.cs and AgkFormTemplate.cs so the keyboard input should work as expected.

AgkFormTemplate.cs


Core.cs
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 4th Nov 2018 10:46
Madbit, so glad to see a new fix! I'll come back to you, a second after I test your fix out! Can't wait!
www.alexmatei.com
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 11th Nov 2018 07:14
Hi,
I just updated AgkSharp (Templates + Binaries) to the current AppGameKit 2018.11.08 version.
Thanks again to MateiSoft for his persistent testing.

Download here.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 11th Nov 2018 11:11
And thank you for making such an awesome job!

Sorry for not responding regarding the fix. I couldn't pasted in. I was captured with the development of my project. The update is a must, so I will upgrade and come back.
www.alexmatei.com
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 11th Nov 2018 12:34
Upgrade just the binaries, right?
www.alexmatei.com
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 11th Nov 2018 12:47
For you, yes. Would be enough but I made some small changes to Core.cs. You might be able to update that as well. But it's not absolutely necessary.
All others who don't have the method ProcessCmdKey in AgkFormTemplate.cs should add it.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 11th Nov 2018 16:45
Ok, so I copied the x64 DLLs to my project and the Core.cs.

The new commands are not present and still the problem with arrowkeys persists. Maybe this time I am doing something wrong. Copied the DLLs where they where initially (near the final executables) and Core.cs near the solution file.
www.alexmatei.com
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 11th Nov 2018 20:22
Uhhm,
so sooooooorry!

I have only added the orders of Preben. I missed the others. Will be submitted as soon as possible.

But the keyboard commands work like in AGK-Tier1. Note this - when the last input is retrieved (GetRawLastKey), it always returns 16, 17 and 18 for the left and right side of the modification keys (Shift, Ctrl, Alt). You always only have the chance to differentiate between left and right in the direct query of the keys (GetRawKeyState). But this is also the case in Agk-Tier1.I wanted to stick to it as it is in Agk-Basic.

And remember. Before Agk can receive the inputs, the panel must first get the focus (click on it).
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 11th Nov 2018 21:37
So, I updated the Windows templates and binaries. Linux comes later.
I hope it works so far.

You can now download the new version.

Please report all bugs and other problems.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 12th Nov 2018 10:08
The new commands are present. I will test out the keys also and come back in a couple of hours.
www.alexmatei.com
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 12th Nov 2018 11:50
Question: Did you added errors when something goes wrong, like in AppGameKit Basic to literraly say the problem?
www.alexmatei.com
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 12th Nov 2018 12:21
The panel does not focus when clicked.

m_panel.focus if it was necessary in Core.cs, does not exist.

I tested out the arrowkeys and the other keys. The other keys don't work and the arrowkeys selects the buttons from the interface.
www.alexmatei.com
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 12th Nov 2018 13:42
Okay. That's what happens when I work with 5 systems (2 of them Linux) without git. If you still have the last version. So the first of the 2018-11-11 version. use the Core.cs from there.
When I'm at home I'll fix it again. (how embarrassing)

Oh, the general error message should also be integrated. Just like in Tier1.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 12th Nov 2018 16:56
Ok - It is done. You can download it again.

For testing maybe this



I hope it works satisfactorily now.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 12th Nov 2018 18:46
On the website the date is 11November. Is it updated though?
www.alexmatei.com
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 12th Nov 2018 20:05
I was too lazy to change that. I hope that doesn't bother.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 12th Nov 2018 20:39
Not at all. I thought it automatically updates and I wasn't sure it was updated.

The other keys now work without a problem even with the basic code like "agk.getrawkeypressed())" But the arrow keys are still not working. Still the interface is selecting itself (the buttons and other gadgets).
One thing that I noticed regarding Agk.Message, is that it multiplies itself when it appears, until the application crashes.
www.alexmatei.com
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 12th Nov 2018 21:11
Have you a Sample Code for me?
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 12th Nov 2018 21:15
I'll make one.
www.alexmatei.com
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 12th Nov 2018 21:57
Tried with a fresh project from your website and the "getrawkeypressed(38) == 1" works, for example. The command was placed on top of loop and sync command.
Don't know why on my project does not work (the same command).
It was just that code that I tested out so that's why I didn't actually made an example.
www.alexmatei.com
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 14th Nov 2018 22:42
Is the template compatible with Blend?
www.alexmatei.com
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 15th Nov 2018 05:43
I don't know. If you can import the template - why not?
I think you could customize the template or create a new one for Blend.

It is important that the window handle is passed to the Init function.
And the keyboard and mouse inputs are looped through to Agk.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 15th Nov 2018 10:36
By opening the project into blend is not possible. I think because it's a simple windows forms application and it must be a WFP form in order to use their designing tools
www.alexmatei.com
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 15th Nov 2018 11:47
Do you have any advice on the procedure?

I mean, I think it would be possible if core.cs would be converted for WPF
www.alexmatei.com
Ortu
DBPro Master
11
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 15th Nov 2018 17:35
It's hacky but you can run agk in a windows form that is hosted by a wpf control.

You can also run it in a wpf project by attaching to the main window handle directly.

I've only done bare bones basic testing of these though
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 15th Nov 2018 18:50 Edited at: 15th Nov 2018 18:51
Thank you for the info!

I understand. Sorry for putting in like this but I really don't know how to do that
It does sound perfectly legit.
www.alexmatei.com
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 15th Nov 2018 18:56
I imported the Windows Forms project into the "blend" project, but from this point, question marks
www.alexmatei.com
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 16th Nov 2018 10:35
I have no idea about Blend. I must confess I heard about it for the first time.

If you were able to import the project you now have to figure out how to get the handle from the Agk output window (panel).
You have to pass it to the init function.

Take a closer look at Core.cs and try to apply it step by step to your blend template.

I'm sorry I can't help you in this case.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 16th Nov 2018 14:02
Absolutely no problem!

Only, may I come back with this subject if I have some questions regarding some elements from Core.cs? (With all the explanations, of course).

Thank you!
www.alexmatei.com
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 16th Nov 2018 15:40
Sure, that's okay.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Ortu
DBPro Master
11
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 16th Nov 2018 22:47
The problem with wpf if that controls don't have individual handles this is why you either have to get the main window itself which covers everything else and isn't terribly useful, or host a winforms panel via interop, this still has layering issues but can work to provide an agk "viewport" alongside other controls.

I'm also not too familiar with blend so can't help you much there sorry
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 16th Nov 2018 22:58
Ortu.

Yeah, well, I will try to see if I can "convert" in Core.cs, the panel and other awesome stuff that MadBit made. I used to use Interop by "snapping" an application to a Windows Forms Panel and it was an absolute pain... I don't want to go that path ever again. Since I saw AppGameKit for C# my dreams came true.
www.alexmatei.com
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 19th Nov 2018 21:37
Is it possible to have multiple loops? If yes, how can I make them?

Thank you!
www.alexmatei.com
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 20th Nov 2018 13:30
It depends on what you want to achieve.

- Do you mean multiple loops in the sense of multithreading? Caution is advised. AppGameKit itself is not thread safe. Otherwise you would have the possibility to create programs with multithreading.

- Do you mean several loops that are processed depending on the state your program is in? The procedure is similar to Basic or as I did in my demo game Dust2Dust using a state manager.

Or I totally misunderstood you and need more information.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 20th Nov 2018 15:19
Multiple loops as multiple "DO SYNC LOOP".

Sorry for the lack of proper explanation.
www.alexmatei.com
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 20th Nov 2018 15:38 Edited at: 20th Nov 2018 15:41
You can program as many loops as you want. But only one loop will be active at a time. Until you instruct another loop to run. (That would be state dependent processing then.)

If several loops are to be processed simultaneously, this is multithreading.

Does that answer your question?

I feel like we're talking past each other.

Edit:
If you want to use such loops in a Form application it would be a bad idea. Since the Form object can no longer process the events.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Zigi
9
Years of Service
User Offline
Joined: 5th Jul 2009
Location:
Posted: 21st Nov 2018 20:16 Edited at: 21st Nov 2018 20:19
Hi MadBit.
Would like to ask, did you make any progress on Linux or did you hit a wall after all?
I am about to end my study with C# frameworks like MonoGame, FlatRedBall, UrhoSharp, CocosSharp, Duality I tried most C# frameworks and engines out there and had lot of fun in the process and I truly believe AGKSharp has it place because of it simplicity and easy to use commands. It is also relatively easy to embed in to Windows Form which is also a plus for me at least. It is the most simple to use among all the options for C# out there except Duality maybe. But, being Windows desktop only is a kind of deal breaker

Windows, Linux, Android trio would be nice to be able to target with AGKSharp. Is there any progress in that field or it is remain Windows only?

Thanks a lot.

Also, now that the C++ source of AppGameKit has been publicly shared, have you considered to make AGKSharp open-source too? You could still ask for donation and be the lead developer but being open-source and shared at GitHub could may be help with development. TGC could host the source if it would be a concern.
I would also put AGKSharp on itch.io at least to be more visible to search engines. At the moment AGKSharp is not really coming up in searches for C# frameworks and engines. itch.io can definitely help with that and also provide a more pleasing landing page maybe.

You told at the beginning you don't think AGKSharp can compete with frameworks like MonoGame. It might be true technically. But what I see is that most beginners are complaining about the complexity and lack of tutorials for other frameworks and it is a fact in MonoGame you do need to reinvent most of the wheels and it doesn't suit everyone especially beginners.
AGKSharp is simply a better option for those people looking for a simple yet powerful C# and .NET framework and in that regard I can't really find any better option out there, but being Windows only is a barrier for me

Login to post a reply

Server time is: 2019-06-19 17:03:53
Your offset time is: 2019-06-19 17:03:53