All Projects → pineapplemachine → mach.d

pineapplemachine / mach.d

Licence: other
Library for the D programming language.

Programming Languages

d
599 projects

Projects that are alternatives of or similar to mach.d

Dome
A lightweight game development environment where games can be written in Wren
Stars: ✭ 251 (+829.63%)
Mutual labels:  games, sdl2
Dosbox Staging
DOS/x86 emulator focusing on ease of use
Stars: ✭ 412 (+1425.93%)
Mutual labels:  games, sdl2
blues
Blues Brothers, Jukebox Adventure & Prehistorik 2 engine reimplementation (SDL2)
Stars: ✭ 28 (+3.7%)
Mutual labels:  games, sdl2
Chocolate Doom
Chocolate Doom is a Doom source port that is minimalist and historically accurate.
Stars: ✭ 1,052 (+3796.3%)
Mutual labels:  games, sdl2
Supertux
SuperTux source code
Stars: ✭ 1,120 (+4048.15%)
Mutual labels:  games, sdl2
F2bgl
Fade To Black engine reimplementation (SDL, OpenGL)
Stars: ✭ 54 (+100%)
Mutual labels:  games, sdl2
Cdogs Sdl
Classic overhead run-and-gun game
Stars: ✭ 422 (+1462.96%)
Mutual labels:  games, sdl2
Rawgl
Another World/Out of This World engine reimplementation (SDL, OpenGL)
Stars: ✭ 111 (+311.11%)
Mutual labels:  games, sdl2
shiromino
A fast-paced puzzle game with roots in the arcade.
Stars: ✭ 28 (+3.7%)
Mutual labels:  games, sdl2
fight-game
战斗小游戏-Java实现-设计模式
Stars: ✭ 26 (-3.7%)
Mutual labels:  games
libnvc
Easy way to embed (neo)vim in your application
Stars: ✭ 32 (+18.52%)
Mutual labels:  sdl2
virtualGizmo3D
Virtual GIZMO - 3D object manipulator / orientator, via mouse, with pan and dolly/zoom features
Stars: ✭ 36 (+33.33%)
Mutual labels:  sdl2
PySimpleGUI
Launched in 2018. It's 2022 and PySimpleGUI is actively developed & supported. Create complex windows simply. Supports tkinter, Qt, WxPython, Remi (in browser). Create GUI applications trivially with a full set of widgets. Multi-Window applications are also simple. 3.4 to 3.11 supported. 325+ Demo programs & Cookbook for rapid start. Extensive d…
Stars: ✭ 10,846 (+40070.37%)
Mutual labels:  games
Shadowcol
A python control interface to play games and control your PC using voice commands
Stars: ✭ 16 (-40.74%)
Mutual labels:  games
Fractal Engine
WIP 3D game engine with editor and other stuff
Stars: ✭ 152 (+462.96%)
Mutual labels:  games
BoilR
Synchronize games from other platforms into your Steam library
Stars: ✭ 664 (+2359.26%)
Mutual labels:  games
fermium
An easy to build and use set of SDL2 bindings.
Stars: ✭ 48 (+77.78%)
Mutual labels:  sdl2
RawSalmonEngine
A game engine utilising "Tiled" map files
Stars: ✭ 15 (-44.44%)
Mutual labels:  sdl2
Driftwood
Driftwood 2D Tiling Game Engine and Development Suite
Stars: ✭ 23 (-14.81%)
Mutual labels:  sdl2
pk2
Pekka Kana 2, a platformer game
Stars: ✭ 58 (+114.81%)
Mutual labels:  sdl2

mach.d

A general-purpose library for the D programming language, made with game development in mind.

This library is distributed under the very permissive zlib/libpng license. In short: You may do nearly anything you like with this software, provided you don't misrepresent its origin.

Be warned: This library is not yet mature, and I am constantly rewriting and improving and occassionally breaking code. That being said, I take some pride in the thoroughness of this library's unit tests. Said tests are frequently verified on Windows 7 and occassionally on OSX 10.9.5. (Eventually, I'll get around to setting up an automated build process that regularly tests on as many platforms as possible.)

Dependencies

The majority of this package depends only on the druntime and D's standard library, Phobos, and I'm working on cutting out the remaining Phobos dependencies.

The mach.sdl package requires some additional dependencies. See the package readme for details.

Usage

The mach folder should be placed where you are loading dependencies from. In the case of dmd or rdmd, this is a directory passed using the -I argument. In the case of dub, this is a path added to a project using dub add-path.

Beware compiling mach with the -unittest flag when linking on Windows with Optlink; a bug with Optlink causes the compilation to fail with a linker error. To compile on Windows with unit tests, the -m32mscoff switch must be passed to dmd/rdmd, and a version of Visual Studio including the linker must be available on the system.

See the examples directory for example programs showing how to use mach's functionality.

Places of interest

To output to the console and read user input, mach.io.stdio.

To read and write files, and to perform other file system operations, mach.io.file.path.

For higher-order functions and other functional programming tools, mach.range.

To generate a string representation of just about anything, mach.text.str.

To encode and decode UTF-8, UTF-16, and UTF-32, mach.text.utf.

To parse and encode JSON, mach.json.

For collections and related data structures, mach.collect.

Differences from Phobos

Major departures from Phobos' school of thought include:

No auto-decoding strings

The mach library does not give special treatment to character strings. Unless otherwise specified, the functions defined throughout the library will treat an array of chars or wchars as just that - an an array of chars (or wchars). The mach.text.utf module provides utfencode and utfdecode functions which should be called to explicitly encode and decode UTF strings.

import mach.text : utfdecode;
import mach.range : walklength;
string str = "\xE3\x83\x84";
assert(str.length == 3);
auto decoded = str.utfdecode;
assert(decoded.front == '');
assert(decoded.walklength == 1);

Arrays aren't ranges

Functions in this library do not necessarily accept ranges, they accept types which are valid as ranges. The distinction becomes most significant when working with arrays. Functions which accept ranges also accept types with an asrange property which returns an actual range. There are default asrange implementations for several types, including static and dynamic arrays, which functions throughout this library rely on to get a range from an inputted iterable when only a range will do.

import mach.range : asrange, filter, equals;
// An array - but not a range
int[] array = [0, 1, 2, 3];
// A range which iterates over an array
auto range = array.asrange;
// Functions in this library accept either one: A range, or a type which
// is valid as a range via the `asrange` property, including arrays.
auto arrayfilter = array.filter!(n => n % 2);
auto rangefilter = range.filter!(n => n % 2);
assert(arrayfilter.equals(rangefilter));

Other types can become similarly valid as ranges by giving them an asrange method. With this other collections can become valid as ranges, too, such as the doubly-linked list type defined in mach.collect.

import mach.collect : DoublyLinkedList;
import mach.range : filter, equals;
auto list = new DoublyLinkedList!int([0, 1, 2, 3]);
assert(list.filter!(n => n % 2).equals([1, 3]));

Ranges are not "moving windows"

In Phobos, ranges are conceptualized as moving windows over some source of data. In mach, ranges are as stationary windows with a moving cursor or, in the case of bidirectional ranges, a pair of moving cursors.

The indexes referred to via opIndex and opSlice remain consistent even while consuming the range, as does length.

import mach.range : asrange;
auto range = "hello".asrange;
assert(range.length == 5);
assert(range[0] == 'h');
range.popFront();
assert(range.length == 5);
assert(range[0] == 'h');

To get the number of elements remaining in a range, as the length property does in Phobos, ranges in this library support a remaining property which returns the number of elements the range will still iterate over.

import mach.range : asrange;
auto range = "hello".asrange;
assert(range.remaining == 5);
range.popFront();
assert(range.remaining == 4);
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].