All Projects → erkkah → tigr

erkkah / tigr

Licence: other
TIGR - the TIny GRaphics library for Windows, macOS, Linux, iOS and Android.

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to tigr

Simple2d
🎮 Simple, open-source 2D graphics for everyone
Stars: ✭ 390 (-5.57%)
Mutual labels:  2d-graphics
Ink
Creative coding in Go
Stars: ✭ 115 (-72.15%)
Mutual labels:  2d-graphics
Graphite
Open source 2D node-based raster/vector graphics editor (Photoshop + Illustrator + Houdini = Graphite)
Stars: ✭ 223 (-46%)
Mutual labels:  2d-graphics
2d Spaceshooter
A very simple 2D space shooter game made with Unity
Stars: ✭ 6 (-98.55%)
Mutual labels:  2d-graphics
Cellsim 2
Simulating complete lives of different cellular animals and plants. Evolution, inheritance, predation and more.
Stars: ✭ 28 (-93.22%)
Mutual labels:  2d-graphics
O2
2D Game Engine with visual WYSIWYG editor
Stars: ✭ 121 (-70.7%)
Mutual labels:  2d-graphics
Fbg
Lightweight C 2D graphics API agnostic library with parallelism support
Stars: ✭ 349 (-15.5%)
Mutual labels:  2d-graphics
MonoGame.Primitives2D
Easy-to-use 2D primitives
Stars: ✭ 44 (-89.35%)
Mutual labels:  2d-graphics
Fidocadj
FidoCadJ is a free user-friendly vector graphic editor for MacOSX, Linux, Windows and Android
Stars: ✭ 76 (-81.6%)
Mutual labels:  2d-graphics
Picasso
Picasso is a high quality 2D vector graphic rendering library. It support path , matrix , gradient , pattern , image and truetype font.
Stars: ✭ 205 (-50.36%)
Mutual labels:  2d-graphics
Blend2d
2D Vector Graphics Engine Powered by a JIT Compiler
Stars: ✭ 859 (+107.99%)
Mutual labels:  2d-graphics
Blit
👾 Blitting library for 2D sprites
Stars: ✭ 15 (-96.37%)
Mutual labels:  2d-graphics
Winston.jl
2D plotting for Julia
Stars: ✭ 153 (-62.95%)
Mutual labels:  2d-graphics
G
A powerful rendering engine which providing Canvas and SVG draw for G2 & G6
Stars: ✭ 556 (+34.62%)
Mutual labels:  2d-graphics
Gg
Go Graphics - 2D rendering in Go with a simple API.
Stars: ✭ 3,162 (+665.62%)
Mutual labels:  2d-graphics
Graphics
A library for 2D graphics, written in Rust, that works with multiple back-ends
Stars: ✭ 381 (-7.75%)
Mutual labels:  2d-graphics
Urpflanze
A library for developers who want to approach to creative coding, artists who want to approach coding and for those who find it fun to play with math.
Stars: ✭ 118 (-71.43%)
Mutual labels:  2d-graphics
QtSkia
Qt with skia
Stars: ✭ 94 (-77.24%)
Mutual labels:  2d-graphics
Generative-Art
A selection of generative art scripts written in Python
Stars: ✭ 284 (-31.23%)
Mutual labels:  2d-graphics
Game
Java 2D game library
Stars: ✭ 157 (-61.99%)
Mutual labels:  2d-graphics

TIGR - TIny GRaphics library

TIGR is a tiny cross-platform graphics library, providing a unified API for Windows, macOS, Linux, iOS and Android.

TIGR's core is a simple framebuffer library. On top of that, we provide a few helpers for the common tasks that 2D programs generally need:

  • Bitmap-backed windows.
  • Direct access to bitmaps, no locking.
  • Basic drawing helpers (plot, line, blitter).
  • Text output using bitmap fonts.
  • Mouse, touch and keyboard input.
  • PNG loading and saving.
  • Easy pixel shader access.

TIGR is designed to be small and independent. The 'hello world' example is less than 100kB:

Platform Size
windows x86_64 48k
linux x86_64 43k
macOS arm64 90k
macOS x86_64 74k

There are no additional libraries to include; everything is baked right into your program.

TIGR is free to copy with no restrictions; see tigr.h.

How do I program with TIGR?

Here's an example Hello World program. For more information, just read tigr.h to see the APIs available.

#include "tigr.h"

int main(int argc, char *argv[])
{
    Tigr *screen = tigrWindow(320, 240, "Hello", 0);
    while (!tigrClosed(screen))
    {
        tigrClear(screen, tigrRGB(0x80, 0x90, 0xa0));
        tigrPrint(screen, tfont, 120, 110, tigrRGB(0xff, 0xff, 0xff), "Hello, world.");
        tigrUpdate(screen);
    }
    tigrFree(screen);
    return 0;
}

How to set up TIGR

Desktop (Windows, macOS, Linux)

TIGR is supplied as a single .c and corresponding .h file.

To use it, you just drop them right into your project.

  1. Grab tigr.c and tigr.h
  2. Throw them into your project.
  3. Link with
    • -lopengl32 and -lgdi32 on Windows
    • -framework OpenGL and -framework Cocoa on macOS
    • -lGLU -lGL -lX11 on Linux
  4. You're done!

Android

Due to the complex lifecycle and packaging of Android apps (there is no such thing as a single source file Android app), a tiny wrapper around TIGR is needed. Still - the TIGR API stays the same!

To keep TIGR as tiny and focused as it is, the Android wrapper lives in a separate repo.

To get started on Android, head over to the TIMOGR repo and continue there.

iOS

On iOS, TIGR is implemented as an app delegate, which can be used in your app with just a few lines of code.

Building an iOS app usually requires quite a bit of tinkering in Xcode just to get up and running. To get up and running fast, there is an iOS starter project with a completely commandline-based tool chain, and VS Code configurations for debugging.

To get started on iOS, head over to the TIMOGRiOS repo and continue there.

NOTE: TIGR is included in TIMOGR and TIMOGRiOS, there is no need to install TIGR separately.

Fonts and shaders

Custom fonts

TIGR comes with a built-in bitmap font, accessed by the tfont variable. Custom fonts can be loaded from bitmaps using tigrLoadFont. A font bitmap contains rows of characters separated by same-colored borders. TIGR assumes that the borders use the same color as the top-left pixel in the bitmap. Each character is assumed to be drawn in white on a transparent background to make tinting work.

Use the tigrfont tool to create your own bitmap fonts from TTF or BDF font files.

Custom pixel shaders

TIGR uses a built-in pixel shader that provides a couple of stock effects as controlled by tigrSetPostFX. These stock effects can be replaced by calling tigrSetPostShader with a custom shader. The custom shader is in the form of a shader function: void fxShader(out vec4 color, in vec2 uv) and has access to the four parameters from tigrSetPostFX as a uniform vec4 called parameters.

See the shader example for more details.

Known issues

On macOS, seemingly depending on SDK version and if you use TIGR in an Xcode project, you need to define OBJC_OLD_DISPATCH_PROTOTYPES to avoid problems with objc_msgSend prototypes.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].