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

Author
Message
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 7th Oct 2018 10:31 Edited at: 7th Oct 2018 10:34
Copy and pasted the zip files (all of them in the Visual C#, Project Templates folder and it gave me this, at creating a new project (the windows forms (x64) version).

Thank you again!

EDIT: On the other hand, on the 32bit version I can't compile because of the error in the log (down on the screenshot below).
www.alexmatei.com

Attachments

Login to view attachments
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 7th Oct 2018 12:04
Ok, thank you for that.

The maintenance effort is too high for me to create new templates with every release. So from now on I will only distribute the project directories. You have to copy them into your solution and rename them if necessary.

[href=http://madbit.bplaced.com/?page_id=136]Please download it again.
[/href]
I hope it works 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: 7th Oct 2018 12:09 Edited at: 7th Oct 2018 12:10
So I have to delete the archives from Visual C# folder and just initialize one project from one of these folders, right?
www.alexmatei.com
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 7th Oct 2018 12:13
The 32 bit version works as it was intended!

The 64 bit gave me an exception as shown below.
www.alexmatei.com

Attachments

Login to view attachments
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 7th Oct 2018 12:32
You have to manually set your project to 64bit. Then it should work. In VS in the upper bar, simply set it from Debug to Release 64.
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: 7th Oct 2018 12:47
Hats down to you, MadBit!

Thank you so much for the help provided!
www.alexmatei.com
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 9th Oct 2018 08:57
Hello!

One quick question regarding the code itself:

I try to detect some images from the hard drive and then to detect in a for loop if the images does not exist, to able to fill those slots. However from the following code, it gives me a message that the application is in break mode (the app stalls).



Thank you!
www.alexmatei.com
stan10785
User Offline
Joined: 15th Aug 2018
Location:
Posted: 9th Oct 2018 10:24
Thanks for all the work on this MadBit - I see that the hiccup around the mouse was resolved in the update and works like a gem! Still waiting for you to set up that Patreon page so we can help you out more!
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 9th Oct 2018 13:12
I have slightly modified your code. This is how it should work. (Not tested)
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: 9th Oct 2018 13:26 Edited at: 9th Oct 2018 13:40
Madbit,

Thank you!

It didn't gave me any errors. The absolutely last thing: In order for the images to appear on screen, is this the correct method to create the sprites?



Thank you, again!
www.alexmatei.com
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 9th Oct 2018 14:24
If you only want to use the images once for one sprite, you can also just use LoadSprite.
So something like this.



The way you do it is also O.K.
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: 9th Oct 2018 14:35
There are multiple sprites with different images. So if I have different images and different sprites, I can still use the LoadSprite command? Didn't knew about this method... is a lot more cleaner. Silly me.
However with my method and the alternative method from you, don't know why the sprites don't appear on screen.

The whole code again:



Sorry for asking so many questions, but I made the decision to transfer my project in C# AppGameKit and got stuck just on these problems.

Thank you!
www.alexmatei.com
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 9th Oct 2018 15:17
Debug your code to see if the sprites are really loaded.
If you don't know how to do this you can also use the code below.
If more than one sprite is loaded, a number above 1000 should be displayed.

If the sprites were not loaded, it is probably because the path was not set correctly. Then try it with
Agk.SetFolder("media/tools/assets");

I changed your code again.

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: 9th Oct 2018 16:21
You where right!

It was because the "media" folder was not included. I got used to AppGameKit Basic IDE to actually get the "media" folder automatically.

Huge thank you for your help! It helped me a lot!
www.alexmatei.com
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 10th Oct 2018 11:44
Hello,

Sorry for asking again about certain things on C#, maybe someone also could run into the same problem. It's about arrays, in general. I want to make them public to be accessed from another form or function.

I have the following, as an example:



I tried public static but it throws me errors like the one attached on this post.

Thank you so much!
www.alexmatei.com

Attachments

Login to view attachments
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 10th Oct 2018 19:51
I think it's the way of declaring the variables. Try it with 'static' in front.

Something like that:


If not, a little more information would be better.

What does the class look like in which the variables are declared?
What compiler errors are output?
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 Oct 2018 08:32
Hello Madbit,

I will try your alternative. In the meantime, I managed to create classes for every array and make them public so that they can be accessed from anywhere in the application. However, I would really like for your example to work. It looks much more neat.

Here is what I have managed to do:



And access the array by: textarray.texthassprite[number] = variable to put.

I think this is another way to do it?
www.alexmatei.com
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 11th Oct 2018 14:48 Edited at: 11th Oct 2018 15:13
Hmm, I would approach it from the other side.
I would put all the properties into a structure and then save the entries in a list.
Something like that.


To add values ...


enumerate all items in the list


But all this is only estimated, because I don't know what you want to do with the data and how you use it.
And it is also a personal decision, how you can work best.
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 Oct 2018 15:11
I understand. I'll try.

I identified that the keyboard does not work when I initialize either "getrawkeypressed" or "getrawkeystate". Also on settweentextred, green or blue and maybe to the rest of the tweens, the values are only INTEGER, not FLOAT as in the basic version.

Thank you!
www.alexmatei.com
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 11th Oct 2018 16:23 Edited at: 11th Oct 2018 16:24
MateiSoft wrote: "Also on settweentextred, green or blue and maybe to the rest of the tweens, the values are only INTEGER, not FLOAT as in the basic version."

This is the Tier2 declaration of this Function.

You see it is an 'int'. It won't do any difference if I change it to float. I didn't find anything in the documentation that it should be a float.

MateiSoft wrote: "I identified that the keyboard does not work when I initialize either "getrawkeypressed" or "getrawkeystate". "

Ok, thank you for this.

It only works if the AppGameKit window gets the focus. So you can insert the following line as workaround in the file 'Core.cs' and function Core_OnMouseDown.
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: 15th Oct 2018 17:44
Ok,

I have quickly uploaded a new package. It is only compiled with the current version of AppGameKit (2018-10-10).

As always, download it from my site.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
snaidamast
User Offline
Joined: 16th Oct 2018
Location:
Posted: 18th Oct 2018 17:42
I am looking at converting my military simulation from MonoGame to AGKSharp due to the much greater capability of providing a user interface with the Windows Forms controls.

However, how does one create a panel that can be scrolled as with a large hexagonal map. With MonoGame we used the primary camera and changed its position for these purposes.

I also have to build the map using tiles, which already have the routines written in MonoGame. How would I do this with AGKSharp?

Thank you...
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 19th Oct 2018 11:02 Edited at: 19th Oct 2018 11:05
Hello and welcome to the forum.

I don't know if you work in 2D or 3D.

In the case of 2D, you have two choices.
- You create your complete map from tiles. In Agk you use sprites to do this. Afterwards you can move the view with 'SetViewOffset(x, y)' as you like. I suppose this is similar to your MonoGame Project.

or ...

- You calculate which tiles are visible at the current position of the 'camera' and draw only the tiles that are necessary. So you don't need to move the visible area anymore. For very large maps, it could be faster.

There is only one way in 3D.
- You assemble your map using your 3D tiles and set the camera to scroll. So just like you already described it.

For help you can use the official documentation. You just have to put "Agk." in front of the commands.

I hope this helps.
If I have misunderstood you or if there are more questions open then ask further.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Carharttguy
2
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 19th Oct 2018 20:30 Edited at: 19th Oct 2018 21:07
Hello Madbit, super nice to see that you're updating AgkSharp to newer versions of AppGameKit!

I have a question about the inner workings of AgkSharp: is it possible to register AgkSharp.dll as a COM object in Windows? This would expose AgkSharp to almost any Windows programming language!
Next to C#, I'm also using a programming language called Xojo, and that can reference with dlls, but I don't know if this would work with AgkSharp (some basic info here: https://blog.xojo.com/2014/01/03/accessing-net-code-from-xojo/)

I guess DLLRegisterServer has to be added somewhere or so?

Do you think this would be possible? Would be nice for Xojo, as there are no real 3D engines available.

Thanks for any info!
MadBit
Valued Member
9
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 20th Oct 2018 05:07
Hi, you have to try this. I didn't declare the AgkSharp functions as COM objects.
But if it should work. You also had to translate the C# code 'Core.cs' into Xojo. Because the window for Agk is created there and the window handle must be passed to Agk.InitGL.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)

Login to post a reply

Server time is: 2018-10-23 09:09:47
Your offset time is: 2018-10-23 09:09:47