Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (vicknick, 7th_zorro, 1 invisible), 890 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 5
Page 17 of 23 1 2 15 16 17 18 19 22 23
Re: C# wrapper 2.3.3 - RELEASE [Re: Rackscha] #381041
08/23/11 15:36
08/23/11 15:36
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
http://manual.3dgamestudio.net/beta.htm

not since 'V7.63b beta - released 15-Dec-2008' anymore - this was afaik, when VISIBLE was taken out of the headers of the engine_sdk !


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 2.3.3 - RELEASE [Re: Stromausfall] #381045
08/23/11 15:46
08/23/11 15:46
Joined: Dec 2008
Posts: 1,218
Germany
Rackscha Offline
Serious User
Rackscha  Offline
Serious User

Joined: Dec 2008
Posts: 1,218
Germany
ah...got confused with INVISIBLE^^


MY Website with news of my projects:
(for example my current
Muliplayer Bomberman,
GenesisPrecompiler for LiteC
and TileMaster, an easy to use Tile editor)
Sparetime-Development

Re: C# wrapper 2.3.3 - RELEASE [Re: Rackscha] #381070
08/23/11 20:45
08/23/11 20:45
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline
Serious User
painkiller  Offline
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
Originally Posted By: Rackscha
eh...your wrapper is using SHOW for entities. But isnt the correct flag VISIBLE ?


panels and view entities use SHOW, and world entities use INVISIBLE


3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB
Re: C# wrapper 2.3.3 - RELEASE [Re: painkiller] #381216
08/25/11 13:51
08/25/11 13:51
Joined: Dec 2008
Posts: 1,218
Germany
Rackscha Offline
Serious User
Rackscha  Offline
Serious User

Joined: Dec 2008
Posts: 1,218
Germany
mh i have a problem with the partikle example.

i wrote this
Code:
class MyGraphic
    {
        private static void ParticleLine(PARTICLE p)
        {

        }

        public static void DrawLine3DEx(Vector AFrom, Vector ATo, Color AColor, int AAlpha, int ASize)
        {
            PARTICLE.effect(ParticleLine, 1, AFrom, ATo);
        }


    }



Get the error: "1 argument cannot be converted from ethodgroup to AcknexWrapper.WrapperDelegateParticle"

Cant see any differences between my and your particle event in the tutorial. What have i done cry


MY Website with news of my projects:
(for example my current
Muliplayer Bomberman,
GenesisPrecompiler for LiteC
and TileMaster, an easy to use Tile editor)
Sparetime-Development

Re: C# wrapper 2.3.3 - RELEASE [Re: Rackscha] #381273
08/25/11 23:07
08/25/11 23:07
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
well you're not using the scheduler (at least that's how it seams), thus some small things change ! in this case, the particle functions doesn't have a PARTICLE as argument anymore, but an IntPtr !
thus the correct code should be :
Code:
class MyGraphic
    {
        private static void ParticleLine(IntPtr p)
        {

        }

        public static void DrawLine3DEx(Vector AFrom, Vector ATo, Color AColor, int AAlpha, int ASize)
        {
            PARTICLE.effect(ParticleLine, 1, AFrom, ATo);
        }


    }




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 2.3.3 - RELEASE [Re: Stromausfall] #381285
08/26/11 00:19
08/26/11 00:19
Joined: Dec 2008
Posts: 1,218
Germany
Rackscha Offline
Serious User
Rackscha  Offline
Serious User

Joined: Dec 2008
Posts: 1,218
Germany
ah thanks laugh

ANd how do i use it correctly now? ssems i got my first problem with the garbage collector tongue

Got a message that WrapperDelegateParticle did a callback(or however i have to translate it o.O), and it needs to be guranteed that objects are still available..etc. A bit tired and fully translating the germantext(wow ms c# really has long messages :D) is a bit to much now.

currently i have those 3 Methods for testing:

Code:
private static void ParticleLineEvent(IntPtr AP)
        {
            PARTICLE P = PARTICLE.createFromPointer(AP);
            P.lifespan = 0;
        }

        private static void ParticleLine(IntPtr AP)
        {
            PARTICLE P = PARTICLE.createFromPointer(AP);
            P.lifespan = 1;
            P.event_ = ParticleLineEvent;
        }

        public static void DrawLine3DEx(Vector AFrom, Vector ATo, Color AColor, int AAlpha, int ASize)
        {
            PARTICLE.effect(ParticleLine, 1, AFrom, (Vector) ATo.vec_sub(AFrom));
        }



runs well for some frames, then it jumps out of the program into engine_frame


MY Website with news of my projects:
(for example my current
Muliplayer Bomberman,
GenesisPrecompiler for LiteC
and TileMaster, an easy to use Tile editor)
Sparetime-Development

Re: C# wrapper 2.3.3 - RELEASE [Re: Rackscha] #381295
08/26/11 06:36
08/26/11 06:36
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
yes, that's because when you use no scheduler, you have to do some extra tasks !
The delegates are automatically collected by the garbage collector, that's why the scheduler stores them !
If use no scheduler, you have to store the used delegates yourself !
the following code snippet should work (i guess) :
Code:
// create a delegate for the particle method and store it, if you use instance
// methods etc... you have to store them in another way, but using only static
// methods, this should work too !
private static readonly WrapperDelegateParticle StoredDelegateForParticles = ParticleLineEvent;

private static void ParticleLineEvent(IntPtr AP)
        {
            PARTICLE P = PARTICLE.createFromPointer(AP);
            P.lifespan = 0;
        }

        private static void ParticleLine(IntPtr AP)
        {
            PARTICLE P = PARTICLE.createFromPointer(AP);
            P.lifespan = 1;
            P.event_ = ParticleLineEvent;
        }

        public static void DrawLine3DEx(Vector AFrom, Vector ATo, Color AColor, int AAlpha, int ASize)
        {
            // call the effect method, already with the stored delegate
            PARTICLE.effect(StoredDelegateForParticles, 1, AFrom, (Vector) ATo.vec_sub(AFrom));
        }




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 2.3.3 - RELEASE [Re: Stromausfall] #381331
08/26/11 15:08
08/26/11 15:08
Joined: Dec 2008
Posts: 1,218
Germany
Rackscha Offline
Serious User
Rackscha  Offline
Serious User

Joined: Dec 2008
Posts: 1,218
Germany
a thanks. and executing the drawline3dex method multiple times still works? laugh

And just in case: if i want to use it in an instanced object(so no static methods),
how do i handle those?

edit: and you explain a little bit how your example above in combination with the garbage collector works within your acknexwrapper? just interseted^^

edit2: Little question: even if your scheduler is not running, isnt it possible for the wrapper to catch the delegate? I mean i call PARTICLE.effect. Isnt it possible to catch it inside your effect function?

Greets
Rackscha

Last edited by Rackscha; 08/26/11 15:42.

MY Website with news of my projects:
(for example my current
Muliplayer Bomberman,
GenesisPrecompiler for LiteC
and TileMaster, an easy to use Tile editor)
Sparetime-Development

Re: C# wrapper 2.3.3 - RELEASE [Re: Rackscha] #381339
08/26/11 17:16
08/26/11 17:16
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
nope shouldn't be a problem because you use the same STATIC method !

well if you use instanced methods, then you should create a member variable that stores the delegate (like the static one in the example, but NOT static) !

well after you pass the delegate the wrapper, a Marshal method allows to get an IntPtr that points to the managed delegate, this delegate is then passed to the C++ API of the acknex.dll, then the acknex.dll calls the IntPtr, which then calls the delegate (this done inside of .net) ! Thus if the delegate was removed by the garbage collector, the IntPtr points to a delegate that has been removed !

In the scheduler, the delegates for particles are stored as long as they are called every frame, if a particle delegate isn't called anymore, it is automatically removed (because particle functions are called every frame !)
Other delegates for example in ent_create only have to be stored while the function is called (for example ent_create), because after this they aren't called anymore... Variables that use delgates, store the delegate and simply overwrite it when the value is changed... And the delgates that are used for the panel methods are stored in a dictionary, that removes the delegates, when the panel element is removed..


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 2.3.3 - RELEASE [Re: Stromausfall] #381353
08/26/11 20:19
08/26/11 20:19
Joined: Dec 2008
Posts: 1,218
Germany
Rackscha Offline
Serious User
Rackscha  Offline
Serious User

Joined: Dec 2008
Posts: 1,218
Germany
ah thanks laugh

One last question though: how do i do a basic setup for the particle?
The example above only uses ParticleLineEvent. But how can i setup size/color etc only once?

Do i have to store the other event in a wrapper delegate too, use this one first and then reassign the event delegate after first execute of the setup function?


MY Website with news of my projects:
(for example my current
Muliplayer Bomberman,
GenesisPrecompiler for LiteC
and TileMaster, an easy to use Tile editor)
Sparetime-Development

Page 17 of 23 1 2 15 16 17 18 19 22 23

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