返回资讯中心
外部精选
软件工程
#开发者实时流

Boxer – A lightweight 2D game library in C (WIP)

The Boxer project draws its name from the boxer engine architecture found in cars, symbolizing efficiency in a compact form. The logo's left and right ends evoke the horizontally opposed pistons of the boxer engine's fl…

Hacker News 最新n670942026/10/19 · 27 天前6 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

The Boxer project draws its name from the boxer engine architecture found in cars, symbolizing efficiency in a compact form. The logo's left and right ends evoke the horizontally opposed pistons of the boxer engine's flat design.

A lightweight and cross-platform easy to use 2D game library written in C.

Install the following development dependencies (via your package manager or from source):

git clone git@github.com:n67094/boxer.git cd boxer git submodule update --init --recursive

Build the library with:

make

Install the library at /usr/lib by default so make sure to have it in your library path, or specify a custom installation prefix with PREFIX:

make install or make install PREFIX=/custom/prefix

Uninstall the library with:

make uninstall

Build documentation with:

make docs

Once boxer is installed on your system, in order to run the example you may need to update the shared library cache with:

sudo ldconfig

Then you can build the example with:

cd example make ./example

let's make it roar!

Here is a simple example of how to initialize the library and create a window:

#include "bxr.h"

// Define the game configuration static bxr_game_config_t _config = { 0 };

// Allows boxer to get the game configuration bxr_game_config_t * bxr_game_config(void) { _config.name = "application_name"; _config.title = "Window Title";

_config.width = 1280; _config.height = 720;

_config.fullscreen = false; _config.resizable = true;

return &_config; }

void bxr_game_setup(void) { // Initialize game state here }

void bxr_game_update(Uint64 delta_time_ms) { // Update the game logic here. // The logic is updated at a fixed timestep depending on the screen refresh rate it's running on }

void bxr_game_render(Uint64 alpha_time_ms) { // Render the game here. // The game is rendered as many times per second as possible }

void bxr_game_teardown(void) { // Clean up game state here }

AI Usage Policy

I want this project to remain human as possible, please check out the AGENTS.md.

Hi everyone, I'm nsix, an indie game developer and open source contributor trying to make a living from my work.

If you enjoy what I create and want to support me, consider becoming a sponsor on GitHub Sponsors. Every bit of support means a lot and is greatly appreciated!

You can also check out my blog at www.nsix.blog.

This project is licensed under the zlib License. See the LICENSE file for details.

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →