Giter Club home page Giter Club logo

tilengine-psp's Introduction

Tilengine logo

Tilengine-PSP - The 2D retro graphics engine for the PSP

License: MPL 2.0 Build Status

Tilengine-PSP is the PSP port of Tilengine.
Tilengine 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.

http://www.tilengine.org

Thanks megamarc for writing such a portable and easy to read code.

Contents

Features

  • Written in portable C (C99)
  • MPL 2.0 license: free for any project, including commercial ones, allows 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
  • Loads assets from open standard standard file formats
  • 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...
  • Supports packaged assets with optional AES-128 encryption

TODO

  • offload math tasks to vfpu
  • add the special effects (per-column offset, mosaic, per-pixel displacement, CRT emulation)
  • change graphics renderer from SDL1.2 to sceGU

Getting binaries

Build from source

You can also build the library from source. Tilengine-PSP requires SDL1.2 and libpng to build.

  make -f Makefile.psp

Running the samples

C samples for the PSP are located in Tilengine/psp_samples folder. To build them you need the pspsdk.

Once installed, open a console window in the C samples folder and type

> make

Creating your first program

The following section shows how to create from scratch and execute a simple tilengine application that does the following:

  1. Setup the PSP exit callback.
  2. Reference the inclusion of Tilengine module
  3. Initialize the engine with a resolution of 480x272, one layer, no sprites and no palette animations
  4. Load a tilemap, the asset that contains background layer data
  5. Attach the loaded tilemap to the allocated background layer
  6. Create a display window with default parameters
  7. Run the window loop, updating the display at each iteration until the window is closed
  8. Release allocated resources

Test

Create a file called test.c in Tilengine/psp_samples folder, and type the following code:

#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspdebug.h>
#include <pspctrl.h>

#include <pspgu.h>
#include <pspgum.h>
#include <pspge.h>
#include "Tilengine.h"

PSP_MODULE_INFO("Example", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);

int main(int argc, char* argv[]) 
{
	  setupExitCallback ();
    
    TLN_Tilemap foreground;

    TLN_Init (480, 272, 1, 0, 0);
    TLN_SetLoadPath ("assets/sonic");
    foreground = TLN_LoadTilemap ("assets/sonic/Sonic_md_fg1.tmx", NULL);
    TLN_SetLayerTilemap (0, foreground);

    TLN_CreateWindow (NULL, 0);
    while (isRunning ()) 
    {
        TLN_DrawFrame (0);
    }

    TLN_DeleteTilemap (foreground);
    TLN_Deinit ();
    
    sceKernelExitGame ();
    
    return 0;
}

Documentation

Doxygen-based documentation and API reference can be found in the following link: http://www.tilengine.org/doc

Editing assets

Tilengine 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:

Contributors

These people contributed to tilengine:

@turric4an - the Pascal wrapper
@davideGiovannini - help with the Linux-x86_64 port
@shayneoneill - help with the OS X port
@adtennant - provided cmake and pkg-config support
@tvasenin - improved C# binding
@tyoungjr - LUA/FFI binding

Disclaimer

This repository contains sprites from the Mario and Sonic series for use in its examples. The use of these sprites is strictly intended for educational purposes, and no infringement is intended upon the original copyright holders. If the use of these sprites is in violation of the copyright holders' wishes, we will remove any offending assets upon request.

tilengine-psp's People

Contributors

daltomi avatar mechakotik avatar megamarc avatar preemeijer avatar stacksta avatar t-money-g avatar thundervox avatar thyandyr avatar tvasenin avatar

Watchers

 avatar  avatar

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.