britzl / template-lowres

Defold template project for lowres/pixel-art games.
26 stars 3 forks source link
defold defold-library lowrezjam pixel-art

template-lowres

Defold template project for creation of low-res pixel art games. The project provides a render script for rendering the game to a low-res texture that will be centered and upscaled to fit the screen dimensions. The project also provides fonts for use in low resolution pixel art games.

The template project also contains presets for the following formats:

HTML5 demo: https://britzl.github.io/LOWREZJAM/

Installation

You can use the template in your own project by adding this project as a Defold library dependency. Open your game.project file and in the dependencies field under project add:

https://github.com/britzl/template-lowres/archive/master.zip

Or point to the ZIP file of a specific release.

This repository is also available as a GitHub Template repository.

Usage

It is quite easy to setup and use the template:

Expand the game object, select the attached script component and configure how the graphics should render. You can modify width, height and snap (see below).

Lowrez render script

The template provides a render script that renders to a low-res texture and upscales to fit screen dimensions. The texture will be centered in the window.

Changing size

Change the screen size by posting a set_size message to the render script with a width and height message property.

msg.post("@render:", "set_size", { width = 320, height = 240 })

Configure scale snapping

The upscaled low-res texture will by default be scaled to fill as much of the window as possible. It is possible to ensure that the upscaled texture will have a zoom that is set to an integer value. You can toggling scale snapping via the toggle_scale_snap message or explicity set snapping using the set_scale_snap message with snap set to true or false.

msg.post("@render:", "toggle_scale_snap")
msg.post("@render:", "set_scale_snap", { snap = true })

On screen controls

The render script will also in a separate pass draw on-screen controls as per allowed rules for the jam. The on-screen controls must be a gui with material set to the provided controls.material.

Fonts

The template ships with the following fonts suitable for low resolution pixel art games: