Code Monkey home page Code Monkey logo

godot-fsharp-tools's Introduction

Godot F# Tools

A Godot Engine plugin to simplify using F# through the C# Mono language.

Features

  • Generating an F# project file and adding it to your Godot C# project/solution
    • via Tools menu shortcut.
  • Generating an F# script from a selected C# script.
    • via Tools menu shortcut.
  • Automatically Generating F# scripts from all C# scripts.
    • via configuration in ProjectSettings under Mono > F# Tools
    • Note: All F# classes must have the same name as their C# counterpart with an "Fs" on the end, e.g. MyClass.cs -> MyClassFs.fs.

How to install

  1. Download the .zip from GitHub or clone the repository.
  2. Copy/paste the addons directory into your project or create a symlink between the addons/godot-fsharp-tools directory and a similar one in your project.
  3. Open the ProjectSettings, go to the Plugins tab, find "Godot F# Tools" and switch it from "Inactive" to "Active" on the right-hand side.
  4. Make sure that you've installed the Mono version of Godot and the dotnet command line tool of which this plugin makes heavy use.

How to use

These instructions assume that you...

  1. Have already created a C# project/solution by first creating at least one C# script in your Godot project.
  2. Have installed and activated the plugin.

Generate F# Project

  1. Go to Project > Tools > Setup F# project.... A dialog will open.
  2. Fill in the necessary fields. Unnecessary fields will tell you what default value they become if left empty.
  3. Once confirmed, the dialog will generate the F# project and connect it to your C# project/solution for you. This may take a short while.

Generate single F# script from a C# script

  1. Go to Project > Tools > Generate F# script from C# script.... A dialog will open.
  2. Fill in the necessary fields. Unnecessary fields will tell you what default value they become if left empty.
    • The namespace must match that of the F# library project to which you plan to add it.
  3. Once confirmed, the dialog will generate the F# script and update the C# script to inherit from your F# class and include its namespace.
  4. You will need to add the new F# script file to your F# library project manually.*

Generate F# scripts from all created C# scripts

  1. Go to Project > ProjectSettings. Go to the General tab. Scroll all the way to the bottom and find the Mono > F# Tools category.
  2. Fill in information for all fields in this section.
    • The namespace must match that of the F# library project to which you plan to add it.
    • For better organization, we recommend using the F# library project directory for the output directory.
  3. Create a C# script. The editor will generate a corresponding F# script in the output directory and update the C# script to inherit from your F# class and include its namespace.
  4. You will need to add the new F# script file to your F# library project manually.*

* The reason you must do this manually is because...

  1. the dotnet tool from Microsoft does not support adding items to projects ("Really? Seriously? Professional stuff here guys").
  2. Godot's XmlParser class only allows you to read XML nodes, but not insert them into an .xml file ("Really? I mean, that could be useful guys...").
  3. If you want to write your own XML parsing code to inject the file reference into the <ItemGroup> tag hierarchy, it would be appreciated.

For the uninformed, you add an existing item to an F# project in the following way:

  1. Have Visual Studio installed with F# support.
  2. Open the Godot .sln file in Visual Studio.
  3. Right click on the F# library project in the Solution Explorer dock.
  4. Go to Add > Add Existing Item....
  5. Choose the <classname>Fs.fs file you generated. Hit "OK".

OR

  1. Have Visual Studio Code installed with the Ionide-fsharp extension.
  2. Open the Godot directory in your workspace. Ionide's F# solution tab should automatically detect and add the F# project.
  3. In the F# tab on the left, you should see your project's .sln and under it the .csproj / .fsproj directories.
  4. Right-click the F# project directory. Choose Add file.
  5. Within the command pallete line edit, type out the name of the F# source file in that directory you want to add. Hit Enter.

The F# source file is now added to the F# project!


If you like the project, please give it a star and consider donating to my Kofi. If you have any problems whatsoever, do not hesitate to open an Issue.

godot-fsharp-tools's People

Contributors

shalokshalom avatar willnationsdev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

godot-fsharp-tools's Issues

Mono assemblies folder structure changed.

So I'm not well known in the dotnet world especially with Core and NET project files. But since 3.2 I think the assemblies(the dlls) are placed in /.mono/assemblies/$(ApiConfiguration)/ where $(ApiConfiguration) is either a Release folder or a Debug folder. So once has to manually change the fsproj to reflect that.

I'm not sure how to fix this since I'm not familiar with the whole *proj file format. Any tips?

Cannot load addon script from path: 'res://addons/godot-fsharp-tools/plugin.gd' There seems to be an error in the code, please check the syntax. Disable the plugin in 'res://addons/godot-fsharp-tools/plugin.cfg' to prevent further errors.

hello I am trying to install the Fsharp tools in my new Godot project using Godot 4 and show me these errors

  1. res://addons/godot-fsharp-tools/plugin.gd:1 - Parse Error: Unexpected "Identifier" in the class body.
  2. core/config/project_settings.cpp:343 - Property not found: editor_plugins/enabled

Considering this repo as complete

Hi Will!

Is this repo, so far as this goes, "ready" and the pure amount of contributions in the previous 1 1/2 years simply down to this fact?

In this case, do you think it is sensible, to declare this in the readme, so people know this?

Since I assume, some might be scared about the lack of recent commits.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.