Gamestudio Links
Zorro Links
Newest Posts
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
M1 Oversampling
by 11honza11. 04/20/24 20:57
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 533 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 24 of 32 1 2 22 23 24 25 26 31 32
Re: C# wrapper - RELEASE [Re: MasterQ32] #312996
02/27/10 14:12
02/27/10 14:12
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
i strongly agree with this too. it doesn't really make sense to directly copy the c-api as much as possible. make better use of c#'s oo features.

it would be a lot cleaner if all the engine functions were put into the proper objects as methods. the structure is quite clear anyway. all ent_ functions belong to entities and so on.

it also should be
Entity my = new Entity("guard.mdl", new Vector(0,0,50), null);
instead of ent_create().

...and i still think that var handling should be automatic. tongue

Re: C# wrapper - RELEASE [Re: ventilator] #313039
02/27/10 15:46
02/27/10 15:46
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
It's not hard to make it yourself if you plan to use the wrapper, but yeah it would save time if this were implemented right away tongue.


Click and join the 3dgs irc community!
Room: #3dgs
Re: C# wrapper - RELEASE [Re: Joozey] #313050
02/27/10 16:01
02/27/10 16:01
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
sure, in a few days i could complete my own wrapper i have started to do with boo a while ago but i don't work much with gamestudio at the moment...

...but since stromausfall's wrapper kind of is the official gamestudio c# wrapper now (it is on a prominent spot on the download page) it could/should strive for perfection in my opinion. laugh

Re: C# wrapper - RELEASE [Re: ventilator] #314355
03/07/10 21:46
03/07/10 21:46
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
thanks for your input ventilator, Joozey and Richi007 !
These are some good ideas !
This wrapper may be on the download page, but I'm still critical over certain aspects of it smirk
one is of course the var handling, which, as Ventilator pointed out is quite clumsy
another one, which definately poses a problem is the handling of strings which are sent to the engine ... I'll explain that issue in a short example here
-if I want that the engine is able to access a certain variable which is declared in c#, I have to create a variable on the heap(I think ^^). This data on the heap will be deleted (and thus freeing the space it occupied) when the var object is collected by the garbage collector -> now that's fine !
-but if I want to send a string to the engine, that's something different.. I currently allocate space for the string on the heap and then pass the address to the engine (just like I did with variables), but as I'm having here an inconsistency (in fact if I would want to use the current concept of the wrapper consistently, only STRING objects should be able to be passed) i don't create String objects for strings... That's why the memory allocated for strings, won't be freed EVER !
I will need to find out which functions actually copy strings into the engine data space or only use them for a short time, and functions that access the given pointer over an amount of time. Kind of like functions that only pass a variable and functions that ACCESS a variable (like pan_setneedle).

To actually improve the wrapper, a complete rewrite is necessary without a doubt.
You mentioned that you would be able to finish your own .net wrapper in a few days, in my opinion you should seriously think about completing it.
It wouldn't be wise to just don't create the wrapper because someone else's is on the download page with another wrapper, that is inferior to one's wrapper ! I will gladly step aside, as soon as you post a wrapper that is superior to mine (which yours should easily be if you implement it the way you propose it and already showed in this thread - although I'm not that sure about the speed of lambda expressions and the big array that you use to simulate pointers ^^).
I just wouldn't like to see that a better wrapper is hold back, because of the fact that another wrapper is on the download page ! My aim is not to create a wrapper, but to be able to use the engine in c#, which is why I would highly encourage you to compleate your wrapper, if you think that it's better !
Nonetheless I will most likely start to work on a rewrite of the wrapper in the next weeks, the actual rewrite may take some time.
My post isn't intended to put pressure onto you to finish your wrapper, by saying "I won't continue my wrapper - create a better one", I just would like to say that if you want to create a wrapper yourself, which you think is superior to mine, don't let yourself be hold back, by something like a spot on the download page (which will switch in a second without a doubt if your wrapper is better ^^), or a feeling that you wouldn't want to take someone else's territory, or even a feeling that you wouldn't want to finish and release your wrapper, while I'm still working on mine - out of "kindness" !
As you can see I'm a strong supporter of a free market ^^


get the C# wrapper:
for A7.85.4 and A8.30.4, Version 2.3.9
at http://acknexwrapper2.matthias-auer.net/ or visit the thread
Re: C# wrapper - RELEASE [Re: Stromausfall] #314359
03/07/10 23:47
03/07/10 23:47
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
the few days probably rather would be a whole week. tongue which i don't have at the moment and i also don't work with gamestudio currently so my interest is pretty low. that's the reason i don't complete it.

i also don't think that your wrapper is inferior. its completeness makes it much superior even if there are some design quirks i don't like that much. i am looking forward to your future versions. laugh



what is your inconsistency with strings? i didn't quite get that part in your post. (edit: ah, now i get it. i missed the sentence in the (). but i wouldn't use STRING objects if not absolutely necessary. they are useless compared to the powerful strings of languages like c# or python.)

if i remember correctly the functions that need the pointer for a longer time mainly are some gui functions. in my python wrapper i simply wrote some code in the wrapper functions which handles keeping the reference around as long as it is needed. this shouldn't be a big deal.



writing wrappers is a very repetitive task. i more and more think that it would make sense to write some kind of a7 header file parser which then automatically spits out most of the code. could be quite tricky but changes to stuff like var handling could be done without almost complete manual rewrites then.

Re: C# wrapper - RELEASE [Re: Stromausfall] #315664
03/18/10 00:13
03/18/10 00:13
Joined: Mar 2010
Posts: 1
N
Neiko Offline
Guest
Neiko  Offline
Guest
N

Joined: Mar 2010
Posts: 1
First of all, nice wrapper. I was waiting for something like this.

I haven't found so many tutorials or code snippet for this wrapper. I will contribute my prototype code, when its finished.

But at the moment i have a problems with printing Text.

I've tested something like this:

Code:
TEXT my_text = EngFun.txt_create(1, 0);
my_text.pos_x.IntValue = 100;
my_text.pos_x.IntValue = 100;
EngFun.str_cpy(my_text.pstring[0], "Hello World");
my_text.flags = Flags.INVISIBLE | Flags.SHOW;



Which gives me a ArgumentNullException in the EngFun.cs line 2634. I'm using the 7.82 wrapper.

If i use instead:
Code:
EngFun.txt_addstring(my_text, "test");



Then I can see the "test" string, but how can I change it afterward?

Another thing is, I'm not sure if these both methods are connected somehow, but I've tried this:

Code:
TEXT my_text = EngFun.txt_create(2, 0);
my_text.pos_x.IntValue = 100;
my_text.pos_x.IntValue = 100;
Var v = EngFun.txt_addstring(my_text, "test");
STRING s = EngFun.txt_str(my_text, v.IntValue);
my_text.flags = Flags.INVISIBLE | Flags.SHOW;



And got an "s = null" as an result, but only when the first parameter from txt_create is bigger then 1.

I hope you can help me and I'm sure I will have some more questions in the future.

best regards
Neiko

Re: C# wrapper - RELEASE [Re: Neiko] #315687
03/18/10 07:10
03/18/10 07:10
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
here's the code to change the string array of a TEXT object :

Code:
TEXT my_text = EngFun.txt_create(2, 0);
            my_text.pos_x.IntValue = 100;
            my_text.pos_x.IntValue = 100;
            my_text.pstring = new String[] { "asdfasdf", "asdfasfd" };
            my_text.flags = Flags.SHOW;
            yield return 200;
            my_text.pstring = new String[] { "234234", "234324" };



special thanks go to neiko who found a bug (some functions who return Angle didn't work) which is fixed in the new version of the wrapper : 1.0.1

Re: C# wrapper - RELEASE [Re: Stromausfall] #316551
03/24/10 20:43
03/24/10 20:43
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Hey Stromausfall. In your next release of the wrapper, do you mind marking your classes as Serializable? This way we can clone engine objects using a MemoryStream.

Thanks.

Re: C# wrapper - RELEASE [Re: DJBMASTER] #316843
03/27/10 07:47
03/27/10 07:47
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
afaik serializable is used to save an object and later restore it - but this would only work in the same session/instance of the engine.
For what exactly would you use MemoryStream for ?


get the C# wrapper:
for A7.85.4 and A8.30.4, Version 2.3.9
at http://acknexwrapper2.matthias-auer.net/ or visit the thread
Re: C# wrapper - RELEASE [Re: Stromausfall] #316852
03/27/10 09:33
03/27/10 09:33
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
I'm using it for my panel editor at the moment but I can extend it for my other editors. It allows me to create an exact memory clone of a current engine object, without having to manually copy over properties.

As for your same session argument, yes this is true that the object will only remain while the current instance of the engine is 'alive'.

As my editor is just the visual part, it retrives the data from an external source, where the data is also cloned.

You don't have to mark them if you don't want to, lol.

Btw, I know that it's off-topic, but have you experience with the 'var' keyword in VS 2008?

Last edited by DJBMASTER; 03/27/10 09:37.
Page 24 of 32 1 2 22 23 24 25 26 31 32

Moderated by  TWO 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1