1 registered members (AndrewAMD),
1,306
guests, and 3
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
[C#] AckNET
#443924
07/27/14 23:38
07/27/14 23:38
|
Joined: Nov 2007
Posts: 2,568 Germany, BW, Stuttgart
MasterQ32
OP
Expert
|
OP
Expert
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
|
Hey guys! Just started a new project today: AckNETAckNET is my try to create another C# wrapper for Gamestudio. I don't want to create a 1:1 wrapper but a logical wrapper that allows you programming in the normal C# style. You can get the current version of the wrapper at GitHub: https://github.com/MasterQ32/AckNET/Please note that the wrapper is in a very early stage (Just started this afternoon) but has already most of the types (Entity, Material, View, Event and Bitmap) wrapped. Functions are currently missing as well as some global variables. The wrapper will be developed on feature request or if I am missing features myself. As the wrapper is a base for another project, it will get most of the common functions in early time but the lesser common functions will stay untouched. "var" is wrapped with a custom struct named ackvar. It has an implicit operator casting it to and from double, but casting it to bool or int works with explicit casts (this allows better usage in conditionals) Here is a small example using C# vNext:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AckNET.EngineVars;
namespace AckNET.Test
{
class Program
{
static void Main(string[] args)
{
Acknex.Open("-nx 200");
Console.WriteLine("Using version {0}", EngineVars.Version);
OnTab = (x) => { Console.WriteLine("Pressed [TAB]"); return 0; };
MouseMode = 3;
Level.Load("");
var ent = new Entity("cargo.mdl", new Vector(550.0, 0.0, 0.0));
var snd = new Sound("beep.wav");
OnSpace = (x) => { snd.Play(100, 0); return 0; };
while (Acknex.Frame())
{
if (ent == EngineVars.MouseEnt)
{
ent.Pan += 1.5 * TimeStep;
}
Camera.Pan += (KeyCul - KeyCur) * TimeStep;
Console.WriteLine("{0} - {1} -> {2}", KeyCul, KeyCur, (KeyCul - KeyCur));
if ((bool)MouseLeft)
{
Console.WriteLine("{0}:{1}:{2}", (int)SysHours, (int)SysMinutes, (int)SysSeconds);
}
if ((bool)KeyEsc)
{
break;
}
}
Acknex.Close();
}
}
}
Regards Felix
|
|
|
Re: [C#] AckNET
[Re: MasterQ32]
#443928
07/28/14 06:16
07/28/14 06:16
|
Joined: Aug 2003
Posts: 7,439 Red Dwarf
Michael_Schwarz
Senior Expert
|
Senior Expert
Joined: Aug 2003
Posts: 7,439
Red Dwarf
|
KeyCul, KeyCur, => KeyCuL, KeyCuR, to emphasize the direction
"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku
|
|
|
Re: [C#] AckNET
[Re: Redeemer]
#444059
07/29/14 21:59
07/29/14 21:59
|
Joined: Nov 2007
Posts: 2,568 Germany, BW, Stuttgart
MasterQ32
OP
Expert
|
OP
Expert
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
|
Made commit #11 right now. A important feature was added right now:
if (ReferenceEquals(ent, EngineVars.MouseEnt))
{
ent.Pan += 1.5 * TimeStep;
}
All engine objects have now C# reference equality. This is useful for any referencing and won't cause problems with external libraries.
|
|
|
Re: [C#] AckNET
[Re: MasterQ32]
#444107
07/30/14 12:57
07/30/14 12:57
|
Joined: Nov 2007
Posts: 2,568 Germany, BW, Stuttgart
MasterQ32
OP
Expert
|
OP
Expert
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
|
Added first c_trace version and a simple fluent interface to vector.
private void EngineVars_OnMouseLeft(object sender, EngineEventArgs e)
{
if (Collision.Trace(
EngineVars.MousePos.SetZ(0).ForScreen(EngineVars.Camera),
EngineVars.MousePos.SetZ(1000).ForScreen(EngineVars.Camera),
CollisionFlags.UsePolygon | CollisionFlags.IgnoreSprites | CollisionFlags.IgnorePassable | CollisionFlags.IgnorePassents,
out ackvar distance))
{
clicks.Add(EngineVars.Hit.Position);
}
}
|
|
|
|