0 registered members (),
1,094
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: C# wrapper 2.3.3 - RELEASE
[Re: Stromausfall]
#390926
01/05/12 22:58
01/05/12 22:58
|
Joined: Nov 2007
Posts: 2,568 Germany, BW, Stuttgart
MasterQ32
Expert
|
Expert
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
|
i currently don't know what Tags are for, I had a quick look and only found something about an object variable ? In which situations is such a tag used or beneficial ? )
you can store objects in "engine objects", not only two different double values (skill_x, skill_y)
|
|
|
Re: C# wrapper 2.3.3 - RELEASE
[Re: MasterQ32]
#390927
01/05/12 23:11
01/05/12 23:11
|
Joined: Dec 2002
Posts: 616 Austria
Stromausfall
OP
User
|
OP
User
Joined: Dec 2002
Posts: 616
Austria
|
ah okay ! thanks for the explanation ! Tags are not a good idea then, because think of the following scenario :
you assign an object as tag to entity#1, then you are c_tracing and hit entity#1 and want to access its tag object -> but this won't work, because the object that you retrieve via c_trace is a new object (although it points to the same memory location and thus 'is' the entity#1) and doesn't have a tag !
edit : a 'tag' could be simualted simply by a "Dictionary<IntPtr, object> tagObjects" where you can get the unique entity identifier by someEntity.getIntPtr() !
Last edited by Stromausfall; 01/05/12 23:15.
|
|
|
Re: C# wrapper 2.3.3 - RELEASE
[Re: Stromausfall]
#390960
01/06/12 12:03
01/06/12 12:03
|
Joined: Dec 2008
Posts: 1,218 Germany
Rackscha
Serious User
|
Serious User
Joined: Dec 2008
Posts: 1,218
Germany
|
@MasterQ32: Some good ideas. Especially like the idea of removing prefixes and adding constructors. C# is not lite-c and doesnt have its limitations. :|
MY Website with news of my projects: (for example my current Muliplayer Bomberman, GenesisPrecompiler for LiteC and TileMaster, an easy to use Tile editor) Sparetime-Development
|
|
|
Re: C# wrapper 2.3.3 - RELEASE
[Re: Rackscha]
#393192
02/01/12 12:04
02/01/12 12:04
|
Joined: Oct 2007
Posts: 5,210 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
|
@Stromausfall: Thanks for the great wrapper again. Exactly what i need right now. I need to embed engine in a form, there is an example in your site, but i figured out a simpler approach:
EngFun.video_window(null, null, 256, null);
EngFun.video_set(panelEngine.Width,panelEngine.Height,0,0);
EngVar.hWndTarget = panelEngine.Handle;
EngVar.hWndParent = this.Handle;
you just have to make sure you set EngVar.d3d_lockable to 1 after engine_open and before first frame. Then use the code i posted above AFTER first frame.
3333333333
|
|
|
Re: C# wrapper 2.3.3 - RELEASE
[Re: Stromausfall]
#393605
02/05/12 12:29
02/05/12 12:29
|
Joined: Oct 2007
Posts: 5,210 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
|
adding EngFun.on_message(or something like that) to form's message loop should solve that problem in 1 line of code.
3333333333
|
|
|
Re: C# wrapper 2.3.3 - RELEASE
[Re: Quad]
#394745
02/16/12 10:02
02/16/12 10:02
|
Joined: Oct 2007
Posts: 5,210 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
|
@Stromausfall,
How do i differantiate between events in the event function? I have both enable frame, click and impact.
3333333333
|
|
|
Re: C# wrapper 2.3.3 - RELEASE
[Re: Quad]
#394793
02/16/12 16:42
02/16/12 16:42
|
Joined: Dec 2002
Posts: 616 Austria
Stromausfall
OP
User
|
OP
User
Joined: Dec 2002
Posts: 616
Austria
|
via event_frame ! I've made a small example that shows how to use it ! you'll need the c# project to be a console project to view the output (when an event is triggered..) ! You won't need any models or stuff like that for the project to work, only the code !
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AcknexWrapper;
namespace eventExample
{
class Program
{
private static IEnumerable<ScheduleMethod> testEntity2Method(IntPtr e)
{
ENTITY me =
ENTITY.createFromPointer(e);
Vector originalPos =
new Vector(me.xyz);
double originalYPos =
me.y;
// cube should be red
me.LIGHT = true;
me.red = 255;
me.blue = 0;
me.green = 0;
me.lightrange = 0;
// low push value
me.push = 10;
double timeValue = 0;
double newYForce;
while (true)
{
// increase by 1 every second and limit to 0...1.999
timeValue += EngVar.time_step / 16;
timeValue %= 2;
if (timeValue > 1.5)
{
// 1/4 of time, move away
newYForce = 2.5 * EngVar.time_step;
}
else
{
// 3/4 of time move to cube -> to cause an impact !
newYForce = -2.5 * EngVar.time_step;
}
// c_move to new position to trigger impact event !
me.c_move(
new Vector(0, newYForce, 0),
new Vector(0, 0, 0),
Flags.GLIDE);
yield return 1;
}
}
private static IEnumerable<ScheduleMethod> testEntityMethodEvent()
{
if (EngVar.event_type == Flags.EVENT_CLICK)
{
Console.WriteLine("Flags.EVENT_CLICK");
}
if (EngVar.event_type == Flags.EVENT_IMPACT)
{
Console.WriteLine("Flags.EVENT_IMPACT");
}
if (EngVar.event_type == Flags.EVENT_FRAME)
{
Console.WriteLine("Flags.EVENT_FRAME");
}
// there's nothing to wait for...
yield break;
}
private static IEnumerable<ScheduleMethod> testEntityMethod(IntPtr e)
{
ENTITY me =
ENTITY.createFromPointer(e);
// cube should be blue
me.LIGHT = true;
me.red = 0;
me.blue = 255;
me.green = 0;
me.lightrange = 0;
// enable some events...
me.ENABLE_FRAME = true;
me.ENABLE_IMPACT = true;
me.ENABLE_CLICK = true;
// high push value
me.push = 1000;
me.event_ = testEntityMethodEvent;
// nothing to wait for here...
yield break;
}
//the main method, called by the scheduler
private static IEnumerable<ScheduleMethod> myMainMethod()
{
// limit frame rate
EngVar.fps_max = 60;
// load an empty level
EngFun.level_load(null);
// use mouse
EngVar.mouse_mode = 4;
ENTITY testEntity =
ENTITY.ent_create("_CUBE.MDL", new Vector(200, -25, 0), testEntityMethod);
ENTITY testEntity2 =
ENTITY.ent_create("_CUBE.MDL", new Vector(200, 25, 0), testEntity2Method);
yield return ScheduleMethod.wait(1);
}
static void Main(string[] args)
{
//open the engine
EngFun.engine_open(null, null);
//start the scheduler
Scheduler.StartScheduler(myMainMethod);
}
}
}
Last edited by Stromausfall; 02/16/12 16:48.
|
|
|
Re: C# wrapper 2.3.3 - RELEASE
[Re: Quad]
#394875
02/17/12 10:19
02/17/12 10:19
|
Joined: Oct 2007
Posts: 5,210 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
|
in case of testEntityMethodEvent, how do i use the entity skills? is there a way to reach that ent?
Scratch that. EngVar.me
Last edited by Quad; 02/17/12 10:20.
3333333333
|
|
|
|