{"id":13531298,"url":"https://github.com/megamarc/Tilengine","last_synced_at":"2025-04-01T19:32:00.557Z","repository":{"id":2431217,"uuid":"42005563","full_name":"megamarc/Tilengine","owner":"megamarc","description":"Free 2D graphics engine with raster effects for retro/classic style game development","archived":false,"fork":false,"pushed_at":"2024-09-29T17:12:44.000Z","size":25939,"stargazers_count":839,"open_issues_count":15,"forks_count":94,"subscribers_count":38,"default_branch":"master","last_synced_at":"2024-11-02T18:41:18.543Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.tilengine.org","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/megamarc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-09-06T14:30:48.000Z","updated_at":"2024-11-02T08:26:27.000Z","dependencies_parsed_at":"2024-01-03T04:00:51.583Z","dependency_job_id":"3fb0122c-431b-4170-a2d4-8a2e5c7b81f8","html_url":"https://github.com/megamarc/Tilengine","commit_stats":{"total_commits":266,"total_committers":19,"mean_commits":14.0,"dds":0.3007518796992481,"last_synced_commit":"5d19e688fdd044835ebb68d57b03d99f34846647"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/megamarc%2FTilengine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/megamarc%2FTilengine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/megamarc%2FTilengine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/megamarc%2FTilengine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/megamarc","download_url":"https://codeload.github.com/megamarc/Tilengine/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246700556,"owners_count":20819895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T07:01:01.846Z","updated_at":"2025-04-01T19:31:55.537Z","avatar_url":"https://github.com/megamarc.png","language":"C","readme":"![Tilengine logo](Tilengine.png)\n# Tilengine - The 2D retro graphics engine\n[![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)\n[![Build Status](https://travis-ci.org/megamarc/Tilengine.svg?branch=master)](https://travis-ci.org/megamarc/Tilengine)\n\nTilengine is an open source, cross-platform 2D graphics engine for creating classic/retro games with tile maps, sprites and palettes. Its unique scanline-based rendering algorithm makes raster effects a core feature, a technique used by many games running on real 2D graphics chips.\n\nhttp://www.tilengine.org\n\n# Contents\n- [Tilengine - The 2D retro graphics engine](#tilengine---the-2d-retro-graphics-engine)\n- [Contents](#contents)\n- [Features](#features)\n- [Getting binaries](#getting-binaries)\n\t- [Download from itch.io](#download-from-itchio)\n\t- [Build from source](#build-from-source)\n\t\t- [Windows](#windows)\n\t\t- [Debian-based linux](#debian-based-linux)\n\t\t- [MacOS](#macos)\n- [Running the samples](#running-the-samples)\n\t- [Windows](#windows-1)\n\t- [Unix-like](#unix-like)\n- [The tilengine window](#the-tilengine-window)\n- [Creating your first program](#creating-your-first-program)\n\t- [Windows](#windows-2)\n\t- [Linux](#linux)\n\t- [MacOS](#macos-1)\n- [Documentation](#documentation)\n- [Editing assets](#editing-assets)\n- [Creating packages](#creating-packages)\n- [Bindings](#bindings)\n- [Contributors](#contributors)\n\n# Features\n* Written in portable C (C99)\n* MPL 2.0 license: free for any project, including commercial ones, allows console development\n* Cross platform: available builds for Windows (32/64), Linux PC(32/64), MacOS and Raspberry Pi\n* High performance: all samples run at 60 fps with CRT emulation enabled on a Raspberry Pi 3\n* Streamlined, easy to learn API that requires very little lines of code\n* Built-in SDL-based windowing for quick tests\n* Integrate inside any existing framework as a slave renderer\n* Loads assets from open standard standard file formats\n* Create or modify graphic assets procedurally at run time\n* True raster effects: modify render parameters between scanlines\n* Background layer scaling and rotation\n* Sprite scaling\n* Several blending modes for layers and sprites\n* Pixel accurate sprite vs sprite and sprite vs layer collision detection\n* Special effects: per-column offset, mosaic, per-pixel displacement, CRT emulation...\n* Supports packaged assets with optional AES-128 encryption\n\n# Getting binaries\n\n## Download from itch.io\nThe recommended way to get prebuilt binaries ready to install, run and test samples is grabbing them from official [itch.io download](https://megamarc.itch.io/tilengine). Just download the package for your platform, they contain required dependencies to run.\n\n## Build from source\nYou can also build the library from source. Tilengine requires `SDL2` and `libpng` to build, you must provide these libraries yourself depending on your target platform.\n\n### Windows\nYou must provide development libraries:\n* SDL: https://www.libsdl.org/download-2.0.php\n* libpng: http://gnuwin32.sourceforge.net/packages/libpng.htm\n\nPut the following files inside the `src` directory:\nPath | Files\n-----|---------------------------------------\n`src\\libpng`             | libpng headers\n`src\\libpng\\$(Platform)` | libpng.lib import library\n`src\\sdl\\SDL2`           | SDL2 headers\n`src\\sdl\\lib\\$(Platform)`| SDL2.lib import library\n\n**NOTE**: If you're having problems setting up these dependencies, you can download them already pre-packaged from [itch.io downloads](https://megamarc.itch.io/tilengine), file is `windows_libs.zip`. It contains headers and libraries for both 32 and 64 bit platforms.\n\n### Debian-based linux\nJust install standard packages `libpng-dev` and `libsdl2-dev`\n\n### MacOS\n\nTilengine depends on having SDL2 in Framework format installed on your system. Homebrew port won't work. Download the latest dmg here: https://github.com/libsdl-org/SDL/releases.\n\n# Running the samples\n\nC samples are located in `Tilengine/samples` folder. To build them you need the gcc compiler suite, and/or Visual C++ in windows.\n* **Linux**: the GCC compiler suite is already installed by default\n* **Windows**: you must install [MinGW](http://www.mingw.org/) or [Visual Studio Community](https://www.visualstudio.com/vs/community/)\n* **MacOS**: You must install [Command-line tools for Xcode](https://developer.apple.com/xcode/). An Apple ID account is required.\n\nOnce installed, open a console window in the C samples folder and type the suitable command depending on your platform:\n\n## Windows\n```\n\u003e mingw32-make\n```\n\n## Unix-like\n```\n\u003e make\n```\n\n# The tilengine window\nThe following actions can be done in the created window:\n* Press \u003ckbd\u003eEsc\u003c/kbd\u003e to close the window\n* Press \u003ckbd\u003eAlt\u003c/kbd\u003e + \u003ckbd\u003eEnter\u003c/kbd\u003e to toggle full-screen/windowed\n* Press \u003ckbd\u003eBackspace\u003c/kbd\u003e to toggle built-in CRT effect (enabled by default)\n\n# Creating your first program\nThe following section shows how to create from scratch and execute a simple tilengine application that does the following:\n1. Reference the inclusion of Tilengine module\n2. Initialize the engine with a resolution of 400x240, one layer, no sprites and no palette animations\n3. Load a *tilemap*, the asset that contains background layer data\n4. Attach the loaded tilemap to the allocated background layer\n5. Create a display window with default parameters: windowed, auto scale and CRT effect enabled\n6. Run the window loop, updating the display at each iteration until the window is closed\n7. Release allocated resources\n\n![Test](test.png)\n\nCreate a file called `test.c` in `Tilengine/samples` folder, and type the following code:\n```c\n#include \"Tilengine.h\"\n\nvoid main(void) {\n    TLN_Tilemap foreground;\n\n    TLN_Init (400, 240, 1, 0, 0);\n    foreground = TLN_LoadTilemap (\"assets/sonic/Sonic_md_fg1.tmx\", NULL);\n    TLN_SetLayerTilemap (0, foreground);\n\n    TLN_CreateWindow (NULL, 0);\n    while (TLN_ProcessWindow()) {\n        TLN_DrawFrame (0);\n    }\n\n    TLN_DeleteTilemap (foreground);\n    TLN_Deinit ();\n}\n```\nNow the program must be built to produce an executable. Open a console window in the C samples folder and type the suitable command for your platform:\n\n## Windows\n```\n\u003e gcc test.c -o test.exe -I\"../include\" ../lib/Win32/Tilengine.dll\n\u003e test.exe\n```\n\n## Linux\n```\n\u003e gcc test.c -o test -lTilengine -lm\n\u003e ./test\n```\n\n## MacOS\n```\n\u003e gcc test.c -o test \"/usr/local/lib/Tilengine.dylib\" -lm\n\u003e ./test\n```\n\n# Documentation\nDoxygen-based documentation and API reference can be found in the following link:\nhttp://www.tilengine.org/doc\n\n# Editing assets\nTilengine is just a programming library that doesn't come with any editor, but the files it loads are made with standard open-source tools. Samples come bundled with several ready-to-use assets, but these are the tools you'll need to edit or create new ones:\n* Source code: [VSCode](https://code.visualstudio.com/), [Notepad++](https://notepad-plus-plus.org/downloads/)...\n* Graphics, tiles \u0026 sprites: [Aseprite](https://www.aseprite.org/), [Piskel](https://www.piskelapp.com/), [Grafx2](http://grafx2.chez.com/)...\n* Maps: [Tiled Map Editor](https://www.mapeditor.org/)\n\n# Creating packages\nTo create a package with all the assets, the add-on tool [ResourcePacker](https://megamarc.itch.io/resourcepacker) must be used. It's a Windows command-line tool that creates packages with files keeping the same directory structure. Tilengine has built-in support for loading assets from these packages just as if they still were stand-alone files.\n\n# Bindings\nThere are bindings to use Tilengine from several programming languages:\n\nLanguage  |Binding\n----------|-----------------------------------------\nC/C++     | Native support, no binding required\nPython    | [PyTilengine](https://github.com/megamarc/PyTilengine)\nC#        | [CsTilengine](https://github.com/megamarc/CsTilengine)\nC#        | [CsTilenginePure](https://github.com/vonhoff/CsTilenginePure)\nPascal    | [PascalTileEngine](https://github.com/turric4n/PascalTileEngine)\nFreeBasic | [FBTilengine](https://github.com/megamarc/FBTilengine)\nJava\t    | [JTilengine](https://github.com/megamarc/JTilengine)\nRust      | [tilengine-sys](https://crates.io/crates/tilengine-sys)\nLuaJIT    | [tilengine_libretro](https://github.com/megamarc/Tilengine/tree/libretro) ([libretro](https://www.libretro.com) core)\nRing      | [RingTilengine](https://github.com/ring-lang/ring/tree/master/extensions/ringtilengine)\nNim       | [nim-tilengine](https://sr.ht/~exelotl/nim-tilengine)\nV         | [V-Tilengine](https://github.com/system64MC/V-Tilengine)\nGo        | [gotilengine](https://github.com/thechampagne/gotilengine)\nZig       | [zigtilengine](https://github.com/thechampagne/zigtilengine)\nD         | [dtilengine](https://github.com/thechampagne/dtilengine)\nOdin      | [odintilengine](https://github.com/thechampagne/odintilengine)\nOdin      | [odin-tilengine](https://github.com/akuspel/odin-tilengine)\n\n# Contributors\nThese kind users contributed to tilengine:\n\n@turric4an - the Pascal wrapper\u003cbr\u003e\n@davideGiovannini - help with the Linux-x86_64 port\u003cbr\u003e\n@shayneoneill - help with the OS X port\u003cbr\u003e\n@adtennant - provided cmake and pkg-config support\u003cbr\u003e\n@tvasenin - improved C# binding\u003cbr\u003e\n@tyoungjr - LUA/FFI binding\u003cbr\u003e\n@vonhoff - provided CsTilenginePure binding\u003cbr\u003e\n@system64MC - provided bindings for Nim an V\n","funding_links":[],"categories":["C","Libraries"],"sub_categories":["C"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmegamarc%2FTilengine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmegamarc%2FTilengine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmegamarc%2FTilengine/lists"}