• Stars
    star
    162
  • Rank 227,573 (Top 5 %)
  • Language
    PHP
  • Created over 4 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Just an OpenGL (SDL) demo in pure PHP

PHP OpenGL (SDL) Demo

PHP 8.1+ Latest Stable Version Latest Unstable Version License MIT

Please note that this is only a demo and may contain non-optimal, crazy and completely unbelievable programming techniques (Well, besides the fact that this code is written by a PHP 🐒 developer who has never encountered game development).

If your psyche was injured please consult a doctor.

Peace <3


Oh yes, according to my information, nobody has ever done such things in pure PHP.

Demo in action: https://www.youtube.com/watch?v=vsBbJbhKeeU

Requirements

  • PHP 8.1+
  • ext-ffi
  • Composer
  • Windows, Linux or Unix (over X11 and Wayland), MacOS

Additional Requirements (MacOS and Linux only)

  • SDL 2.0+
  • SDL Image 2.0+
  • SDL TTF 2.0+

Installation

Windows

  • composer install
  • php app.php

Linux

  • sudo apt install libsdl2-2.0-0 -y
  • sudo apt install libsdl2-image-2.0-0 -y
  • sudo apt install libsdl2-ttf-2.0-0 -y
  • composer install
  • php app.php

MacOS

  • brew install sdl2
  • brew install sdl2_image
  • brew install sdl2_ttf
  • composer install
  • php app.php

Docker

  • docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -e XAUTHORITY=$XAUTHORITY $(docker build -q .)

General Information

  • The "./engine/" directory contains deprecated code that will be removed in the future (for now it is required for the demo to work). All actual code is currently contained in the ./libs/ directory and some part of the old code has already been replaced with the current one.
  • It is planned to move away from separate installation of binaries (SDL, SDL Image, etc...) and ship them together with the application. The ./libs/binaries-downloader package is responsible for their installation. Assemblies are available here in the "assets" section here: https://github.com/SerafimArts/opengl-demo/releases/tag/0.0.1
  • It is planned to move away from SDL support and switch to native OpenGL API (This is one of the reasons why MacOS can disappear from the list of available operating systems), and then Vulkan API.
  • After rewriting the graphics pipeline, it is planned to add a sound/audio engine (fuck knows how to do it).

More Repositories

1

Properties

PHP properties implementation
PHP
79
star
2

ffi-sdl

SDL2 FFI bindings for the PHP language
C
27
star
3

Json5

JSON5 — JSON for humans
PHP
19
star
4

Asset

[Abandoned] Asset Compiler (Asset Pipeline) for Laravel
PHP
18
star
5

RoboticketLight

A low-contrast light theme for IntelliJ based IDE
17
star
6

Evacuator

Try-catch with multiple retries
PHP
17
star
7

Calculator

Calculator Example (AST Edition). Why not?
PHP
15
star
8

gitter-api

[production-ready] Gitter API implementation for php 7.0+ allowing sync, async and streaming access.
PHP
15
star
9

real-mvc-app

This is an example of real MVC application written on PHP
PHP
14
star
10

Hydrogen

This reposititory is abandoned use the actual instead:
PHP
12
star
11

Tankz

Sorry
PHP
10
star
12

Stream

PHP realtime source streaming library
PHP
8
star
13

PackedArray

Typed arrays with reduced memory consumption
PHP
8
star
14

zephir-composer-plugin

Zephir language composer installer
PHP
7
star
15

SerafimArts

Welcome!
7
star
16

dioma

[DRAFT] Powerfull dependency injection container
JavaScript
7
star
17

Async

Simple async library example
PHP
6
star
18

ffi-loader

FFI loader with simple C preprocessor
PHP
6
star
19

algebraic-types

PHP RFC (WIP)
6
star
20

Jit

[Exprimental] PHP JIT compiler over LLVM
C
6
star
21

LibExportView

Win32 application for viewing export functions
PHP
6
star
22

SharedMemoryBench

PHP SHM drivers bench
PHP
5
star
23

PEReader

Portable Exacutable (PE/COFF) reader
PHP
5
star
24

lightweb-builder

[DRAFT] Lightweight compiler for web-based applications
JavaScript
5
star
25

lexer-benchmarks

Multistate lexer implementations benchmarks
PHP
4
star
26

WinUI

[DRAFT] Experimental PHP WebView interface
PHP
4
star
27

PHP-Embedded

PHP example in one binary file
Dockerfile
4
star
28

Interval

A small library that implements the interval iterator function
PHP
3
star
29

HaxeWatcher

PHP
3
star
30

simple-interval-example

Simple setInterval example
PHP
3
star
31

Contracts

[WIP] Design by Contract library for PHP
PHP
3
star
32

Knockout-Validator

[production-ready] Knockout validation classes
CoffeeScript
3
star
33

Hydrator

DataMapper PHP library
PHP
3
star
34

phpdt

DataType language for PHP static analysis tools
PHP
3
star
35

Mutex

PHP mutex implementation
PHP
2
star
36

BinStream

Binary stream reader and writer
PHP
2
star
37

ffi-ide-helper

This package is deprecated, please use "ffi/ide-helper-generator" instead.
PHP
2
star
38

Knockdown

[production-ready] angular-like KnockoutJS
JavaScript
2
star
39

OpenGL

[Draft] PHP OpenGL bindings
PHP
2
star
40

ffi-sdl-ttf

SDL2 TTF FFI bindings for the PHP language
C
2
star
41

TF-IDF

Library to calculate TF-IDF (Term Frequency - Inverse Document Frequency) for generic documents
PHP
2
star
42

Laravel-Annotations

[production-ready] Doctrine annotations bridge for Laravel 5+
PHP
2
star
43

Observer

PHP
1
star
44

WBasic

An example Basic language parser-transpiler
PHP
1
star
45

php.quest-docs

1
star
46

DBGP-Emulator

[DRAFT] DBGP protocol emaultator. This is example.
PHP
1
star
47

jphp-audio-extension

Audio Extension for Jphp Language
Java
1
star
48

php.quest

PHP
1
star
49

jphp-awt-extension

AWT Extension for Jphp Language
Java
1
star