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), 887 guests, and 3 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 16 of 23 1 2 14 15 16 17 18 22 23
Re: C# wrapper 2.3.1 - RELEASE [Re: jenGs] #379984
08/10/11 19:41
08/10/11 19:41
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
there are two types of events :
one that uses 'EventHandlers' like EngVar.on_mouse_left, an example for this is shown in one of my previous posts !
the other type only allows one method to be called, for example the Panel.event_ property :

Code:
// the method to be called when the panel is clicked
    static void PanelEvent(IntPtr p)
    {
        // get the clicked panel
        PANEL thisPanel =
            PANEL.createFromPointer(p);

        // change the color of the clicked panel
        thisPanel.bmap.bmap_fill(new Color(200, 0, 0), 50);
    }

// the main method called by the scheduler
    private static IEnumerable<ScheduleMethod> MyMainMethod()
    {
        // create a red panel and make it visible...
        PANEL p =
            PANEL.pan_create(null, 24);
        
        p.SHOW = true;
        p.size_x = 100;
        p.size_y = 100;
        p.pos_x = 300;
        p.pos_y = 300;
        p.bmap =
            BMAP.bmap_createblack(100, 100, 32);
        p.bmap.bmap_fill(new Color(0, 0, 255), 50);

        // assign the method to be called when the panel is clicked..
        p.event_ =
            PanelEvent;

        // use the mouse !!
        EngVar.mouse_mode = 4;
}

// the entry point of the program
    static void Main(string[] args)
    {
        // load an empty level
        EngFun.engine_open(null, null);
        EngFun.level_load(null);

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




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.1 - RELEASE [Re: Stromausfall] #380288
08/15/11 13:18
08/15/11 13:18
Joined: Jul 2010
Posts: 283
Germany
J
jenGs Offline
Member
jenGs  Offline
Member
J

Joined: Jul 2010
Posts: 283
Germany
Hi,
I have another question laugh
Do I have to write an own inkey function or is it somewhere. I noticed that you are using csharp native strings. So I guess it is difficult to wrap the inkey function?
Patrick

Re: C# wrapper 2.3.1 - RELEASE [Re: jenGs] #380323
08/15/11 16:36
08/15/11 16:36
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
The problem with inkey is that it isn't part of the acknex.dll (from http://www.conitec.net/beta/ainkey.htm) as it uses wait (and thus the lite-c scheduler) !

simulating inkey shouldn't be that hard, I guess the description of inkey in the GameStudio manual offers a reasonable solution :
You could use wait and check a variable that contains the value of the last pressed char, for example the engine variable key_lastpressed !


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.1 - RELEASE [Re: Stromausfall] #380512
08/18/11 14:50
08/18/11 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...
Please check if
button_state(num, state)
is working properly?
I do not seem to be getting any result.


A8.3x Commercial, AcknexWrapper and VS 2010 Express
&#9675;pararealist now.
Re: C# wrapper 2.3.1 - RELEASE [Re: pararealist] #380516
08/18/11 15:19
08/18/11 15:19
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
button_state works for me ! look at the following example, it uses button_state to switch the state of the toggle button ! it uses a toggle button and switches it on/off depending on its current state, using button_state (when space is pressed) ! The state is also changed if you press the button, but remember to move the mouse away from the button to see it's state (because of mouseOver and mouseOverOff)

Code:
// here's some sample code

        private static PANEL p;

        private static IEnumerable<ScheduleMethod> switchStateOfButtonUsingButtonState()
        {
            // first get old state... -1 means DON'T change state of the button
            double oldState =
                p.button_state(1, -1);

            // then switch the state, according to the return value
            if (oldState == 0)
            {
                // switch to on
                p.button_state(1, 1);
            }
            else
            {
                // switch to off
                p.button_state(1, 0);
            }

            yield break;
        }

        public static IEnumerable<ScheduleMethod> myMainMethod()
        {
            // use mouse !!
            EngVar.mouse_mode = 4;

            p =
                PANEL.pan_create(null, 1);
            p.SHOW = true;
            p.pos_x = 100;
            p.pos_y = 100;
            p.size_x = 500;
            p.size_y = 500;

            BMAP on =
                BMAP.bmap_createblack(200, 200, 32);
            on.bmap_fill(new Color(0, 255, 0), 50);
            BMAP off =
                BMAP.bmap_createblack(200, 200, 32);
            off.bmap_fill(new Color(0, 0, 255), 50);
            BMAP over =
                BMAP.bmap_createblack(200, 200, 32);
            over.bmap_fill(new Color(200, 200, 20), 50);

            p.pan_setbutton(
                0,
                2,
                50,
                50,
                on,
                off,
                over,
                over,
                null,
                null,
                null);

            EngVar.on_space +=
                switchStateOfButtonUsingButtonState;

            yield break;
        }

        static void Main(string[] args)
        {
            EngFun.engine_open(null, null);
            EngFun.level_load(null);

            Scheduler.StartScheduler(myMainMethod);
        }




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.1 - RELEASE [Re: Stromausfall] #380579
08/19/11 11:56
08/19/11 11:56
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 for checking.
It did not seem to return anything for me.
Will try again later.


A8.3x Commercial, AcknexWrapper and VS 2010 Express
&#9675;pararealist now.
Re: C# wrapper 2.3.1 - RELEASE [Re: pararealist] #380615
08/19/11 18:13
08/19/11 18:13
Joined: Dec 2008
Posts: 1,218
Germany
Rackscha Offline
Serious User
Rackscha  Offline
Serious User

Joined: Dec 2008
Posts: 1,218
Germany
tried to use it the firts time(copied helloworld example).

It crashes instantly in engine_open when calling NativeEngFun.engine_open

BatImageFormatException


Greets
Rackscha


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.1 - RELEASE [Re: Rackscha] #380617
08/19/11 18:45
08/19/11 18:45
Joined: Dec 2008
Posts: 1,218
Germany
Rackscha Offline
Serious User
Rackscha  Offline
Serious User

Joined: Dec 2008
Posts: 1,218
Germany
Damn it, express compiled an x64 assembly. Had to change platform target manually in projectfile >.<


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] #381025
08/23/11 14:32
08/23/11 14:32
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
a new version was uploaded (for Acknex 7.85.4 AND Acknex 8.20)
the update of the wrapper includes:

- missing model property for CONTACTs was added

here's the link:

AcknexWrapper_2_3_3_FOR_8_20_AND_7_85_4.zip


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] #381039
08/23/11 15:07
08/23/11 15:07
Joined: Dec 2008
Posts: 1,218
Germany
Rackscha Offline
Serious User
Rackscha  Offline
Serious User

Joined: Dec 2008
Posts: 1,218
Germany
eh...your wrapper is using SHOW for entities. But isnt the correct flag VISIBLE ?


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 16 of 23 1 2 14 15 16 17 18 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