Gamestudio Links
Zorro Links
Newest Posts
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Newbie Questions
by AndrewAMD. 12/04/23 11:14
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
2 registered members (TipmyPip, izorro), 556 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
.NET dll #35792
11/08/04 22:51
11/08/04 22:51
Joined: Nov 2004
Posts: 42
killkolor Offline OP
Newbie
killkolor  Offline OP
Newbie

Joined: Nov 2004
Posts: 42
hi

i am new to 3d game studio and have to write some external dll's for data collecting (like xml reading). since i programmed mostly in c# .NET i would like to use the .NET functions. does anybody know if this is possible within the acknex sdk?

thanks killkolor

Re: .NET dll [Re: killkolor] #35793
11/09/04 01:51
11/09/04 01:51
Joined: Nov 2004
Posts: 42
killkolor Offline OP
Newbie
killkolor  Offline OP
Newbie

Joined: Nov 2004
Posts: 42
if anybody is interested, i got the answer myself. it's unfortunately not possible, you can bind a .NET dll into a MFC or COM dll, but the whole thing will only work if the process, that is running the dll's (so 3d game studio) is .NET, which it isn't. guess i have to stick with msxml :-(

Re: .NET dll [Re: killkolor] #35794
11/09/04 05:17
11/09/04 05:17
Joined: Oct 2004
Posts: 1,856
TheExpert Offline
Senior Developer
TheExpert  Offline
Senior Developer

Joined: Oct 2004
Posts: 1,856
yes i think i will post that in engine future request !

cause creating a XML reader /writer or other things are easy in .net ,
and use them with 3DGS would be very very very great thing !

you're sure we can't call Coms or Dlls written with .net !

the pro version will have possibility to be programmed in .net ,
perhaps the comercial will allow us use .net Dll / coms no ?

Re: .NET dll [Re: killkolor] #35795
11/09/04 05:46
11/09/04 05:46

A
Anonymous
Unregistered
Anonymous
Unregistered
A



I agree. I would like to code a "colored" panel for 3DGS using C# but I can only do this in C++. Please note that speaking of colored panel, I mean something like this:

Code:
using Vtx2D = Microsoft.DirectX.Direct3D.CustomVertex.TransformedColored;
// ...
void Render2D()
{
DrawPanel(0, 20, 160, 160, Color.Green);
DrawPanel(130, 120, 160, 160, Color.Yellow);

DrawHorizontalGradientPanel(400, 120, 300, 190,
Color.FromArgb(160, 20, 67),
Color.FromArgb(20, 20, 200));

DrawVerticalGradientPanel(300, 20, 300, 190,
Color.FromArgb(0, 20, 67),
Color.FromArgb(100, 250, 200));

DrawQuadGradientPanel(
0,
384,
1024,
384,
Color.DarkBlue, Color.DarkGreen, Color.DarkGreen, Color.FromArgb(0, 32, 0));
}

void DrawPanel(float x, float y, float scale_x, float scale_y,
Color c)
{
GraphicsStream stm = panelVB.Lock(0, 0, 0);

int i = 0;

panel[i++] = new Vtx2D(
x, y, 0, 0, c.ToArgb());
panel[i++] = new Vtx2D(
scale_x + x, y, 0, 0, c.ToArgb());
panel[i++] = new Vtx2D(
scale_x + x, scale_y + y, 0, 0, c.ToArgb());
panel[i++] = new Vtx2D(
scale_x + x, scale_y + y, 0, 0, c.ToArgb());
panel[i++] = new Vtx2D(
x, scale_y + y, 0, 0, c.ToArgb());
panel[i++] = new Vtx2D(
x, y, 0, 0, c.ToArgb());

stm.Write(panel);
panelVB.Unlock();
deviceMultimedia.D3D9Device.SetStreamSource(0, panelVB, 0);
deviceMultimedia.D3D9Device.VertexFormat = Vtx2D.Format;
deviceMultimedia.D3D9Device.DrawPrimitives(
PrimitiveType.TriangleList, 0, panelFaces);
}

void DrawVerticalGradientPanel(float x, float y, float scale_x, float scale_y,
Color c1, Color c2)
{
GraphicsStream stm = panelVB.Lock(0, 0, 0);

int i = 0;

panel[i++] = new Vtx2D(
x, y, 0, 0, c1.ToArgb());
panel[i++] = new Vtx2D(
scale_x + x, y, 0, 0, c1.ToArgb());
panel[i++] = new Vtx2D(
scale_x + x, scale_y + y, 0, 0, c2.ToArgb());
panel[i++] = new Vtx2D(
scale_x + x, scale_y + y, 0, 0, c2.ToArgb());
panel[i++] = new Vtx2D(
x, scale_y + y, 0, 0, c2.ToArgb());
panel[i++] = new Vtx2D(
x, y, 0, 0, c1.ToArgb());

stm.Write(panel);
panelVB.Unlock();
deviceMultimedia.D3D9Device.SetStreamSource(0, panelVB, 0);
deviceMultimedia.D3D9Device.VertexFormat = Vtx2D.Format;
deviceMultimedia.D3D9Device.DrawPrimitives(
PrimitiveType.TriangleList, 0, panelFaces);
}

void DrawHorizontalGradientPanel(float x, float y, float scale_x, float scale_y,
Color c1, Color c2)
{
GraphicsStream stm = panelVB.Lock(0, 0, 0);

int i = 0;

panel[i++] = new Vtx2D(
x, y, 0, 0, c1.ToArgb());
panel[i++] = new Vtx2D(
scale_x + x, y, 0, 0, c2.ToArgb());
panel[i++] = new Vtx2D(
scale_x + x, scale_y + y, 0, 0, c2.ToArgb());
panel[i++] = new Vtx2D(
scale_x + x, scale_y + y, 0, 0, c2.ToArgb());
panel[i++] = new Vtx2D(
x, scale_y + y, 0, 0, c1.ToArgb());
panel[i++] = new Vtx2D(
x, y, 0, 0, c1.ToArgb());

stm.Write(panel);
panelVB.Unlock();
deviceMultimedia.D3D9Device.SetStreamSource(0, panelVB, 0);
deviceMultimedia.D3D9Device.VertexFormat = Vtx2D.Format;
deviceMultimedia.D3D9Device.DrawPrimitives(
PrimitiveType.TriangleList, 0, panelFaces);
}

void DrawQuadGradientPanel(float x, float y, float scale_x, float scale_y,
Color c1, Color c2, Color c3, Color c4)
{
GraphicsStream stm;
int i;

int CenterR = (c1.R + c2.R + c3.R + c4.R) / (17 / 4);

int CenterG = (c1.G + c2.G + c3.G + c4.G) / (17 / 4);

int CenterB = (c1.B + c2.B + c3.B + c4.B) / (17 / 4);

Color cCenter = Color.FromArgb(CenterR, CenterG, CenterB);

stm = panelVB.Lock(0, 0, 0);

i = 0;

panel[i++] = new Vtx2D(
x, y, 0, 0, c1.ToArgb());
panel[i++] = new Vtx2D(
scale_x + x, y, 0, 0, c2.ToArgb());
panel[i++] = new Vtx2D(
(scale_x / 2) + x, (scale_y / 2) + y, 0, 0, cCenter.ToArgb());
panel[i++] = new Vtx2D(
scale_x + x, y, 0, 0, c2.ToArgb());
panel[i++] = new Vtx2D(
scale_x + x, scale_y + y, 0, 0, c4.ToArgb());
panel[i++] = new Vtx2D(
(scale_x / 2) + x, (scale_y / 2) + y, 0, 0, cCenter.ToArgb());

stm.Write(panel);
panelVB.Unlock();

deviceMultimedia.D3D9Device.SetStreamSource(0, panelVB, 0);
deviceMultimedia.D3D9Device.VertexFormat = Vtx2D.Format;
deviceMultimedia.D3D9Device.DrawPrimitives(
PrimitiveType.TriangleList, 0, panelFaces);

stm = panelVB.Lock(0, 0, 0);

i = 0;

panel[i++] = new Vtx2D(
scale_x + x, scale_y + y, 0, 0, c4.ToArgb());
panel[i++] = new Vtx2D(
x, scale_y + y, 0, 0, c3.ToArgb());
panel[i++] = new Vtx2D(
(scale_x / 2) + x, (scale_y / 2) + y, 0, 0, cCenter.ToArgb());
panel[i++] = new Vtx2D(
x, scale_y + y, 0, 0, c3.ToArgb());
panel[i++] = new Vtx2D(
x, y, 0, 0, c1.ToArgb());
panel[i++] = new Vtx2D(
(scale_x / 2) + x, (scale_y / 2) + y, 0, 0, cCenter.ToArgb());

stm.Write(panel);
panelVB.Unlock();

deviceMultimedia.D3D9Device.SetStreamSource(0, panelVB, 0);
deviceMultimedia.D3D9Device.VertexFormat = Vtx2D.Format;
deviceMultimedia.D3D9Device.DrawPrimitives(
PrimitiveType.TriangleList, 0, panelFaces);
}



...which look like this:
[image]/gpdotnet.worldispnetwork.com/images/MyImages/ColoredPanels.png[/image]

Re: .NET dll #35796
11/09/04 18:40
11/09/04 18:40
Joined: Nov 2004
Posts: 42
killkolor Offline OP
Newbie
killkolor  Offline OP
Newbie

Joined: Nov 2004
Posts: 42
well maybe rushed to conclusions. it's possible to bind the .NET framework as a whole:

#using <mscorlib.dll>
// and then
using namespace System;
// or
using namespace System::Xml;

to get this working you have to use managed extensions (project properties / Use managed extensions / yes). however i still get an error "d:\Conitec 3D Gamestudio A6 Ver 6.22 Pro (Final)\dllsdk\Ackdll.cpp(64): error C3169: 'doc' : cannot declare a managed object or a __gc pointer within an unmanaged function"
guess i have to get a bit further into this whole managed/unmanaged stuff, but i will surely post it here, if i find out anything useful.

Re: .NET dll [Re: killkolor] #35797
11/09/04 20:18
11/09/04 20:18
Joined: Nov 2004
Posts: 42
killkolor Offline OP
Newbie
killkolor  Offline OP
Newbie

Joined: Nov 2004
Posts: 42
ok. i managed to use the .NET Xml namespace inside my plugin dll. here is what i did:

goto project/properties and set use managed extensions to yes
set #pragma managed on top of your *.cpp
// the following code imports the xml namespace
#using <mscorlib.dll>
using namespace System;
using namespace System::Xml;
// if System::Xml is not recognized by IntelliSense you may have to add it as a
// reference via Add Reference... / .NET / System.Xml.dll

// and now in the function...
DLLFUNC fixed XMLReader (void)
{
XmlDocument *doc = new XmlDocument();
XmlNode *root;
doc->Load("demotest.xml");

root = doc->SelectSingleNode("ToDo/Item");

XmlNodeReader *Reader = new XmlNodeReader( root );
System::String *sometest;
while ( Reader->Read() )
{
if ( Reader->IsStartElement("bold") )
{
sometest = Reader->ReadElementString ();
}
return 1;
}

unfortunately the IntelliSense doesn't work for initiated pointers. if you know something about this, i'd be glad to know.


Moderated by  HeelX, Spirit 

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