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
5 registered members (AndrewAMD, monk12, TipmyPip, Quad, aliswee), 1,029 guests, and 6 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 6 of 32 1 2 4 5 6 7 8 31 32
Re: C# wrapper - RELEASE [Re: pararealist] #280820
07/24/09 10:50
07/24/09 10:50
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
Now that's great news i'd say ^^


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] #280835
07/24/09 11:46
07/24/09 11:46
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
What am i saying? It isn't restricted to only MDI Forms. .Net controls are essentially windows, and so also expose a handle. I've now got the engine rendering into a Panel control. This gives you a bit more control.

Well here is how you do it...

First you need the Interop namespace...
Code:
using System.Runtime.InteropServices;


Now you need to define the Win32 constants and functions...
Code:
const int WS_VISIBLE = 0x10000000;
const UInt32 SWP_SHOWWINDOW = 0x0040;

[DllImport("user32.dll")]
static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

[DllImport("user32.dll")]
static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);

[DllImport("user32.dll")]
static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);



Now basically you create a control inside your form. A Panel is a simple one.
Then you call these 3 functions. You should use the Form's 'Shown' event to execute this...

Code:
a7.EngFun.engine_open(null);
a7.EngFun.engine_frame(); // Required else crash (D3D isnt loaded yet)

SetParent(a7.EngVar.hWnd, MyPanel.Handle);
SetWindowLong(a7.EngVar.hWnd, -16, WS_VISIBLE);
SetWindowPos(a7.EngVar.hWnd, (IntPtr)0, 0, 0, MyPanel.Width, MyPanel.Height,
SWP_SHOWWINDOW);

while (a7.EngFun.engine_frame() != 0)
{

}


That's pretty much it. I've created my own control derived from Panel, and wrapped everything inside it.

There are a couple of issues with setting focus to the parent that i'm gonna look into later on today, and i'll update this post.

BTW > WTF is wrong with the forum? Everytime i type something it jusmps to the first line? I've noticed this for a while but now it's getting really annoying!!!

Last edited by DJBMASTER; 07/24/09 12:02.
Re: C# wrapper - RELEASE [Re: DJBMASTER] #280842
07/24/09 12:13
07/24/09 12:13
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Another good thing about this method is that is seems that 'acknex.exe' isn't registered in Task Manager. Therefore the engine can't be terminated accidently from outside the application.

Also, by rendering into a Panel, you can set it at the back of the Z-order list by using 'Bring-to-front' and 'Send-to-back'. This allows you to define other controls on top of the panel which can recieve focus.

I'm currently controlling the sunlight of the engine by using a TrackBar, LOL.

Re: C# wrapper - RELEASE 1.1.0 [Re: Stromausfall] #280859
07/24/09 12:47
07/24/09 12:47
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
A new version of the AcknexWrapper has been releases, Version 1.1.0.1 !
The change list is in the manual of the AcknexWrapper.
get the AcknexWrapper here : http://acknexwrapper.matthias-auer.net

Unfortunately it is not backwards compatible to Version 1.0, because some names changed.

Last edited by Stromausfall; 07/24/09 17:12.

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 1.1.0 [Re: DJBMASTER] #280860
07/24/09 12:48
07/24/09 12:48
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
Thank you DJBMASTER, for you great contribution, i guess with your contribution c# got a lot more interesting for some users!


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 1.1.0 [Re: Stromausfall] #280863
07/24/09 13:09
07/24/09 13:09
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Thanks for the update. No problem.

Would you like me to create a sample showing loading the engine into a form and interacting with it? You could then add this to the samples zip. Saves people having to copy all the code from the forum.

Re: C# wrapper - RELEASE 1.1.0 [Re: DJBMASTER] #280896
07/24/09 15:33
07/24/09 15:33
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
That would be great and help many people !


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 1.1.0 [Re: Stromausfall] #280899
07/24/09 15:47
07/24/09 15:47
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Wow, i'm impressed with how much you've updated, Excellent work!!!

I'm having trouble with EngVar.screen_color.I'm trying to change the background colour of the engine by specifying r,g and b values...

I've tried using EngVar.screen_color.red.IntValue = 255; but i keep getting a 'unable to cast AcknexWrapper.Vector to AcknexWrapper.Color' error.

Re: C# wrapper - RELEASE 1.1.0 [Re: DJBMASTER] #280905
07/24/09 16:02
07/24/09 16:02
Joined: Feb 2007
Posts: 353
A
amy Offline
Senior Member
amy  Offline
Senior Member
A

Joined: Feb 2007
Posts: 353
Nice improvements! The scheduler looks promising. I still don't like how vars have to be handled. It must be possible to solve this much more elegantly somehow?

Re: C# wrapper - RELEASE 1.1.0 [Re: amy] #280915
07/24/09 16:41
07/24/09 16:41
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline OP
User
Stromausfall  Offline OP
User

Joined: Dec 2002
Posts: 616
Austria
Thank you ^^
@DJBMASTER: yepp that's a bug i will fix it.
@amy: i also would prefer another kind of handling for vars, but implicit operator won't work, because it can only create a new object afaik. The only other possiblity would be operator overloading, but i think that one can't overload " = " which is essential.
But i would like to keep the var object as it is now, because it allows to pass and use pointers - but maybe another way would also be possible, like something with lambda stuff like ventilator mentionend smirk

But on the other hand this way you have more freedom of how to use Var variables, because you can pass reference. Yes the handling may be not as good as in lite-c but Var is an object and thus handled like an object - which makes sense ^^


Last edited by Stromausfall; 07/24/09 20:06.

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
Page 6 of 32 1 2 4 5 6 7 8 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