Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SetRasterCallback on C# / BeefLang
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#.
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:
Is it the same method for the latest Tilengine version?
It should be, yes. Isn't it working for you?
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.
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.
In BeefLang, it doesn't work, that's weird

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.layerID = layerID;

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

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


Attached Files Thumbnail(s)
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...

Forum Jump:

Users browsing this thread: 1 Guest(s)