2 registered members (Akow, tomaslolo),
1,536
guests, and 12
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: C# wrapper - RELEASE
[Re: Stromausfall]
#278061
07/11/09 23:30
07/11/09 23:30
|
Joined: Dec 2006
Posts: 434 UK,Terra, SolarSystem, Milky W...
pararealist
Senior Member
|
Senior Member
Joined: Dec 2006
Posts: 434
UK,Terra, SolarSystem, Milky W...
|
@Stromausfal
Hi, i am looking for the acknex var texname.
a7.EngVar.hit. has no texname ? or else how to find/use it ?
thanks.
MOD: delete this
Last edited by pararealist; 07/14/09 00:11.
A8.3x Commercial, AcknexWrapper and VS 2010 Express ○pararealist now.
|
|
|
Re: C# wrapper - RELEASE
[Re: pararealist]
#278511
07/14/09 09:40
07/14/09 09:40
|
Joined: Dec 2002
Posts: 616 Austria
Stromausfall
OP
User
|
OP
User
Joined: Dec 2002
Posts: 616
Austria
|
Hi ! currrently hit is only a IntPtr that first needs to be cast to an EngObj.Contact (maybe i'm able to change this for the next release^^)! here's an example :
String texname = ((a7.EngObj.CONTACT)a7.EngVar.hit).texname;
-> this should work!
cheers, Matthias
Last edited by Stromausfall; 07/14/09 09:41.
|
|
|
Re: C# wrapper - RELEASE
[Re: Stromausfall]
#279289
07/17/09 08:18
07/17/09 08:18
|
Joined: Dec 2006
Posts: 434 UK,Terra, SolarSystem, Milky W...
pararealist
Senior Member
|
Senior Member
Joined: Dec 2006
Posts: 434
UK,Terra, SolarSystem, Milky W...
|
While playing with a7Wrapper: If you use this loop
while (a7.EngFun.engine_frame() != 0)
{
UpdateAcknex(); // update your acknex stuff here
Application.DoEvents(); //Add this here
}
//set your acknex window to size
//get the x/y pos
int left = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Left;
int top = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Top +
Program.gamePlayForm.Height;
//get the w/h
int right = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Right;
int bottom = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Bottom - top;
//place the position (left,top)/ (right/bottom) in vectors
a7.Vector vWinPos = new a7.Vector((a7.Var)left, (a7.Var)top, (a7.Var)0);
a7.Vector vWinSize = new a7.Vector((a7.Var)right, (a7.Var)bottom, (a7.Var)0);
//set title
String winTitle = "Engine: ";
//place the window at position (left,top)
a7.EngFun.video_window(vWinPos, vWinSize, (a7.Var)2, winTitle);
//and dont forget to close acknex engine in your form exit
//QUIT
private void quitToolStripMenuItem_Click1(object sender, EventArgs e)
{
//close engine
if(a7.EngFun.engine_frame() != 0)
a7.EngFun.engine_close();
//and exit
Application.Exit();
}
Then you can have forms as well as the acknex window working together like Gimp windows does. // forgot this: Also use this
while(1)
{
... other stuff
/// this is equivalent to wait(1)
a7.EngFun.engine_frame(); break;
}
Last edited by pararealist; 07/17/09 09:54.
A8.3x Commercial, AcknexWrapper and VS 2010 Express ○pararealist now.
|
|
|
Re: C# wrapper - RELEASE
[Re: Stromausfall]
#280183
07/21/09 11:28
07/21/09 11:28
|
Joined: Nov 2007
Posts: 1,143 United Kingdom
DJBMASTER
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,143
United Kingdom
|
Is a7.EngFun.engine_frame() analagous to wait(1)? I'm experimenting with window handles and the Win32 API and i'm using vars such as a7.EngVar.hWnd and a7.EngVar.hWndTarget. The manual states that these variables only become available after 1 frame, so wait(1) is needed. I'm using the API call GetWindowText to test if I can get the text of the engine Hwnd...
[DllImport("user32.dll", EntryPoint = "GetWindowText", CharSet = CharSet.Ansi)]
public static extern bool GetWindowText(IntPtr hWnd, [OutAttribute()] StringBuilder strNewWindowName,
Int32 maxCharCount);
static void Main(string[] args)
{
a7.EngFun.engine_open(null);
a7.EngFun.engine_frame(); // acts as wait(1) ???
StringBuilder sb = new StringBuilder(256);
GetWindowText(a7.EngVar.hWnd, sb, sb.Capacity);
MessageBox.Show(sb.ToString());
while (a7.EngFun.engine_frame() != 0)
{
}
}
}
...But every time the string buffer is empty. I've tested this code on other applications like notepad.exe, by getting it's handle, and it returns the name in the title bar no problems. So is there a problem with my code? Or are the engine vars not functioning properly?
|
|
|
Re: C# wrapper - RELEASE
[Re: Stromausfall]
#280759
07/24/09 06:48
07/24/09 06:48
|
Joined: Nov 2007
Posts: 1,143 United Kingdom
DJBMASTER
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,143
United Kingdom
|
Hi, Ok i was wondering if the form rendering issue was due to the difference of a C# form. I decided to investigate by not using a C# form and creating a form programmatically from WinAPI.
This is exactly the same process that C++ uses, and I can get the engine to target render in c++ no problems.
I used exactly the same methods/properties I used in C++ and the window appears no problem but still the engine wont render into it.
From this i can only conclude that it is the fault of the wrapper. It might not be marshalling the type correctly or something.
I know you have no experience with C# forms Stromausfall, but if you use WinAPI you will see the engine still wont render.
Thanks.
Last edited by DJBMASTER; 07/24/09 06:48.
|
|
|
|