The base library of the polyplex engine. (Heavily work in progress)
Clipsey 6e48e8879e Merge branch 'master' of git.pplex.org:Polyplex/libpp 1 month ago
modules Added basic OpenGL wrapper, removed bind_attribs. Removed compatobjects. 1 month ago
shaders Rewrite of sprite batcher using new GLOO system 1 month ago
source Avoid crashes when: No soundcard is available, no EFX support is available and fix framebuffer orientation. 1 month ago
.gitignore Adding quaternion, and unittests & fixes to vector 10 months ago
.gitmodules Not using submodules until dub supports it. We will have to manually update files 11 months ago
CODESTYLE.md Fix spacing issue in CODESTYLE.md 7 months ago
CODE_OF_CONDUCT.md Update code of conduct 7 months ago
LICENSE change to boost license 9 months ago
PATRONS.md Update 'PATRONS.md' 6 months ago
README.md Add quick explanation for Load for raw files. 1 month ago
dub.json Rewrite of sprite batcher using new GLOO system 1 month ago
dub.selections.json Shader loading 1 month ago
pp-test-simplemath smoothstep and vector interop 7 months ago

README.md

Polyplex Logo

Polyplex Main Library (libpp)

Buy Clipsey a Coffee at ko-fi.com Mastodon | Twitter

Join the Discord Server

libpp is an XNA like framework written in D. libpp supports OpenGL and will in the future support Vulkan.

The framework is written to be easy to read and understand for people comming from an C#/XNA background.

libpp is the base rendering, input handling, content handling, etc. library for the WIP Polyplex engine.

Top Tier Patrons

  • The Linux Gamer Community
  • WeimTime

Using libpp

Find libpp on the dub database for instructions on adding libpp as a dependency to your dub project.

Once added, you will need to set logging levels, choose a backend and create a window.

Current capabilities

Polyplex is still very early in development, but libpp can already be used to make simple 2D games, that are relatively easy to port to other platforms. Polyplex packages textures, sounds, etc. into files with the extension ppc. To convert ogg, png, jpeg or tga files to .ppc, use ppcc

Othewise, you can use Content.Load!(Type)(string); by prepending ! to the path (based on content directory) to the raw file.

Examples

PPCC

ppcc -c (or --convert) my_file.(extension) output will be put in my_file.ppc.

From libpp it can be accessed via ContentManager.Load!Type("my_file")

libpp

Example of simple polyplex application:

module example;
import std.stdio;
import polyplex;
import polyplex.math;

void main(string[] args)
{
	arg = args[1..$];

	// Enable info and debug logs.
	LogLevel |= LogType.Info;
	LogLevel |= LogType.Debug;

	// Create game instance and start game.
	MyGame game = new MyGame();
	game.Run();
}

class MyGame : Game
{
	Texture2D myTexture;
	this() {

	}

	public override void Init()
	{
		// Enable/Disable VSync.
		Window.VSync = VSyncState.VSync;
	}

	public override void LoadContent() {
		// Load textures, sound, shaders, etc. here

		//Example:
		myTexture = Content.Load!Texture2D("myTexture");
	}	

	public override void Update(GameTimes game_time)
	{
		world.Update(game_time);
	}

	public override void Draw(GameTimes game_time)
	{
		Renderer.ClearColor(Color.CornflowerBlue);
	}
}

You can also check out example_game, which is used as a testbed for new libpp features/fixes.

Notice

The library is written in what would be considered non-idiomatic D.