Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (VoroneTZ, monk12, Quad), 829 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 18 of 32 1 2 16 17 18 19 20 31 32
Re: C# wrapper - A7.80 V1.0.2 [Re: Stromausfall] #285903
08/21/09 11:33
08/21/09 11:33
Joined: Aug 2005
Posts: 1,230
M
MichaelGale Offline
Serious User
MichaelGale  Offline
Serious User
M

Joined: Aug 2005
Posts: 1,230
I was going to point that out, but pointers are valid in C# in an unsafe context if you compile the assembly with the /unsafe switch. See here.


Your friendly mod is at your service.
Re: C# wrapper - A7.80 V1.0.2 [Re: MichaelGale] #285907
08/21/09 14:03
08/21/09 14:03
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Hi, here is a function that allows you to drag a panel across the screen...
Code:
public IEnumerable DragPanel()
{
PANEL sender = EngVar.mouse_panel;
int startx = EngVar.mouse_cursor.x.IntValue - sender.pos_x.IntValue;
int starty = EngVar.mouse_cursor.y.IntValue - sender.pos_y.IntValue;

while (EngVar.mouse_left.IntValue == 1)
{
if (EngVar.mouse_moving.IntValue == 1)
{
sender.pos_x.IntValue = EngVar.mouse_cursor.x.IntValue- startx;
sender.pos_y.IntValue = EngVar.mouse_cursor.y.IntValue -starty;
}
yield return 1;
}
}


and it is assigned to a PANEL's 'event' property...
Code:
PANEL pnl = EngFun.pan_create("bmap = hi.bmp;",(Var)1);
pnl.pos_x.IntValue = 0;
pnl.pos_y.IntValue = 0;
pnl.event_ = DragPanel;
pnl.SHOW = true;


Maybe i'm doing something wrong or it's a bug or something but i can only ever drag the panel once. So it seems the event function is only being called once.

I think the while loop may be a contributing factor because if i just have a function that calls a messageBox, then i can click the panel infinite times and it will show the MessageBox.

While we are on the subject. In Lite-C, when you call a PANEL event you can pass the PANEL pointer to the function allowing you to see which panel called the function. I don't know if this is possible with the wrapper because the event property expects an EventVoid signature, so no paramter passing. I do have a workaround with mouse_panel, but it would make things a little easier. Just a thought.

Re: C# wrapper - A7.80 V1.0.2 [Re: Stromausfall] #285914
08/21/09 14:50
08/21/09 14:50
Joined: Dec 2006
Posts: 434
UK,Terra, SolarSystem, Milky W...
pararealist Offline
Senior Member
pararealist  Offline
Senior Member

Joined: Dec 2006
Posts: 434
UK,Terra, SolarSystem, Milky W...
@Stromausfall

How to use
ent_animate(actor, "idle",percent, ANM_CYCLE);

cant find ANM_CYCLE??

Last edited by pararealist; 08/21/09 14:53.

A8.3x Commercial, AcknexWrapper and VS 2010 Express
○pararealist now.
Re: C# wrapper - A7.80 V1.0.2 [Re: pararealist] #285927
08/21/09 15:47
08/21/09 15:47
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
Hi !
@DJBMASTER: it worked for me, even multiple times, but it seems that one can only drag it if one clicks in the lower right part of the panel !
here's the code i used :
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using AcknexWrapper;
using System.Collections;

namespace game
{
    class Program
    {
        static IEnumerable mouse()
        {
            BMAP arrow = EngFun.bmap_create("mouse.bmp");
            EngVar.mouse_map = arrow;
            EngVar.mouse_mode.IntValue = 2;

            while (true)
            {
                EngVar.mouse_pos.x.FloatValue = EngVar.mouse_cursor.x.FloatValue;
                EngVar.mouse_pos.y.FloatValue = EngVar.mouse_cursor.y.FloatValue;
                yield return 1;
            }
        }

        public static IEnumerable DragPanel()
        {
            Console.WriteLine("i was called !");

            PANEL sender = EngVar.mouse_panel;
            int startx = EngVar.mouse_cursor.x.IntValue - sender.pos_x.IntValue;
            int starty = EngVar.mouse_cursor.y.IntValue - sender.pos_y.IntValue;

            while (EngVar.mouse_left.IntValue == 1)
            {
                if (EngVar.mouse_moving.IntValue == 1)
                {
                    sender.pos_x.IntValue = EngVar.mouse_cursor.x.IntValue - startx;
                    sender.pos_y.IntValue = EngVar.mouse_cursor.y.IntValue - starty;
                }
                yield return 1;
            }
        }

        static IEnumerable MainMethod()
        {
            PANEL pnl = EngFun.pan_create("bmap = mouse.bmp;", (Var)1);
            pnl.pos_x.IntValue = 0;
            pnl.pos_y.IntValue = 0;
            pnl.event_ = DragPanel;
            pnl.SHOW = true;
            yield return 1;
        }

        static void Main(string[] args)
        {
            EngFun.engine_open(null);
            Scheduler.AddEventVoid(mouse);
            Scheduler.StartScheduler(MainMethod);
        }
    }
}



Didn't knew that the panel event takes a Panel as Parameter, i will add that in the next version of the wrapper thanks !

@pararealist
Ah, it seems i have forgotten to add an enum for ent_animate, i will fix that in the next version (which will be released quite soon) !



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 - A7.80 V1.0.2 [Re: Stromausfall] #285932
08/21/09 16:07
08/21/09 16:07
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
I've just released
Version 1.0.3 for a6.60
Version 1.1.1.8 for a7.77
Version 1.0.2 for a7.80

these versions now include the ent_animate flags and the PANEL event now doesn't take an EVENTVOID any longer but an EVENTINTPTR !
Big thanks to DJBMASTER and pararealist ^^

edit:
@DJBMASTER lol xD

Last edited by Stromausfall; 08/21/09 16:13.

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 - A7.80 V1.0.2 [Re: Stromausfall] #285933
08/21/09 16:07
08/21/09 16:07
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
ahhh it was because i forgot to continously set the mouse position...
Code:
EngVar.mouse_pos.x.IntValue = EngVar.mouse_cursor.x.IntValue;
EngVar.mouse_pos.y.IntValue = EngVar.mouse_cursor.y.IntValue;



So it was always only detecting panels at (0,0). Don't know why you can only drag in the bottom corner, but i'm not using a mouse_map so maybe it limits the 'detection' region. Thanks again.

LOL, when you said soon i thought you meant like a day, not a minute, ahahaha. Nice one!

Last edited by DJBMASTER; 08/21/09 16:11.
Re: C# wrapper - A7.80 V1.0.2 [Re: Stromausfall] #285950
08/21/09 17:29
08/21/09 17:29
Joined: Dec 2006
Posts: 434
UK,Terra, SolarSystem, Milky W...
pararealist Offline
Senior Member
pararealist  Offline
Senior Member

Joined: Dec 2006
Posts: 434
UK,Terra, SolarSystem, Milky W...
Thanks.
ver is 1.0.3
//
please do same for
EngFun.ent_sky_FLAGS ???
for ent_createlayer();

Last edited by pararealist; 08/21/09 17:44.

A8.3x Commercial, AcknexWrapper and VS 2010 Express
○pararealist now.
Re: C# wrapper - A7.80 V1.0.2 [Re: pararealist] #285955
08/21/09 17:53
08/21/09 17:53
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
you can access the flags for the entity via : ENTITY.
for example : ENTITY.FLAGS2.SKY !


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 - A7.80 V1.0.2 [Re: Stromausfall] #285957
08/21/09 18:00
08/21/09 18:00
Joined: Dec 2006
Posts: 434
UK,Terra, SolarSystem, Milky W...
pararealist Offline
Senior Member
pararealist  Offline
Senior Member

Joined: Dec 2006
Posts: 434
UK,Terra, SolarSystem, Milky W...
OK


A8.3x Commercial, AcknexWrapper and VS 2010 Express
○pararealist now.
Re: C# wrapper - A7.80 V1.0.2 [Re: pararealist] #285977
08/21/09 22:34
08/21/09 22:34
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 think it's a bug that setting the 'bmapOverOff' in 'EngVar.pan_setbutton' as 'null' creates an error.

Page 18 of 32 1 2 16 17 18 19 20 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