Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SetRasterCallback on C# / BeefLang
#1
Hello! I'm trying Tilengine on BeefLang by curiosity and I'm trying to do raster effects.
The thing is when I execute SetRasterCallback, it asks for a videocallback :

private static extern void TLN_SetRasterCallback(VideoCallback callback);

I have no idea how to use it. Do you know how to use it please? It's the same thing for C#.
Reply
#2
Hi!
You can get examples on CsTilengine, the C# binding for Tilengine. This line of the "platformer.cs" sample shows how to setup the raster callback:
https://github.com/megamarc/CsTilengine/...mer.cs#L75
Reply
#3
Is it the same method for the latest Tilengine version?
Reply
#4
It should be, yes. Isn't it working for you?
Reply
#5
because in the Java binding, I don't need to do that. It's just 

tln.SetRasterCallback(object, string methodname);

and after, just create a method public void methodname(int line) and here you go!


It's much simpler.
Reply
#6
Java with JNI behaves different than other languages, you pass the string with the name of the Java method to invoke. The hard work is done inside the JNI bridge.
In other languages -like C#- you have to create the callback method as a type of object. In fact it's simpler that the Java way.
Reply
#7
In BeefLang, it doesn't work, that's weird

Code:
using Tilengine;
using System;
using TLN.Data;
using TLN.Enums;
using TLN.Types;

namespace TestTilengine
{
class RasterEffects
{
private String rasterMode ~ delete _;
private int layerID;



public this(String rasterMode, int layerID)
{
this.rasterMode = new String(rasterMode);
this.rasterMode.ToLower();
this.layerID = layerID;
}

// VideoCallback callback = new VideoCallback(MyRasterEffects);
TLN.VideoCallback callback = new TLN.VideoCallback(myRasterEffect);
TLN.SetRasterCallback(callback);


public static void myRasterEffect(int line);
{
Tilengine.TLN.SetBGColor((uint8) line, (uint8) line, (uint8) line);
}

}
}


Attached Files Thumbnail(s)
   
Reply
#8
I don't know Beef, so I can't give support about it. As I've read, it's originally based on C#, but it has some key differences, so it is NOT C#. Maybe you've hit one of those differences...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)