Skip to content

Yet Another Lua Engine is a GUI widget engine written in pure-C Allegro and scriptable in Lua.

License

Notifications You must be signed in to change notification settings

CleisthenesH/YALE-JIT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚠️Under Construction⚠️

🐐 YALE 🐐

The Yale is a mythical goat like creature with an additional pair of tusks and horns that can swivel around.

A drawing of a yale
A depiction of a yale from wikimedia commons. Note the backwards horn.

But YALE also stands for "Yet Another Lua Engine", a succinct description of this project.

Overview

The goal of this project is to create GUI widget engine in pure-C Allegro that is scriptable by Lua. And the core of this project is the widget interface stack with a system of inbuilt callbacks based on user generated events.

The easiest way to show this would be showing the workflow for creating a button, setting it's location and text, and making it print to the console when clicked.

Lua Code

button = button{x=500, y=500, text="Click Me!"}

function button:left_click()
	print(self, " was clicked!")
end

Rendered Button Pre-click

Image of the above code pre-click.

Rendered Button Post-click

Image of the above code post-click.

Excerpt of Engine Code for Rendering the Button

struct button
{
	struct wg_base;
	ALLEGRO_COLOR color;
	ALLEGRO_FONT* font;

	char text[];
};

static void draw(const struct wg_base* const wg)
{
	const struct button* const button = (const struct button* const)wg;

	al_draw_filled_rounded_rectangle(-wg->half_width, -wg->half_height, wg->half_width, wg->half_height,
		primary_pallet.edge_radius, primary_pallet.edge_radius,
		button->color);

	if (button->text)
		al_draw_text(button->font, al_map_rgb_f(1, 1, 1),
			0, -0.5 * al_get_font_line_height(button->font),
			ALLEGRO_ALIGN_CENTRE, button->text);

	al_draw_rounded_rectangle(-wg->half_width, -wg->half_height, wg->half_width, wg->half_height,
		primary_pallet.edge_radius, primary_pallet.edge_radius,
		primary_pallet.edge, primary_pallet.edge_width);
}

Features

Current features includes:

  • Feature rich and customizable widget callback engine.
  • Intuitive object based LUA interface.
  • Material based shaders.
  • Thread pool based multithreading.
  • Lightweight resource manger, scheduler, and particle engine.
  • Inbuilt logic for board/card game like widgets.

Full documentation of featured coming in the future!

Why use YALE instead of other Lua game engine?

As suggested by the repository title, I'm well aware that a lot of game engines exist. For those familiar with Lua in particular, the obvious question is why use YALE instead of LÖVE?

LÖVE is feature rich and well documented project with an active community and a history of releases going back decades. And the YALE engine is all the better for existing in an ecosystem with such high quality projects as LÖVE.

My end goal for YALE is to provide customized and inbuilt logic for board/card games. Until that time is reached LÖVE is the clear choice for most application, but I hope to see you on the other side :salute:

Why JIT?

LuaJIT is a Just-In-Time compiler for LUA that is meant to work as a drop in replacement for lua51.dll. It's included in the tile as this repo is a sequel to the YALE engine with updates including:

  • LuaJIT compatibility.
  • Stronger typing.
  • Folding board_manager into the core widget_interface.
  • Big changes to widget memory layout:
    • Improved caching.
    • Better use of anonymous structs.
    • Folding in to tweener and render_interface into the core widget code.
    • If a requested key isn't reserved, lua uses it goes into the fenv table.
  • Incorporation of general improved Lua knowledge into the architecture.

These are some pretty big changes so I decided on a pseudo-rewrite of the engine where I started blank and copied over features one at a time while making the required changes. I comforted myself through this process by saying:

Good programmers throw out a lot of code.

Check the original for comparison and more info.

Acknowledgments

Code

Lua (5.1) Website

LuaJIT Website

Allegro (5.2) Website

Art

(Note the art in the res/ directory isn't included in the repo directly because that feels too close to their unmodified redistribution, they will be incorporated into an upcoming full release).

Emily Huo (Font) itch.io

bizinbarstome (Tile Art) itch.io

Game-Icons (Icons) Website

Icons by:

About

Yet Another Lua Engine is a GUI widget engine written in pure-C Allegro and scriptable in Lua.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published