This repository has been archived by the owner on Feb 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
185 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,13 +20,31 @@ DartGodot is a Dart language Game Framework for the Godot game engine. | |
DartGodot is still in the very early stages of development. APIs can and will change (now is the time to make suggestions!). Important features are missing.There is no Documentation for now. Please don't build any serious projects in DartGodot unless you are prepared to be broken by api changes constantly. | ||
|
||
# Development Status | ||
|
||
<del> | ||
Im currently working on a Dart2Godot crossplatform compiler to use dart in godot without pain and hard configs | ||
</del> | ||
|
||
compiler is done | ||
|
||
Next step is implementing api , its easy but its too time consuming | ||
Im currently working on implementing api , its easy but its too time consuming | ||
|
||
Support me by giving Star :) | ||
|
||
# Getting Started | ||
1. you must use Mono version (C# support) of Godot | ||
2. add below package to your .csproj | ||
|
||
<PackageReference Include="Jint"> | ||
<Version>3.0.0-beta-1828</Version> | ||
</PackageReference> | ||
3. clone or download this project (DartGodot) | ||
4. see scripts folder in dartgodot project | ||
5. edit or add scripts inside scripts folder | ||
6. run compiler.dart (with command line) | ||
7. copy compiled folder to your godot project files (you can add DartGodot folder to your godot project files for easier use and removing this step) | ||
8. it is done :) you can use C# files in Godot | ||
|
||
|
||
# Be a Project Sponsor | ||
|
||
talk to me : [email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Godot; | ||
|
||
public class Node : Godot.Node | ||
{ | ||
private DartConnector _dartConnector; | ||
|
||
public override void _EnterTree() | ||
{ | ||
base._EnterTree(); | ||
_dartConnector = new DartConnector("data\\TestArea.d2g"); | ||
_dartConnector.EnterTree(); | ||
} | ||
public override void _Ready() | ||
{ | ||
_dartConnector.Ready(); | ||
} | ||
public override void _Process(float delta) | ||
{ | ||
_dartConnector.Process(delta); | ||
} | ||
public override void _PhysicsProcess(float delta) | ||
{ | ||
base._PhysicsProcess(delta); | ||
_dartConnector.PhysicsProcess(delta); | ||
} | ||
public override void _ExitTree() | ||
{ | ||
base._ExitTree(); | ||
_dartConnector.ExitTree(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
using System; | ||
using System.IO; | ||
|
||
namespace Godot | ||
{ | ||
public class DartConnector | ||
{ | ||
private readonly Jint.Engine engine; | ||
/* you must add below package to your .csproj | ||
<PackageReference Include="Jint"> | ||
<Version>3.0.0-beta-1828</Version> | ||
</PackageReference> | ||
*/ | ||
public DartConnector(string sourcePath) | ||
{ | ||
engine = new Jint.Engine(); | ||
engine.SetValue("CS_GD__Print", new Action<object>(o => GD.Print(o))); | ||
engine.SetValue("print", new Action<object>(o => GD.Print(o))); | ||
engine.SetValue("self","this"); | ||
engine.Execute(new StreamReader(sourcePath).ReadToEnd()); | ||
} | ||
|
||
public void EnterTree() | ||
{ | ||
try | ||
{ | ||
engine.Invoke("enterTree"); | ||
} | ||
catch (Exception e) | ||
{ | ||
GD.Print(e); | ||
} | ||
} | ||
public void Ready() | ||
{ | ||
try | ||
{ | ||
engine.Invoke("ready"); | ||
} | ||
catch (Exception e) | ||
{ | ||
GD.Print(e); | ||
} | ||
} | ||
public void Process(float delta) | ||
{ | ||
try | ||
{ | ||
engine.Invoke("process",(double)(decimal)delta); | ||
} | ||
catch (Exception e) | ||
{ | ||
GD.Print(e); | ||
} | ||
} | ||
public void PhysicsProcess(float delta) | ||
{ | ||
try | ||
{ | ||
engine.Invoke("physicsProcess",(double)(decimal)delta); | ||
} | ||
catch (Exception e) | ||
{ | ||
GD.Print(e); | ||
} | ||
} | ||
public void ExitTree() | ||
{ | ||
try | ||
{ | ||
engine.Invoke("exitTree"); | ||
} | ||
catch (Exception e) | ||
{ | ||
GD.Print(e); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters