Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
basik85278
by basik85278. 04/28/24 08:56
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Quad), 748 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 5
Page 19 of 23 1 2 17 18 19 20 21 22 23
Re: C# wrapper 2.3.3 - RELEASE [Re: Stromausfall] #390926
01/05/12 22:58
01/05/12 22:58
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
Originally Posted By: Stromausfall

i currently don't know what Tags are for, I had a quick look and only found something about an object variable ? In which situations is such a tag used or beneficial ?
)

you can store objects in "engine objects", not only two different double values (skill_x, skill_y)


Visit my site: www.masterq32.de
Re: C# wrapper 2.3.3 - RELEASE [Re: MasterQ32] #390927
01/05/12 23:11
01/05/12 23:11
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
ah okay ! thanks for the explanation !
Tags are not a good idea then, because think of the following scenario :

you assign an object as tag to entity#1, then you are c_tracing and hit entity#1 and want to access its tag object -> but this won't work, because the object that you retrieve via c_trace is a new object (although it points to the same memory location and thus 'is' the entity#1) and doesn't have a tag !

edit :
a 'tag' could be simualted simply by a "Dictionary<IntPtr, object> tagObjects" where you can get the unique entity identifier by someEntity.getIntPtr() !

Last edited by Stromausfall; 01/05/12 23:15.

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] #390960
01/06/12 12:03
01/06/12 12:03
Joined: Dec 2008
Posts: 1,218
Germany
Rackscha Offline
Serious User
Rackscha  Offline
Serious User

Joined: Dec 2008
Posts: 1,218
Germany
@MasterQ32:
Some good ideas. Especially like the idea of removing prefixes and adding constructors. C# is not lite-c and doesnt have its limitations. :|


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] #393192
02/01/12 12:04
02/01/12 12:04
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Online
Senior Expert
Quad  Online
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
@Stromausfall:

Thanks for the great wrapper again. Exactly what i need right now.

I need to embed engine in a form, there is an example in your site, but i figured out a simpler approach:

Code:
EngFun.video_window(null, null, 256, null);
EngFun.video_set(panelEngine.Width,panelEngine.Height,0,0);
EngVar.hWndTarget = panelEngine.Handle;
EngVar.hWndParent = this.Handle;



you just have to make sure you set EngVar.d3d_lockable to 1 after engine_open and before first frame. Then use the code i posted above AFTER first frame.


3333333333
Re: C# wrapper 2.3.3 - RELEASE [Re: Quad] #393439
02/03/12 14:16
02/03/12 14:16
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
it seems, that neither keyboard input nor especially mouse input works with this method, although if you don't need direct interaction (via keyboard/mouse), this seems to be the best solution !


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] #393605
02/05/12 12:29
02/05/12 12:29
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Online
Senior Expert
Quad  Online
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
adding EngFun.on_message(or something like that) to form's message loop should solve that problem in 1 line of code.


3333333333
Re: C# wrapper 2.3.3 - RELEASE [Re: Quad] #394745
02/16/12 10:02
02/16/12 10:02
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Online
Senior Expert
Quad  Online
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
@Stromausfall,

How do i differantiate between events in the event function? I have both enable frame, click and impact.


3333333333
Re: C# wrapper 2.3.3 - RELEASE [Re: Quad] #394793
02/16/12 16:42
02/16/12 16:42
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
via event_frame !
I've made a small example that shows how to use it ! you'll need the c# project to be a console project to view the output (when an event is triggered..) !
You won't need any models or stuff like that for the project to work, only the code !

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AcknexWrapper;

namespace eventExample
{
    class Program
    {
        private static IEnumerable<ScheduleMethod> testEntity2Method(IntPtr e)
        {
            ENTITY me =
                ENTITY.createFromPointer(e);
            Vector originalPos =
                new Vector(me.xyz);
            double originalYPos =
                me.y;

            // cube should be red
            me.LIGHT = true;
            me.red = 255;
            me.blue = 0;
            me.green = 0;
            me.lightrange = 0;

            // low push value
            me.push = 10;

            double timeValue = 0;
            double newYForce;
            
            while (true)
            {
                // increase by 1 every second and limit to 0...1.999
                timeValue += EngVar.time_step / 16;
                timeValue %= 2;

                if (timeValue > 1.5)
                {
                    // 1/4 of time, move away
                    newYForce = 2.5 * EngVar.time_step;
                }
                else
                {
                    // 3/4 of time move to cube -> to cause an impact !
                    newYForce = -2.5 * EngVar.time_step;
                }

                // c_move to new position to trigger impact event !
                me.c_move(
                    new Vector(0, newYForce, 0),
                    new Vector(0, 0, 0),
                    Flags.GLIDE);

                yield return 1;
            }
        }

        private static IEnumerable<ScheduleMethod> testEntityMethodEvent()
        {
            if (EngVar.event_type == Flags.EVENT_CLICK)
            {
                Console.WriteLine("Flags.EVENT_CLICK");
            }
            if (EngVar.event_type == Flags.EVENT_IMPACT)
            {
                Console.WriteLine("Flags.EVENT_IMPACT");
            }
            if (EngVar.event_type == Flags.EVENT_FRAME)
            {
                Console.WriteLine("Flags.EVENT_FRAME");
            }

            // there's nothing to wait for...
            yield break;
        }

        private static IEnumerable<ScheduleMethod> testEntityMethod(IntPtr e)
        {
            ENTITY me =
                ENTITY.createFromPointer(e);

            // cube should be blue
            me.LIGHT = true;
            me.red = 0;
            me.blue = 255;
            me.green = 0;
            me.lightrange = 0;

            // enable some events...
            me.ENABLE_FRAME = true;
            me.ENABLE_IMPACT = true;
            me.ENABLE_CLICK = true;

            // high push value
            me.push = 1000;

            me.event_ = testEntityMethodEvent;

            // nothing to wait for here...
            yield break;
        }
 
        //the main method, called by the scheduler
        private static IEnumerable<ScheduleMethod> myMainMethod()
        {
            // limit frame rate
            EngVar.fps_max = 60;

            // load an empty level
            EngFun.level_load(null);

            // use mouse
            EngVar.mouse_mode = 4;

            ENTITY testEntity =
                ENTITY.ent_create("_CUBE.MDL", new Vector(200, -25, 0), testEntityMethod);

            ENTITY testEntity2 =
                ENTITY.ent_create("_CUBE.MDL", new Vector(200, 25, 0), testEntity2Method);
 
            yield return ScheduleMethod.wait(1);
        }

        static void Main(string[] args)
        {
            //open the engine
            EngFun.engine_open(null, null);

            //start the scheduler
            Scheduler.StartScheduler(myMainMethod);
        }
    }
}



Last edited by Stromausfall; 02/16/12 16:48.

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] #394873
02/17/12 09:23
02/17/12 09:23
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Online
Senior Expert
Quad  Online
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Thanks!


3333333333
Re: C# wrapper 2.3.3 - RELEASE [Re: Quad] #394875
02/17/12 10:19
02/17/12 10:19
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Online
Senior Expert
Quad  Online
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
in case of testEntityMethodEvent, how do i use the entity skills? is there a way to reach that ent?

Scratch that. EngVar.me

Last edited by Quad; 02/17/12 10:20.

3333333333
Page 19 of 23 1 2 17 18 19 20 21 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