All Projects → alxm → faur

alxm / faur

Licence: GPL-3.0 license
⚒️✨ My personal C games framework. 2D graphics, sound, inputs, states, ECS, and misc utils for data, files, math, memory, strings, time, and more. Builds for Linux, Windows, Web, and embedded devices.

Programming Languages

c
50402 projects - #5 most used programming language
python
139335 projects - #7 most used programming language
Makefile
30231 projects
C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to faur

Pygame
pygame (the library) is a Free and Open Source python programming language library for making multimedia applications like games built on top of the excellent SDL library. C, Python, Native, OpenGL.
Stars: ✭ 4,164 (+7470.91%)
Mutual labels:  gamedev, sdl, sdl2
BonEngineSharp
A simple and fun SDL-based game engine in C#.
Stars: ✭ 16 (-70.91%)
Mutual labels:  gamedev, sdl, sdl2
sdlpp
C++ wrapper for SDL2
Stars: ✭ 37 (-32.73%)
Mutual labels:  gamedev, sdl, sdl2
SDL.zig
A shallow wrapper around SDL that provides object API and error handling
Stars: ✭ 102 (+85.45%)
Mutual labels:  gamedev, sdl, sdl2
Magnum
Lightweight and modular C++11 graphics middleware for games and data visualization
Stars: ✭ 3,728 (+6678.18%)
Mutual labels:  gamedev, sdl, emscripten
Libsdl2pp
C++11 bindings/wrapper for SDL2
Stars: ✭ 385 (+600%)
Mutual labels:  gamedev, sdl, sdl2
Gwork
Skinnable GUI with useful widget collection. Fork of GWEN.
Stars: ✭ 179 (+225.45%)
Mutual labels:  gamedev, sdl, sdl2
MonoGame.Primitives2D
Easy-to-use 2D primitives
Stars: ✭ 44 (-20%)
Mutual labels:  2d-graphics, 2d-game-framework
gnuboy
latest version of original laguna source, with a handful fixes for modern compilers and systems
Stars: ✭ 70 (+27.27%)
Mutual labels:  sdl, sdl2
OpenHSP
Hot Soup Processor (HSP3)
Stars: ✭ 120 (+118.18%)
Mutual labels:  gamedev, sdl2
Fairtris
Clone of the official classic Tetris® game for the NES console, intended for Windows and Linux systems. It implements the original mechanics and includes many regional versions and several RNGs (all in one executable).
Stars: ✭ 30 (-45.45%)
Mutual labels:  sdl, sdl2
nox-decomp
Unofficial Nox (2000) port to Linux using decompiled code from https://playnox.xyz
Stars: ✭ 21 (-61.82%)
Mutual labels:  sdl, sdl2
helloworld-sdl2-opengl-emscripten
Basic program that uses SDL2+OpenGL, compiling both locally and via emscripten
Stars: ✭ 71 (+29.09%)
Mutual labels:  sdl2, emscripten
sdl stb font
Renders text using STB_Truetype in pure SDL
Stars: ✭ 40 (-27.27%)
Mutual labels:  sdl, sdl2
Dome
A lightweight game development environment where games can be written in Wren
Stars: ✭ 251 (+356.36%)
Mutual labels:  gamedev, sdl2
Driftwood
Driftwood 2D Tiling Game Engine and Development Suite
Stars: ✭ 23 (-58.18%)
Mutual labels:  sdl, sdl2
Magnum Examples
Examples for the Magnum C++11/C++14 graphics engine
Stars: ✭ 180 (+227.27%)
Mutual labels:  gamedev, emscripten
ffi-sdl
PHP FFI SDL bindings
Stars: ✭ 23 (-58.18%)
Mutual labels:  sdl, sdl2
guisan
A C++ SDL2 user interface library based on guichan. ~~~~ Nov, 2021 - This project is not abandoned, just not under active development. Pull requests will be accepted and new releases will be generated for new features / bug fixes.
Stars: ✭ 54 (-1.82%)
Mutual labels:  sdl, sdl2
OCamlSDL2
OCaml interface to SDL 2.0 (for Linux, Windows, MacOS, and ChromeBook)
Stars: ✭ 42 (-23.64%)
Mutual labels:  sdl, sdl2

Faur

Faur is my personal C framework for my hobby video games.

Features include software 2D graphics, abstractions for inputs and sound, application state management, entity-component-system model, and utilities to help with data, files, math, memory, strings, time, and more.

Faur builds native on Linux and cross-compiles for Web, Windows, and some embedded devices I like, including Arduino-based. The build system uses GNU Make 4.1 and Python 3.6 or later.

Dependencies & Path Setup

# Required
sudo apt install build-essential git python3
sudo apt install libsdl2-dev libsdl2-mixer-dev libpng-dev

# Optional
sudo apt install libsdl1.2-dev libsdl-mixer1.2-dev
sudo apt install ffmpeg python3-pil python3-serial python-is-python3

# Set FAUR_PATH, clone repo, and add tools to path
export FAUR_PATH="$HOME/faur"
git clone git://github.com/alxm/faur.git $FAUR_PATH
export PATH="$PATH:$FAUR_PATH/bin"

Hello, World

The sample project has two files, main.c and Makefile:

$ faur-new hello

$ tree hello/
hello/
├── build/
│   └── make/
│       └── Makefile
└── src/
    └── main.c

$ cd hello/build/make/
$ make run

Move the square with the arrow keys or with a game controller:

Hello, World screenshot

hello/src/main.c

#include <faur.h>

void f_main(void)
{
    static struct {
        int x, y;
        FButton *up, *down, *left, *right;
    } context;

    F_STATE_INIT
    {
        context.x = f_screen_sizeGetWidth() / 2;
        context.y = f_screen_sizeGetHeight() / 2;

        context.up = f_button_new();
        f_button_bindKey(context.up, F_KEY_UP);
        f_button_bindButton(context.up, NULL, F_BUTTON_UP);

        context.down = f_button_new();
        f_button_bindKey(context.down, F_KEY_DOWN);
        f_button_bindButton(context.down, NULL, F_BUTTON_DOWN);

        context.left = f_button_new();
        f_button_bindKey(context.left, F_KEY_LEFT);
        f_button_bindButton(context.left, NULL, F_BUTTON_LEFT);

        context.right = f_button_new();
        f_button_bindKey(context.right, F_KEY_RIGHT);
        f_button_bindButton(context.right, NULL, F_BUTTON_RIGHT);
    }

    F_STATE_TICK
    {
        if(f_button_pressGet(context.up)) {
            context.y--;
        }

        if(f_button_pressGet(context.down)) {
            context.y++;
        }

        if(f_button_pressGet(context.left)) {
            context.x--;
        }

        if(f_button_pressGet(context.right)) {
            context.x++;
        }
    }

    F_STATE_DRAW
    {
        f_color_colorSetHex(0xaaff88);
        f_draw_fill();

        f_color_colorSetHex(0xffaa44);
        f_draw_rectangle(context.x - 40, context.y - 40, 80, 80);
    }

    F_STATE_FREE
    {
        f_button_free(context.up);
        f_button_free(context.down);
        f_button_free(context.left);
        f_button_free(context.right);
    }
}

hello/build/make/Makefile

F_CONFIG_APP_AUTHOR := <author>
F_CONFIG_APP_NAME := hello

include $(FAUR_PATH)/make/default.mk

Cross-Compile for Other Platforms

I started Faur by collecting my GP2X games' shared code into a library. Over time I added support for more platforms:

Platform Toolchain Support Libraries
Desktop
Linux, FreeBSD OS build tools SDL 2.0, SDL_mixer 2.0, libpng 1.6
Windows MinGW-w64 SDL 2.0, SDL_mixer 2.0, libpng 1.6
Web (Wasm) Emscripten SDL 2.0, SDL_mixer 2.0, libpng 1.6
Embedded Linux
GP2X, GP2X Wiz Open2x SDK SDL 1.2, SDL_mixer 1.2, libpng 1.2
Caanoo GPH SDK SDL 1.2, SDL_mixer 1.2, libpng 1.2
Open Pandora Pandora SDK SDL 1.2, SDL_mixer 1.2, libpng 1.2
Arduino
Gamebuino META Arduino 1.8.13, Arduino SAMD Boards 1.8.11, Gamebuino META Boards 1.2.2 Gamebuino META 1.3
Odroid-GO Arduino 1.8.13, Arduino ESP32 1.0.6 ODROID-GO 1.0.0

The default toolchain paths are in make/global/sdk.mk, and they can be overridden in a project Makefile or globally in ~/.config/faur/sdk.mk. To build for different targets, change include $(FAUR_PATH)/make/default.mk to use other files from $(FAUR_PATH)/make.

License

Copyright 2010-2022 Alex Margarit ([email protected])

Faur is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. The project is named after the old Romanian word faur, sometimes used in fables to mean wizard blacksmith. ⚒️

Contributing

This is my personal framework and test bed for ideas, and to that end it is a solo project. You are welcome to check it out and use it under the terms of the license, but I do not take pull requests to this repo.

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