8000 tiledjinn · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
View tiledjinn's full-sized avatar

Block or report tiledjinn

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
tiledjinn/README.md

TileDjinn logo

TileDjinn - The 2D retro graphics engine

License: MPL 2.0

TileDjinn 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.

https://tiledjinn.com

Contents

Features

  • Written in portable C (C99)
  • MPL 2.0 license: free for any project, including commercial ones, allows 79A0 console development
  • Cross platform: available builds for Windows (32/64), Linux PC(32/64), Mac OS X and Raspberry Pi
  • High performance: all samples run at 60 fps with CRT emulation enabled on a Raspberry Pi 3
  • Streamlined, easy to learn API that requires very little lines of code
  • Built-in SDL-based windowing for quick tests
  • Integrate inside any existing framework as a slave renderer
  • Create or modify graphic assets procedurally at run time
  • True raster effects: modify render parameters between scanlines
  • Background layer scaling and rotation
  • Sprite scaling
  • Several blending modes for layers and sprites
  • Pixel accurate sprite vs sprite and sprite vs layer collision detection
  • Special effects: per-column offset, mosaic, per-pixel displacement, CRT emulation...

Getting binaries

A static library for windows MSVC /MDd is provided.

Build from source

You can also build the library from source. TileDjinn requires SDL2 and libpng to build, you must provide these libraries yourself depending on your target platform.

Just clone the source. The build uses cmake.

Contributing

Feel free to submit PR's. I'll try to look at them within 7 days. Please understand that my time for managing this project outside my own use is neither infinite nor funded.

Samples

Coming soon..

Instructions for use

Call TLN_Init and TLN_CreateWindow to initialize the engine.

Create palettes based on your platform's constraints using TLN_CreatePalette. Create a tileset based on your platform's constraints using TLN_CreateTileset. Create a tile map per layer using TLN_CreateTilemap.

For my projects, the TileDjinn port's main loop looks something like this:

TLN_Tilemap *tilemaps;
TLN_Tileset tileset;

int main() {
  TLN_Init(WIDTH, HEIGHT, MAX_LAYER, 128);
  TLN_CreateWindow(NULL, 0);
  
  {
    int i;
    for (i = 0; i < NUM_PALETTES; ++i) {
      TLN_CreatePalette(i, NUM_PALETTES);
    }
  }
  
  {
    int screen;

    tileset = TLN_CreateTileset(MAX_TILES, TILE_WIDTH, TILE_HEIGHT, 0);
    for (screen = 0; screen < MAX_LAYER; ++screen) {
      tilemaps[screen] = TLN_CreateTilemap(32, 32, 0, 0, tileset);
    }
  }
  
  /* this is semantically wrong, but is the easiest way to re-order the layers in the right direction.. */
  TLN_SetLayerTilemap(SCREEN1, tilemaps[SCREEN2]);
  TLN_SetLayerTilemap(SCREEN2, tilemaps[SCREEN1]);
  
  game_init(); /* platform independent game initialization */

  /* main loop */
  while (TLN_ProcessWindow()) {
    game_loop(); /* single iteration of the game loop */
    TLN_DrawFrame(0);
    TLN_WaitRedraw();
  }

  /* de-init */
  {
    int i;
    for (i = 0; i < MAX_LAYER; ++i) {
      TLN_DeleteTilemap(tilemaps[i]);
    }
    TLN_DeleteTileset(tileset);

    for (i = 0; i < NUM_PALETTES; ++i) {
      TLN_DeletePalette(i);
    }
  }


  TLN_DeleteWindow();
  TLN_Deinit();
}

Editing assets

TileDjinn is just a programming library that doesn't come with any editor, but the files it loads are made with standard tools. Samples come bundled with several ready-to-use assets.

I recommend these tools for development (not referral links):

Popular repositories Loading

  1. tiledjinn tiledjinn Public

    8

  2. pipespin pipespin Public

    Forked from hippydave/pipespin

    Puzzle game for Game Boy Advance, developed for GBA Jam 2021

    C 1

0