|
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
Serious User
|
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...
using System.Runtime.InteropServices;
Now you need to define the Win32 constants and functions...
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...
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 1.1.0
[Re: Stromausfall]
#280859
07/24/09 12:47
07/24/09 12:47
|
Joined: Dec 2002
Posts: 616 Austria
Stromausfall
OP
User
|
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.
|
|
|
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
OP
User
|
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 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.
|
|
|
|