GithubHelp home page GithubHelp logo

yal-gamemaker-tools / gmxgen Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 0.0 701 KB

Updates GameMaker extensions with function/macro definitions and documentation extracted from source files.

Haxe 99.65% Batchfile 0.35%
gamemaker gamemaker-studio gamemaker-studio-2

gmxgen's Introduction

GmxGen

This small program takes a .extension.gmx (GMS1) or .yy (GMS2) file and updates it's included files with accordance with the functions and macros defined inside.

So, instead of tinkering with the little pop-up menus for defining functions and macros per extension file, you can hint them in your files

Building

Note: There are also pre-built binaries in Releases.

Neko VM (note: if you didn't install it together with Haxe, get it from the website):

haxe build-neko.hxml
nekotools boot bin/GmxGen.n

For C# (note: do haxelib install hxcs first if you've never used Haxe➜C# before):

haxe build-cs.hxml
copy /Y GmxGen.NET\bin\GenMain.exe bin\GmxGen.exe

Or: Open the included HXPROJ using a development version of HaxeDevelop and press Build Project (F8)

Usage

gmxgen .../some.extension.gmx
-- OR --
gmxgen .../some.yy

To index and update all compatible files in the extension. Or,

gmxgen .../some.extension.gmx file1.gml file2.dll

To only index and update particular files in the extension.

Add --watch to stay around and watch files for changes, e.g.

gmxgen .../some.yy file1.gml --watch

Below are listed the formats for hinting function and macros definitions per language.

Macros

#macro definitions inside extensions are not visible to the game code so a comment-based syntax is used instead

#!javascript
//#macro name value
// -> normal macro

//#macro name value~
// -> hidden macro

//#macro name value : notes
// -> macro with notes (old format)

GameMaker Language

GML files inside extensions consist of series of scripts delimited by #define <name>.

If the #define line is followed by one or more /// comment lines, they will be used to determine the number of arguments and help-line. Otherwise the number of arguments will be determined based on argument[K] / argumentK use and the script will be hidden from auto-completion.

Optional arguments are denoted as ?argName.

Ability to add an arbitrary number of trailing arguments (such as with ds_list_add, for example) is denoted as ...argNames.

GMS1-style documentation syntax (preferred):

#define scr_add
/// (num1, num2)

#define scr_add
/// (num1, num2)->number

#define scr_add
/// (num1, num2) : adds numbers

#define scr_add
/// (num1, num2)->number : adds numbers

#define scr_print
/// (tag, ...values)

#define scr_hidden
/// (a, b, c)~

GMS2-style documentation syntax:

#define scr_add
/// @param num1
/// @param num2
// would show as scr_add(num1, num2)

#define scr_print
/// @param tag
/// @param ...values
// would show as scr_print(tag, ...values)

#define scr_hidden
/// @param a
/// @param b
/// @param c
/// @hide

Global variables

You can define global variables as

//#global name
//#global name2~

which is shorthand for

//#macro name global.g_name
//#macro name2 global.g_name2~

(see Macros) to save a bit of typing.

JavaScript

Things are much akin to GML except with documentation-comment in front of the definition,

///~
function add(a, b) { ... } // 2-argument, hidden

/// : adds numbers
function add(a, b) { ... } // 2-argument, visible

/// (tag, ...values)
function print(tag, rest) { ... } // variable argument count

/// : adds numbers
window.add = function(a, b) { ... } // alternate syntax (if you use closures)

C++ (DLL, DyLib, SO)

For the C++ binaries, a .cpp file (named same as the binary file) should be placed in the same directory with the binary file. It doesn't have to be valid C++ (just have the definitions in the right format), so you can safely concat multiple files into a single one if needed.

Functions

/// adds numbers
dllx double add(double a, double b) { ... }

///
dllx char* greet(char* name) { ... }

///
dllx double measure(int* items) { ... } // treats a buffer_get_address as an array of integers

where dllx is a C++ macro name auto-detected from a line in format

#define dllx extern "C" __declspec(dllexport)

Macros

Aside of the usual //#macro syntax, you can also define macros in a way that is visible to both C++ and GM,

///
#define version 101

///~
#define format 3
// ^ hidden

Enums

Classic "flat" enums can be automatically converted to macros,

enum some {
	e_A,
	e_B,
	e_C = 4
};

would expose macros e_A, e_B, and e_C equal to 0, 1, and 4 accordingly.

Author and license

Author: Vadim "YellowAfterlife" Dyachenko

License: GNU GPL v3 https://www.gnu.org/licenses/gpl-3.0


Have fun*!*

gmxgen's People

Contributors

yellowafterlife avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gmxgen's Issues

"Your extension doesn't have an array of files in it" error when recompiling C# extension for IDE 2024.2.0.132

When I build my extension while it's .yy is still in an older asset format, it compiles as normal.

As I import the extension asset into GameMaker, GameMaker converts both the original .yy asset in my extension solution folder, and the imported copy, to the newest format for 2024.2.0.132.

When I go to build it again in Visual Studio, I get the following build error: "Your extension doesn't have an array of files in it."
This is probably being caused by the new IDE version changing how the .yy file is formatted. I've attached a screenshot of the error below

image

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.