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
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (degenerate_762, AndrewAMD), 877 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Snippet: Using c# to make an engine EXE #111518
02/09/07 21:29
02/09/07 21:29
Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
Rhuarc Offline OP
Expert
Rhuarc  Offline OP
Expert

Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
Just a code snippet that should allow you to open the engine through Acknex.DLL in a C# application .

Of course, this does not get the ENGINE_VARS struct yet, but that's easy to add .
Code:

[DllImport("acknex.dll")]
static extern void engine_open(char[] commandline,int callback);

public MyA6App()
{
InitializeComponent();
engine_open("level.wmb".ToCharArray(), 0);
}



The same proceedure for using Acknex.dll goes for the c# app, you've gotta run WED.EXE -p [wdl] [exePath]

Ooooh boy... *cracks fingers* I might actually get something done with this engine again. C++ was just too clumsy of an interface with the engine... I'm a fan of being able to use Windows.Forms inline with A6 .

-Rhuarc


I no longer post on these forums, keep in touch with me via:
Linkedin.com
My MSDN blog
Re: Snippet: Using c# to make an engine EXE [Re: Rhuarc] #111519
02/09/07 21:49
02/09/07 21:49
Joined: Aug 2005
Posts: 1,230
M
MichaelGale Offline
Serious User
MichaelGale  Offline
Serious User
M

Joined: Aug 2005
Posts: 1,230


Your friendly mod is at your service.
Re: Snippet: Using c# to make an engine EXE [Re: MichaelGale] #111520
02/09/07 22:38
02/09/07 22:38
Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
Rhuarc Offline OP
Expert
Rhuarc  Offline OP
Expert

Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
Nice... although this forgoes the need for any c++ intermediary plugin .


I no longer post on these forums, keep in touch with me via:
Linkedin.com
My MSDN blog
Re: Snippet: Using c# to make an engine EXE [Re: Rhuarc] #111521
02/09/07 22:48
02/09/07 22:48
Joined: Aug 2005
Posts: 1,230
M
MichaelGale Offline
Serious User
MichaelGale  Offline
Serious User
M

Joined: Aug 2005
Posts: 1,230
I know, I wrote it the way you did before, but I was going to try some things to get the acknex window handle, which didn't work with C# for some reason, so I tried C++ without success


Your friendly mod is at your service.
Re: Snippet: Using c# to make an engine EXE [Re: MichaelGale] #111522
02/10/07 02:39
02/10/07 02:39
Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
Rhuarc Offline OP
Expert
Rhuarc  Offline OP
Expert

Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
ENGINE_VARS *ev = engine_open("test.wdl",0);
HWND A6Window = ev->hwnd;


I no longer post on these forums, keep in touch with me via:
Linkedin.com
My MSDN blog
Re: Snippet: Using c# to make an engine EXE [Re: Rhuarc] #111523
02/10/07 09:59
02/10/07 09:59
Joined: Aug 2006
Posts: 652
Netherlands
bstudio Offline
User
bstudio  Offline
User

Joined: Aug 2006
Posts: 652
Netherlands
Yay, no need for stupid complex C++ window handling anymore, time for some C# coding


BASIC programmers never die, they GOSUB and don't RETURN.
Re: Snippet: Using c# to make an engine EXE [Re: bstudio] #111524
02/10/07 12:05
02/10/07 12:05
Joined: Aug 2005
Posts: 1,230
M
MichaelGale Offline
Serious User
MichaelGale  Offline
Serious User
M

Joined: Aug 2005
Posts: 1,230
@Rhuarc: Yes... but try to use it in C# and you'll see the problems. WinForms offers functions to convert these Window handles to the Form type, but produces an error if you run the application


Your friendly mod is at your service.
Re: Snippet: Using c# to make an engine EXE [Re: MichaelGale] #111525
02/10/07 17:05
02/10/07 17:05
Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
Rhuarc Offline OP
Expert
Rhuarc  Offline OP
Expert

Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
Quote:

@Rhuarc: Yes... but try to use it in C# and you'll see the problems. WinForms offers functions to convert these Window handles to the Form type, but produces an error if you run the application




Hmm... I haven't had any errors... but I'm not getting any results either. 'tis odd... although, I wonder if you can nab the d3d device and switch it with a device window within a c# app while the engine isn't looking- so it starts rendering there instead.. the problem is getting the unmanaged dx9 api to run in a c# app instead of managed dx9.... hmmm... memory hacks! (rofl)

-Rhuarc


I no longer post on these forums, keep in touch with me via:
Linkedin.com
My MSDN blog
Re: Snippet: Using c# to make an engine EXE [Re: Rhuarc] #111526
02/11/07 16:52
02/11/07 16:52
Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
Rhuarc Offline OP
Expert
Rhuarc  Offline OP
Expert

Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
EDIT: nevermind...


I no longer post on these forums, keep in touch with me via:
Linkedin.com
My MSDN blog
Re: Snippet: Using c# to make an engine EXE [Re: Rhuarc] #111527
02/13/07 04:22
02/13/07 04:22
Joined: Nov 2005
Posts: 94
Texas
3
3Dski Offline
Junior Member
3Dski  Offline
Junior Member
3

Joined: Nov 2005
Posts: 94
Texas
On this topic in general, though I'm an C veterin, I like simple and C# seems a lot more straight forward. I tried the simple case scenario of loading a level and it works just fine.

However, the true usage seems to require C# defs of the C structs; i.e., ENGINE_VARS* is not acceptable in C# without some work. There are also a large number of preprocessor macros that would have to be modelled on the C# side. I'm trying to decide whether its worth the time. The main thing that gripes me about the CScript is its seeming strange rules concerning functions, what can be passed in, and what you can do with them once they're pased in. On one hand, you want to avoid globals when possible, yet CScript cries for them! Lite-C will remove a good number of these odd restrictions and include latitude for user defined types (structs). Still, C# as an attractive alternative.

Have any of you been successful in your deeper investigations of its usage?

Page 1 of 2 1 2

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